Fix executing 'enter' in chroot when non-zero return in the last executed command in chroot.

This commit is contained in:
lemniskett 2020-11-03 22:57:39 +07:00
parent aa26dba71b
commit 2d0fedec81

View File

@ -7,5 +7,5 @@ REQ_ENV="DBUS_SESSION_BUS_ADDRESS=$(cat /tmp/archbox_dbus_session_address) XDG_R
ENV="$REQ_ENV $ENV_VAR" ENV="$REQ_ENV $ENV_VAR"
COMMAND=$(echo $@ | tr ' ' '\ ') COMMAND=$(echo $@ | tr ' ' '\ ')
[[ $1 = "enter" ]] && chroot $CHROOT /sbin/env $ENV /bin/su $USER \ [[ $1 = "enter" ]] && (chroot $CHROOT /sbin/env $ENV /bin/su $USER; exit 0) \
|| chroot $CHROOT /bin/su -c "env $ENV $COMMAND" $USER || chroot $CHROOT /bin/su -c "env $ENV $COMMAND" $USER