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
+13 -3
View File
@@ -14,11 +14,11 @@
# fi
# return 0
#}
if [ ! -f $(pwd)/setup_system.conf ]; then
if [ ! -f $(dirname "$0")/setup_system.conf ]; then
echo "System configuration not found. Please make a copy of setup_system.conf.dist, name it setup_system.conf and check the settings in it before running."
exit 1
echo "Press any key to continue" && read -n 1 -s -r && exit 1
fi
source $(pwd)/setup_system.conf
source $(dirname "$0")/setup_system.conf
#Check if the Data- Directory is encrypted
check_data_isecrypted() {
@@ -32,11 +32,21 @@ check_data_isecrypted() {
# Functions for logging
elog_init() {
#Create a new logfile and put some text in it
echo $@ | tee ${LOGFILE}
}
elog_add() {
#Append some text to the logile
echo $@ | tee ${LOGFILE} -a
}
elog_add_command() {
#Run a command, capture all output (STD and ERR) to the logfile AND in variable RETTXT AND output to screen
#Returns the exit value of the command in $? and in RETNO
RETTXT=$( { $@ > >(tee -a ${LOGFILE}); } 2> >(tee -a ${LOGFILE}) )
RETNO=$?
echo "${RETTXT}"
return ${RETNO}
}
# Will set variable DAVTOKEN_USER and DAVTOKEN_PASS to the stored value or get a new one
get_nc_token() {