archbox/archboxcommand.bash

10 lines
450 B
Bash
Raw Normal View History

2020-10-27 06:12:14 +00:00
#!/bin/bash
source /etc/archbox.conf
2020-10-28 16:06:06 +00:00
DBUS_ADDRESS_ENV="$(cat /tmp/archbox_dbus_session_address)"
XDG_RUNTIME_ENV="$(cat /tmp/archbox_xdg_runtime_dir)
2020-10-27 07:22:51 +00:00
COMMAND=$(echo $@ | tr ' ' '\ ')
[[ $1 = "enter" ]] && chroot $CHROOT /sbin/env DBUS_SESSION_BUS_ADDRESS=$DBUS_ADDRESS_ENV XDG_RUNTIME_DIR=$XDG_RUNTIME_ENV /bin/su $USER \
|| chroot $CHROOT /bin/su -c "env DBUS_SESSION_BUS_ADDRESS=$DBUS_ADDRESS XDG_RUNTIME_DIR=$XDG_RUNTIME_ENV $COMMAND" $USER