diff --git a/archbox.bash b/archbox.bash index 761e8fe..8c29642 100755 --- a/archbox.bash +++ b/archbox.bash @@ -14,9 +14,13 @@ asroot(){ [[ $EUID -ne 0 ]] && err "Run this as root!" } +storedbus(){ + echo $DBUS_SESSION_ADDRESS > /tmp/archbox_dbus_session_address +} + help_text(){ cat << EOF -USAGE $0 +USAGE: $0 OPTIONS: --create LINK Creates a chroot enviroment. @@ -74,8 +78,9 @@ case $1 in chroot $CHROOT /bin/bash -c "sh /chroot_setup" ;; --enter) - copyresolv - $PRIV /usr/local/share/archbox/bin/archbox --enter + storedbus + copyresolv + $PRIV /usr/local/share/archbox/bin/archbox enter ;; --help) help_text @@ -87,8 +92,9 @@ case $1 in err "Unknown option: $1" ;; *) + storedbus copyresolv COMMAND=$(echo $@ | tr ' ' '\ ') - $PRIV /usr/local/share/archbox/bin/archbox $COMMAND + $PRIV /usr/local/share/archbox/bin/archbox $COMMAND ;; esac diff --git a/archboxcommand.bash b/archboxcommand.bash index af00d00..5c8d886 100755 --- a/archboxcommand.bash +++ b/archboxcommand.bash @@ -2,6 +2,7 @@ source /etc/archbox.conf +DBUS_ADDRESS="$(cat /tmp/archbox_dbus_session_address)" COMMAND=$(echo $@ | tr ' ' '\ ') -[[ $1 = "--enter" ]] && chroot $CHROOT /bin/su $USER \ - || chroot $CHROOT /bin/su -c "$COMMAND" $USER +[[ $1 = "enter" ]] && chroot $CHROOT /sbin/env DBUS_SESSION_BUS_ADDRESS=$DBUS_ADDRESS /bin/su $USER \ + || chroot $CHROOT /bin/su -c "env $DBUS_ADDRESS $COMMAND" $USER