From 5b732eba04605611643078000922a32189c270fa Mon Sep 17 00:00:00 2001 From: Syahrial Agni Prasetya Date: Thu, 27 May 2021 17:27:10 +0700 Subject: [PATCH] POSIX rewrite: exec.bash --- install.sh | 4 ++-- src/{enter.bash => enter} | 2 +- src/exec | 10 ++++++++++ src/exec.bash | 13 ------------- 4 files changed, 13 insertions(+), 16 deletions(-) rename src/{enter.bash => enter} (93%) create mode 100644 src/exec delete mode 100644 src/exec.bash diff --git a/install.sh b/install.sh index 532cc0b..a4b84cf 100755 --- a/install.sh +++ b/install.sh @@ -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-desktop $PREFIX/bin/archbox-desktop [[ ! -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/enter.bash $PREFIX/share/archbox/bin/enter +install -v -D -m 755 ./src/exec $PREFIX/share/archbox/bin/exec +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/init.bash $PREFIX/share/archbox/bin/init install -v -D -m 755 ./src/uth.bash $PREFIX/share/archbox/bin/uth diff --git a/src/enter.bash b/src/enter similarity index 93% rename from src/enter.bash rename to src/enter index 225a088..852d80c 100644 --- a/src/enter.bash +++ b/src/enter @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh . /etc/archbox.conf >/dev/null 2>&1 . /tmp/archbox_env >/dev/null 2>&1 diff --git a/src/exec b/src/exec new file mode 100644 index 0000000..e92e563 --- /dev/null +++ b/src/exec @@ -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 diff --git a/src/exec.bash b/src/exec.bash deleted file mode 100644 index 092bab0..0000000 --- a/src/exec.bash +++ /dev/null @@ -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