From 72ab95d4bfffb1d0d206f9dd37e14f4e86b13707 Mon Sep 17 00:00:00 2001 From: Syahrial Agni Prasetya Date: Thu, 27 May 2021 18:07:36 +0700 Subject: [PATCH] POSIX rewrite: uth.bash --- install.sh | 2 +- src/uth | 31 +++++++++++++++++++++++++++++++ src/uth.bash | 31 ------------------------------- 3 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 src/uth delete mode 100644 src/uth.bash diff --git a/install.sh b/install.sh index 27b97e0..c0cbf20 100755 --- a/install.sh +++ b/install.sh @@ -50,7 +50,7 @@ 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 $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 $PREFIX/share/archbox/bin/uth grep 'PREFIX=' $ETC_DIR/archbox.conf >/dev/null 2>&1 || cat << EOF >> $ETC_DIR/archbox.conf diff --git a/src/uth b/src/uth new file mode 100644 index 0000000..836d536 --- /dev/null +++ b/src/uth @@ -0,0 +1,31 @@ +#!/bin/sh + +. /etc/archbox.conf >/dev/null 2>&1 +. /tmp/archbox_env >/dev/null 2>&1 + +case $1 in + copyresolv) + cp /etc/resolv.conf "${CHROOT}"/etc/resolv.conf + ;; + killxdg) + umount -l "${CHROOT}"/run + fuser -km $XDG_RUNTIME_DIR + exit $? + ;; + runtimeonly) + mkdir -p "${CHROOT}"${XDG_RUNTIME_DIR} + umount -Rl "${CHROOT}"${XDG_RUNTIME_DIR} 2>/dev/null + mount | grep "${CHROOT}"${XDG_RUNTIME_DIR} || \ + mount --rbind $XDG_RUNTIME_DIR "${CHROOT}"${XDG_RUNTIME_DIR} + exit $? + ;; + remountrun) + umount -l "${CHROOT}"/run 2>/dev/null + mount --rbind /run "${CHROOT}"/run + exit $? + ;; + chownvar) + chown $2 /tmp/archbox_env + chmod 755 /tmp/archbox_env + ;; +esac diff --git a/src/uth.bash b/src/uth.bash deleted file mode 100644 index b190f57..0000000 --- a/src/uth.bash +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -source /etc/archbox.conf &>/dev/null -source /tmp/archbox_env &>/dev/null - -case $1 in - copyresolv) - cp /etc/resolv.conf $CHROOT/etc/resolv.conf - ;; - killxdg) - umount -l $CHROOT/run - fuser -km $XDG_RUNTIME_DIR - exit $? - ;; - runtimeonly) - mkdir -p $CHROOT$XDG_RUNTIME_DIR - umount -Rl $CHROOT$XDG_RUNTIME_DIR 2>/dev/null - mount | grep $CHROOT$XDG_RUNTIME_DIR || \ - mount --rbind $XDG_RUNTIME_DIR $CHROOT$XDG_RUNTIME_DIR - exit $? - ;; - remountrun) - umount -l $CHROOT/run 2>/dev/null - mount --rbind /run $CHROOT/run - exit $? - ;; - chownvar) - chown $2 /tmp/archbox_env - chmod 755 /tmp/archbox_env - ;; -esac