archbox/archboxcommand.bash
2020-12-28 12:22:53 +07:00

11 lines
350 B
Bash
Executable File

#!/usr/bin/env bash
source /etc/archbox.conf
REQ_ENV="DBUS_SESSION_BUS_ADDRESS=$(cat /tmp/archbox_dbus_session_address) XDG_RUNTIME_DIR=$(cat /tmp/archbox_xdg_runtime_dir)"
ENV="$REQ_ENV $ENV_VAR"
COMMAND="$@"
[[ $1 = "enter" ]] && (chroot $CHROOT /sbin/env $ENV /bin/su $USER; exit 0) \
|| chroot $CHROOT /bin/su -c "env $ENV $COMMAND" $USER