diff --git a/archbox.bash b/archbox.bash index 0f431d6..3b885e4 100755 --- a/archbox.bash +++ b/archbox.bash @@ -14,8 +14,9 @@ asroot(){ [[ $EUID -ne 0 ]] && err "Run this as root!" } -storedbus(){ - echo $DBUS_SESSION_BUS_ADDRESS > /tmp/archbox_dbus_session_address +storeenv(){ + echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" > /tmp/env_archbox + echo "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR" >> /tmp/env_archbox } 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..93ce184 100755 --- a/archboxcommand.bash +++ b/archboxcommand.bash @@ -2,7 +2,7 @@ source /etc/archbox.conf -DBUS_ADDRESS="$(cat /tmp/archbox_dbus_session_address)" +ENV="$(cat /tmp/env_archbox)" 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 $ENV /bin/su $USER \ + || chroot $CHROOT /bin/su -c "env $ENV $COMMAND" $USER