Moved local dir to /opt/sys_config

Improved error logging and added function handling calls with log and return values
Improved check for matching sudo rule
This commit is contained in:
Daniel Pätzold
2026-03-15 12:44:14 +01:00
parent 445c52fb27
commit 488f04d387
17 changed files with 307 additions and 83 deletions
+5 -5
View File
@@ -9,15 +9,15 @@ source $(dirname "$0")/setup_system.inc.sh
#Check for root
if [ "$EUID" -ne 0 ]; then
echo "Error: Script requires root privileges. It should be executed via logon-script and not standalone."
exit 1
echo "Press any key to continue" && read -n 1 -s -r && exit 1
fi
#Check Token
if [ "${DAVTOKEN_USER}." == "." ]; then
echo "Error: Script cannot be executed standalone and needs a prereserved environement from logon-script."
echo "To get executed without password prompt, use the NOPASSWD rule in sudo. In FreeIPA you can use the sudo-option !authenticate in the sudo rule."
echo "Additionally add the sudo command to the rule: ^\/sys_config\/system_setup\/sync_client_software\.sh.*$"
exit 1
echo "Error: Script cannot be executed standalone, must be run with a matching sudo rule and needs a prereserved environement from logon-script."
elog_add "A matching sudo rule could look like this: "'^'${SYSCONFIGPATH////'\/'}'\/system_setup\/sync_client_software\.sh.*$'
elog_add "Hint: the rule must contain the !authenticate and setenv option to work."
echo "Press any key to continue" && read -n 1 -s -r && exit 1
fi
#Check if Repository is defined