diff --git a/archbox.bash b/archbox.bash index 0f431d6..dc3bd4e 100755 --- a/archbox.bash +++ b/archbox.bash @@ -14,8 +14,9 @@ asroot(){ [[ $EUID -ne 0 ]] && err "Run this as root!" } -storedbus(){ +storeenv(){ echo $DBUS_SESSION_BUS_ADDRESS > /tmp/archbox_dbus_session_address + echo $XDG_RUNTIME_DIR > /tmp/archbox_xdg_runtime_dir } help_text(){ @@ -78,7 +79,7 @@ case $1 in chroot $CHROOT /bin/bash -c "sh /chroot_setup" ;; --enter) - storedbus + storeenv copyresolv $PRIV /usr/local/share/archbox/bin/archbox enter ;; @@ -92,7 +93,7 @@ case $1 in err "Unknown option: $1" ;; *) - storedbus + storeenv copyresolv COMMAND=$(echo $@ | tr ' ' '\ ') $PRIV /usr/local/share/archbox/bin/archbox $COMMAND diff --git a/archboxcommand.bash b/archboxcommand.bash index 2363aa4..fd6933d 100755 --- a/archboxcommand.bash +++ b/archboxcommand.bash @@ -2,7 +2,8 @@ source /etc/archbox.conf -DBUS_ADDRESS="$(cat /tmp/archbox_dbus_session_address)" +DBUS_ADDRESS_ENV="$(cat /tmp/archbox_dbus_session_address)" +XDG_RUNTIME_ENV="$(cat /tmp/archbox_xdg_runtime_dir) COMMAND=$(echo $@ | tr ' ' '\ ') -[[ $1 = "enter" ]] && chroot $CHROOT /sbin/env DBUS_SESSION_BUS_ADDRESS=$DBUS_ADDRESS /bin/su $USER \ - || chroot $CHROOT /bin/su -c "env DBUS_SESSION_BUS_ADDRESS=$DBUS_ADDRESS $COMMAND" $USER +[[ $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