fix mounter issue

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
Davanum Srinivas 2025-11-30 18:31:36 -05:00
parent 61c629cc57
commit 2dd576e6cb
No known key found for this signature in database
GPG key ID: 6DEA177048756885

View file

@ -28,6 +28,7 @@ const (
// Location of the mount file to use
chrootCmd = "chroot"
mountCmd = "mount"
mountBin = "/bin/mount"
rootfs = "rootfs"
nfsRPCBindErrMsg = "mount.nfs: rpc.statd is not running but is required for remote locking.\nmount.nfs: Either use '-o nolock' to keep locks local, or start statd.\nmount.nfs: an incorrect mount option was specified\n"
rpcBindCmd = "/sbin/rpcbind"
@ -60,12 +61,12 @@ func main() {
}
}
// MountInChroot is to run mount within chroot with the passing root directory
// mountInChroot runs mount within chroot with the passing root directory
func mountInChroot(rootfsPath string, args []string) error {
if _, err := os.Stat(rootfsPath); os.IsNotExist(err) {
return fmt.Errorf("path <%s> does not exist", rootfsPath)
}
args = append([]string{rootfsPath, mountCmd}, args...)
args = append([]string{rootfsPath, mountBin}, args...)
output, err := exec.Command(chrootCmd, args...).CombinedOutput()
if err == nil {
return nil