Bring DBUS_SESSION_BUS_ADDRESS variable to chroot
This commit is contained in:
parent
28a4025ee5
commit
0d061f1e4f
10
archbox.bash
10
archbox.bash
@ -14,9 +14,13 @@ asroot(){
|
|||||||
[[ $EUID -ne 0 ]] && err "Run this as root!"
|
[[ $EUID -ne 0 ]] && err "Run this as root!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
storedbus(){
|
||||||
|
echo $DBUS_SESSION_ADDRESS > /tmp/archbox_dbus_session_address
|
||||||
|
}
|
||||||
|
|
||||||
help_text(){
|
help_text(){
|
||||||
cat << EOF
|
cat << EOF
|
||||||
USAGE $0 <arguments>
|
USAGE: $0 <arguments>
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
--create LINK Creates a chroot enviroment.
|
--create LINK Creates a chroot enviroment.
|
||||||
@ -74,8 +78,9 @@ case $1 in
|
|||||||
chroot $CHROOT /bin/bash -c "sh /chroot_setup"
|
chroot $CHROOT /bin/bash -c "sh /chroot_setup"
|
||||||
;;
|
;;
|
||||||
--enter)
|
--enter)
|
||||||
|
storedbus
|
||||||
copyresolv
|
copyresolv
|
||||||
$PRIV /usr/local/share/archbox/bin/archbox --enter
|
$PRIV /usr/local/share/archbox/bin/archbox enter
|
||||||
;;
|
;;
|
||||||
--help)
|
--help)
|
||||||
help_text
|
help_text
|
||||||
@ -87,6 +92,7 @@ case $1 in
|
|||||||
err "Unknown option: $1"
|
err "Unknown option: $1"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
storedbus
|
||||||
copyresolv
|
copyresolv
|
||||||
COMMAND=$(echo $@ | tr ' ' '\ ')
|
COMMAND=$(echo $@ | tr ' ' '\ ')
|
||||||
$PRIV /usr/local/share/archbox/bin/archbox $COMMAND
|
$PRIV /usr/local/share/archbox/bin/archbox $COMMAND
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
source /etc/archbox.conf
|
source /etc/archbox.conf
|
||||||
|
|
||||||
|
DBUS_ADDRESS="$(cat /tmp/archbox_dbus_session_address)"
|
||||||
COMMAND=$(echo $@ | tr ' ' '\ ')
|
COMMAND=$(echo $@ | tr ' ' '\ ')
|
||||||
[[ $1 = "--enter" ]] && chroot $CHROOT /bin/su $USER \
|
[[ $1 = "enter" ]] && chroot $CHROOT /sbin/env DBUS_SESSION_BUS_ADDRESS=$DBUS_ADDRESS /bin/su $USER \
|
||||||
|| chroot $CHROOT /bin/su -c "$COMMAND" $USER
|
|| chroot $CHROOT /bin/su -c "env $DBUS_ADDRESS $COMMAND" $USER
|
||||||
|
Loading…
Reference in New Issue
Block a user