From 9a4f113961ecc1b3e6fcfc76b2c187868ed8c141 Mon Sep 17 00:00:00 2001 From: Recolic <git@me.recolic.net> Date: Thu, 20 Mar 2025 01:09:35 -0700 Subject: [PATCH] . --- examples/archlinux-gnome/conf.d/basic.sh | 1 + linuxconf | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/archlinux-gnome/conf.d/basic.sh b/examples/archlinux-gnome/conf.d/basic.sh index 9342b56..63bed4d 100644 --- a/examples/archlinux-gnome/conf.d/basic.sh +++ b/examples/archlinux-gnome/conf.d/basic.sh @@ -29,6 +29,7 @@ lc_init () { echo 'rtest ALL=(ALL) NOPASSWD: ALL' | EDITOR='tee -a' visudo usermod --password $(echo testpass | openssl passwd -1 -stdin) rtest + sudo -u rtest realpath masterconf.sh || ! echo "ERROR: rtest do not have access to config dir." || exit 1 sudo -u rtest linuxconf register masterconf.sh # more customization... diff --git a/linuxconf b/linuxconf index 40af03a..11ac744 100755 --- a/linuxconf +++ b/linuxconf @@ -25,14 +25,14 @@ function lc_include () { # print the return code of the eval-ed function to stderr, but this function should always return success. for script in "$@"; do - [[ -f "$script" ]] || err "ERROR: DEBUG: script not exist >>$script<<" || continue echo2 "$script -- $LCI_SUBSHELL_OP started as $(whoami), at $(pwd)" ( source "$script" - declare -F "$LCI_SUBSHELL_OP" >/dev/null 2>&1 || exit 0 + declare -F "$LCI_SUBSHELL_OP" >/dev/null 2>&1 || exit 0 eval "$LCI_SUBSHELL_OP" ) - echo2 "$script -- $LCI_SUBSHELL_OP completed with status $return_code" + echo2 "$script -- $LCI_SUBSHELL_OP completed with status $?" + # TODO: should I abort on failure? But for nested lc_include, I cannot know if it failed. done return 0 -- GitLab