From 8a71cd066b756ef1f7a10f0a41b6783ec6fe73b3 Mon Sep 17 00:00:00 2001 From: bill-auger Date: Fri, 14 Aug 2020 12:06:45 -0400 Subject: allow local login to differ from hackers.git login --- src/lib/conf.sh.in | 29 +++++++++++++++++++++++++---- src/libretools.conf | 2 +- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/lib/conf.sh.in b/src/lib/conf.sh.in index 603a28c..46366d0 100644 --- a/src/lib/conf.sh.in +++ b/src/lib/conf.sh.in @@ -18,14 +18,35 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . + +## configuration begin ## + +# NOTE: $LIBREUSER is $SUDO_USER unless UID->0, or $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 +# NOTE: $WORKDIR and $LIBREHOME/.cache must be writable by $LIBREUSER +LIBREHOME= + +## configuration end ## + + if [[ "$(id -u "${SUDO_USER:-root}")" == 0 ]]; then unset SUDO_USER fi LIBREUSER="${SUDO_USER:-$USER}" -if [[ $LIBREUSER == "$USER" ]]; then - LIBREHOME=$HOME -else - eval "LIBREHOME=~$LIBREUSER" +REPOUSER="${REPOUSER:-LIBREUSER}" +if [[ -z "$LIBREHOME" ]]; then + if [[ $LIBREUSER == "$USER" ]]; then + LIBREHOME=$HOME + else + eval "LIBREHOME=~$LIBREUSER" + fi fi if [[ -z ${XDG_CONFIG_HOME:-} ]]; then export XDG_CONFIG_HOME="${LIBREHOME}/.config" diff --git a/src/libretools.conf b/src/libretools.conf index cacd0c9..7b3cd29 100644 --- a/src/libretools.conf +++ b/src/libretools.conf @@ -26,7 +26,7 @@ ABSLIBRESEND=ssh://git@git.parabola.nu:1863/~git/abslibre/abslibre.git ################################################################################ ## Where to upload packages to -REPODEST=ssh://$LIBREUSER@repo.parabola.nu:1863/~/staging/ +REPODEST=ssh://$REPOUSER@repo.parabola.nu:1863/~/staging/ ## Which config file to use with db-update (on the $REPODEST server) DBSCRIPTS_CONFIG=/etc/dbscripts/config.local.parabola -- cgit v1.2.2