Separate enter and exec command and some changes.

This commit is contained in:
Syahrial Agni Prasetya 2021-03-06 12:51:01 +07:00
parent 774b97537d
commit 7fcc8d2ad0
No known key found for this signature in database
GPG Key ID: 46F88749C8C79383
4 changed files with 21 additions and 8 deletions

View File

@ -82,7 +82,7 @@ case $1 in
checkdep sed
sed -i 's/CheckSpace/#CheckSpace/g' $CHROOT/etc/pacman.conf
msg "Mounting necessary filesystems..."
$PREFIX/share/archbox/bin/archboxinit start
$PREFIX/share/archbox/bin/init start
cp $PREFIX/share/archbox/chroot_setup.bash $CHROOT/chroot_setup
echo $USER > /tmp/archbox_user
chroot $CHROOT /bin/bash -c "/chroot_setup"
@ -91,16 +91,16 @@ case $1 in
-e|--enter)
storeenv
$PRIV $PREFIX/share/archbox/bin/uth copyresolv
$PRIV $PREFIX/share/archbox/bin/archbox enter
$PRIV $PREFIX/share/archbox/bin/enter
exit $?
;;
-m|--mount)
storeenv
$PRIV $PREFIX/share/archbox/bin/archboxinit start
$PRIV $PREFIX/share/archbox/bin/init start
;;
-u|--umount)
storeenv
$PRIV $PREFIX/share/archbox/bin/archboxinit stop
$PRIV $PREFIX/share/archbox/bin/init stop
;;
--remount-run)
storeenv
@ -126,7 +126,7 @@ case $1 in
*)
storeenv
$PRIV $PREFIX/share/archbox/bin/uth copyresolv
$PRIV $PREFIX/share/archbox/bin/archbox $@
$PRIV $PREFIX/share/archbox/bin/exec $@
exit $?
;;
esac

13
enter.bash Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
source /etc/archbox.conf
source /tmp/archbox_env
REQ_ENV="DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS "
REQ_ENV+="XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR "
[[ ! -z $DISPLAY ]] && REQ_ENV+="DISPLAY=$DISPLAY "
[[ ! -z $WAYLAND_DISPLAY ]] && REQ_ENV+="WAYLAND_DISPLAY=$WAYLAND_DISPLAY "
ENV="$REQ_ENV $ENV_VAR"
COMMAND="$@"
chroot $CHROOT /sbin/env $ENV /bin/su $USER

View File

@ -10,5 +10,4 @@ REQ_ENV+="XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR "
ENV="$REQ_ENV $ENV_VAR"
COMMAND="$@"
[[ $1 = "enter" ]] && (chroot $CHROOT /sbin/env $ENV /bin/su $USER; exit 0) \
|| chroot $CHROOT /bin/su -c "env $ENV $COMMAND" $USER
chroot $CHROOT /bin/su -c "env $ENV $COMMAND" $USER

View File

@ -6,7 +6,8 @@ mkdir -p $PREFIX/share/archbox/bin
install -v -D -m 755 ./archbox.bash $PREFIX/bin/archbox
install -v -D -m 755 ./archbox-desktop.bash $PREFIX/bin/archbox-desktop
[[ ! -e /etc/archbox.conf ]] && install -v -D -m 755 ./archbox.conf /etc/archbox.conf
install -v -D -m 755 ./archboxcommand.bash $PREFIX/share/archbox/bin/archbox
install -v -D -m 755 ./exec.bash $PREFIX/share/archbox/bin/exec
install -v -D -m 755 ./enter.bash $PREFIX/share/archbox/bin/enter
install -v -D -m 755 ./chroot_setup.bash $PREFIX/share/archbox/chroot_setup.bash
install -v -D -m 755 ./init.bash $PREFIX/share/archbox/bin/init
install -v -D -m 755 ./uth.bash $PREFIX/share/archbox/bin/uth