Skip to content

Commit df8ab05

Browse files
committed
Support busybox as /bin/sh in chroot
1 parent 2fa207e commit df8ab05

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

zfsbootmenu/bin/zfs-chroot

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ if [ -x "${mountpoint}/bin/bash" ] \
7777
elif [ -x "${mountpoint}/bin/sh" ] \
7878
&& chroot "${mountpoint}" /bin/sh -c "exit 0" >/dev/null 2>&1 ; then
7979
_SHELL="/bin/sh"
80+
elif [ -x "${mountpoint}/bin/busybox" ] \
81+
&& chroot "${mountpoint}" /bin/busybox sh -c "exit 0" >/dev/null 2>&1 ; then
82+
_SHELL="/bin/busybox"
83+
chroot_extra="sh"
8084
fi
8185

8286
if [ -z "${_SHELL}" ]; then
@@ -87,6 +91,7 @@ fi
8791
echo -e "$( colorize orange "${selected}") is mounted ${writemode}, /tmp is shared and read/write\n"
8892

8993
# regardless of shell, set PS1
90-
if ! env "PS1=\[\033[0;33m\]${selected}\[\033[0m\] \w > " chroot "${mountpoint}" "${_SHELL}" "${chroot_extra}" ; then
94+
# shellcheck disable=SC2086
95+
if ! env "PS1=\[\033[0;33m\]${selected}\[\033[0m\] \w > " chroot ${mountpoint} ${_SHELL} ${chroot_extra} ; then
9196
zdebug "chroot ${selected}:${_SHELL} returned code $?"
9297
fi

0 commit comments

Comments
 (0)