POSIX rewrite: exec.bash

This commit is contained in:
Syahrial Agni Prasetya 2021-05-27 17:27:10 +07:00
parent cdaa7c8aca
commit 5b732eba04
No known key found for this signature in database
GPG Key ID: 46F88749C8C79383
4 changed files with 13 additions and 16 deletions

View File

@ -46,8 +46,8 @@ mkdir -p $ETC_DIR
install -v -D -m 755 ./src/archbox $PREFIX/bin/archbox install -v -D -m 755 ./src/archbox $PREFIX/bin/archbox
install -v -D -m 755 ./src/archbox-desktop $PREFIX/bin/archbox-desktop install -v -D -m 755 ./src/archbox-desktop $PREFIX/bin/archbox-desktop
[[ ! -e /etc/archbox.conf || ! -z $FORCE_INSTALL_CONFIG ]] && genconfig > $ETC_DIR/archbox.conf [[ ! -e /etc/archbox.conf || ! -z $FORCE_INSTALL_CONFIG ]] && genconfig > $ETC_DIR/archbox.conf
install -v -D -m 755 ./src/exec.bash $PREFIX/share/archbox/bin/exec install -v -D -m 755 ./src/exec $PREFIX/share/archbox/bin/exec
install -v -D -m 755 ./src/enter.bash $PREFIX/share/archbox/bin/enter install -v -D -m 755 ./src/enter $PREFIX/share/archbox/bin/enter
install -v -D -m 755 ./src/chroot_setup $PREFIX/share/archbox/chroot_setup install -v -D -m 755 ./src/chroot_setup $PREFIX/share/archbox/chroot_setup
install -v -D -m 755 ./src/init.bash $PREFIX/share/archbox/bin/init install -v -D -m 755 ./src/init.bash $PREFIX/share/archbox/bin/init
install -v -D -m 755 ./src/uth.bash $PREFIX/share/archbox/bin/uth install -v -D -m 755 ./src/uth.bash $PREFIX/share/archbox/bin/uth

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/sh
. /etc/archbox.conf >/dev/null 2>&1 . /etc/archbox.conf >/dev/null 2>&1
. /tmp/archbox_env >/dev/null 2>&1 . /tmp/archbox_env >/dev/null 2>&1

10
src/exec Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
. /etc/archbox.conf >/dev/null 2>&1
. /tmp/archbox_env >/dev/null 2>&1
REQ_ENV="DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR DISPLAY=$DISPLAY WAYLAND_DISPLAY=$WAYLAND_DISPLAY"
ENV="$REQ_ENV $ENV_VAR"
COMMAND="$@"
chroot $CHROOT /bin/su -c "env $ENV $COMMAND" $ARCHBOX_USER

View File

@ -1,13 +0,0 @@
#!/usr/bin/env bash
source /etc/archbox.conf &>/dev/null
source /tmp/archbox_env &>/dev/null
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 /bin/su -c "env $ENV $COMMAND" $ARCHBOX_USER