From d5b96dcaabfa5dac4c7c65e65387a9e83906f6dc Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Tue, 28 Jan 2020 16:53:04 +0100 Subject: [PATCH] Call shell by absolute path in chroot When using the --script-chroot option, chroot is called with just sh (relative path), relying on the host environment's $PATH to find the executable. At least on Arch Linux, this does not work, as Arch Linux by default does not have /bin in the PATH (/bin is just a symlink to /usr/bin). Since the chroot system was just built and it is know to contain /bin/sh, I think it makes sense to just call it explicitly here. Related to https://github.com/alpinelinux/alpine-make-rootfs/issues/10 Co-Authored-By: Conrad Hoffmann --- alpine-make-vm-image | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alpine-make-vm-image b/alpine-make-vm-image index 2e35c34..86ae859 100755 --- a/alpine-make-vm-image +++ b/alpine-make-vm-image @@ -498,7 +498,7 @@ if [ "$SCRIPT" ]; then else einfo "Executing script in chroot: $script_name $*" mount_bind "${SCRIPT%/*}" mnt/ - chroot . sh -c "cd /mnt && ./$script_name \"\$@\"" -- "$@" \ + chroot . /bin/sh -c "cd /mnt && ./$script_name \"\$@\"" -- "$@" \ || die 'Script failed' fi fi