stage-1: accept init symlinks at any level

This commit is contained in:
Tyson Whitehead 2021-02-25 15:27:02 -05:00
parent fb3970ef7d
commit aed7c9a22a
No known key found for this signature in database
GPG key ID: B22199763A27997B

View file

@ -614,11 +614,16 @@ echo /sbin/modprobe > /proc/sys/kernel/modprobe
# Start stage 2. `switch_root' deletes all files in the ramfs on the # Start stage 2. `switch_root' deletes all files in the ramfs on the
# current root. Note that $stage2Init might be an absolute symlink, # current root. The path has to be valid in the chroot not outside.
# in which case "-e" won't work because we're not in the chroot yet. if [ ! -e "$targetRoot/$stage2Init" ]; then
if [ ! -e "$targetRoot/$stage2Init" ] && [ ! -L "$targetRoot/$stage2Init" ] ; then stage2Check=${stage2Init}
echo "stage 2 init script ($targetRoot/$stage2Init) not found" while [ "$stage2Check" != "${stage2Check%/*}" ] && [ ! -L "$targetRoot/$stage2Check" ]; do
fail stage2Check=${stage2Check%/*}
done
if [ ! -L "$targetRoot/$stage2Check" ]; then
echo "stage 2 init script ($targetRoot/$stage2Init) not found"
fail
fi
fi fi
mkdir -m 0755 -p $targetRoot/proc $targetRoot/sys $targetRoot/dev $targetRoot/run mkdir -m 0755 -p $targetRoot/proc $targetRoot/sys $targetRoot/dev $targetRoot/run