summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2020-09-26 20:49:28 -0400
committerbill-auger <mr.j.spam.me@gmail.com>2020-11-20 22:53:31 -0500
commit09ed805539c142398b4ec58bd9550eed1a2f2f94 (patch)
treea1b34e5cdd823f9d021b284ecca31cf23570267f
parentb57cee2593be5f8ef560cfc922d9b451e1a085c8 (diff)
sq - not sure
-rw-r--r--src/lib/conf.sh.in23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/conf.sh.in b/src/lib/conf.sh.in
index 757f60a..110aa38 100644
--- a/src/lib/conf.sh.in
+++ b/src/lib/conf.sh.in
@@ -22,32 +22,29 @@
## configuration begin ##
-# NOTE: $LIBREUSER is $SUDO_USER unless UID->0, or $USER otherwise
+# NOTE: $LIBREUSER is $SUDO_USER if set and has non-zero UID, $USER otherwise
# hackers.git login
# default: $LIBREUSER
REPOUSER=
# parent directory of default $WORKDIR (per /etc/libretools.conf)
-# default: ~$LIBREUSER/ unless SUDO_USER != $USER,
-# $HOME/$LIBREUSER/ otherwise
+# default: ~$LIBREUSER
# NOTE: $WORKDIR and $LIBREHOME/.cache must be writable by $LIBREUSER
LIBREHOME=
## configuration end ##
+## prepare environment ##
+
if [[ "$(id -u "${SUDO_USER:-root}")" == 0 ]]; then
unset SUDO_USER
fi
LIBREUSER="${SUDO_USER:-$USER}"
REPOUSER="${REPOUSER:-LIBREUSER}"
if [[ -z "$LIBREHOME" ]]; then
- if [[ $LIBREUSER == "$USER" ]]; then
- LIBREHOME=$HOME
- else
- eval "LIBREHOME=~$LIBREUSER"
- fi
+ eval "LIBREHOME=~$LIBREUSER"
fi
if [[ -z ${XDG_CONFIG_HOME:-} ]]; then
export XDG_CONFIG_HOME="${LIBREHOME}/.config"
@@ -55,8 +52,10 @@ fi
if [[ -z ${XDG_CACHE_HOME:-} ]]; then
export XDG_CACHE_HOME="${LIBREHOME}/.cache"
fi
+readonly LIBREUSER REPOUSER LIBREHOME
-# Low-level generic functions ##################################################
+
+## Low-level generic functions ##
# Usage: list_files $slug
# Lists the configuration files to be considered for $slug.
@@ -120,7 +119,8 @@ list_envvars() {
esac
}
-# High-level generic functions #################################################
+
+## High-level generic functions ##
# Usage: load_conf {$slug.conf|$abspath} [VAR1 VAR2...]
#
@@ -202,7 +202,8 @@ set_var() {
return 1 # $EXIT_FAILURE
}
-# PKGBUILD (not configuration, per se) #########################################
+
+## PKGBUILD (not configuration, per se) ##
unset_PKGBUILD() {
# This routine is based primarily off of the PKGBUILD(5) man-page,