diff --git a/examples/archlinux-gnome/conf.d/basic.sh b/examples/archlinux-gnome/conf.d/basic.sh index 9342b568aae01ec554d069136d7727ac48fe1156..63bed4d1fa8304ccc2f8957dafb9d12ba1cd5043 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 40af03aaad75c6c152f342b74ba5c8e2b740fddc..11ac7448279505577934d0c27b4b16085db96669 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