github.com/apptainer/singularity@v3.1.1+incompatible/internal/app/singularity/oci_mount_linux.go (about)

     1  // Copyright (c) 2018-2019, Sylabs Inc. All rights reserved.
     2  // This software is licensed under a 3-clause BSD license. Please consult the
     3  // LICENSE.md file distributed with the sources of this project regarding your
     4  // rights to use or distribute this software.
     5  
     6  package singularity
     7  
     8  import (
     9  	ocibundle "github.com/sylabs/singularity/pkg/ocibundle/sif"
    10  )
    11  
    12  // OciMount mount a SIF image to create an OCI bundle
    13  func OciMount(image string, bundle string) error {
    14  	d, err := ocibundle.FromSif(image, bundle, true)
    15  	if err != nil {
    16  		return err
    17  	}
    18  	return d.Create(nil)
    19  }
    20  
    21  // OciUmount umount SIF and delete OCI bundle
    22  func OciUmount(bundle string) error {
    23  	d, err := ocibundle.FromSif("", bundle, true)
    24  	if err != nil {
    25  		return err
    26  	}
    27  	return d.Delete()
    28  }