diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2017-12-24 22:59:06 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2017-12-24 22:59:06 -0800 |
commit | 7106119b1375fce44bdef2c56bead46a3a02b848 (patch) | |
tree | bceaf8128b51881890675ddbcf639afc9d13e647 | |
parent | gen_compile: fix dmraid lvm linking (diff) | |
download | genkernel-7106119b1375fce44bdef2c56bead46a3a02b848.tar.gz genkernel-7106119b1375fce44bdef2c56bead46a3a02b848.tar.bz2 genkernel-7106119b1375fce44bdef2c56bead46a3a02b848.zip |
linuxrc: fix init test for cdroot/squashfs.
In a cdroot-squashfs environment, the /sbin/init path is an absolute
symlink that is ONLY valid inside the chroot. As such, doing a
executable test -x on it, from outside the chroot will fail, because the
symlink destination is not valid outside $CHROOT.
Improve the test to be done inside the chroot. Alternatively, it could
detect a symlink and dereference it inside the chroot.
Closes: https://bugs.gentoo.org/639034
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r-- | defaults/linuxrc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/defaults/linuxrc b/defaults/linuxrc index 7fd32f0c..df4272a8 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -1048,7 +1048,7 @@ rundebugshell "before entering switch_root" init=${REAL_INIT:-/sbin/init} if ! mountpoint "${CHROOT}"; then bad_msg "$CHROOT was not a mountpoint" -elif [ ! -x ${CHROOT}/${init} ]; then +elif chroot "${CHROOT}" /usr/bin/test ! -x /${init} ; then bad_msg "init=${init} does not exist in the rootfs!" elif [ $$ != 1 ]; then bad_msg "PID was not 1! switch_root would fail" |