Fixed Errorlogging and kill firefox after token.

This commit is contained in:
Daniel Pätzold
2026-04-23 12:16:32 +02:00
parent e1dd5cc62a
commit 14b35f8bb8
+5 -1
View File
@@ -44,7 +44,7 @@ elog_add_command() {
#Run a command, capture output (STD and ERR) to the logfile AND output to screen #Run a command, capture output (STD and ERR) to the logfile AND output to screen
# WILL NOT SET RETTXT to make Output directly to screen # WILL NOT SET RETTXT to make Output directly to screen
#Returns the exit value of the command in $? and in RETNO #Returns the exit value of the command in $? and in RETNO
$@ | tee -a ${LOGFILE} $@ 2>&1 | tee -a ${LOGFILE}
RETNO=$? RETNO=$?
return ${RETNO} return ${RETNO}
} }
@@ -78,6 +78,9 @@ get_nc_token() {
fi fi
if [ ! -f ${DAVTOKENFILENAME} ]; then if [ ! -f ${DAVTOKENFILENAME} ]; then
echo "No token found here. Getting a new WEBDAV Token for this Device."
echo "Please logon to your Nextcloud instance via SSO/kerberos"
# Directory is ok, but no Tokenfile was found, need to generate a new one # Directory is ok, but no Tokenfile was found, need to generate a new one
REQJSON=$( curl -s -A "WEBDAV:${HOSTNM}" -X POST "https://${SERVERFQDN_NC}/index.php/login/v2" ) REQJSON=$( curl -s -A "WEBDAV:${HOSTNM}" -X POST "https://${SERVERFQDN_NC}/index.php/login/v2" )
# echo "JSON is:" # echo "JSON is:"
@@ -96,6 +99,7 @@ get_nc_token() {
if [[ "${POLLJSON}" == *"appPassword"* ]]; then if [[ "${POLLJSON}" == *"appPassword"* ]]; then
echo "${POLLJSON}" > ${DAVTOKENFILENAME} echo "${POLLJSON}" > ${DAVTOKENFILENAME}
echo "found token. Token has been written to ${DAVTOKENFILENAME}" echo "found token. Token has been written to ${DAVTOKENFILENAME}"
pkill firefox
break break
else else
echo "failed" echo "failed"