From 18382846a3a89bc20246f1f74dff88cfc9ad89c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=C3=A4tzold?= Date: Fri, 24 Apr 2026 12:42:51 +0200 Subject: [PATCH] sync client: Fixed logging --- system_setup/sync_client_software.sh | 54 ++++++++++++++-------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/system_setup/sync_client_software.sh b/system_setup/sync_client_software.sh index d47a1de..bca3782 100755 --- a/system_setup/sync_client_software.sh +++ b/system_setup/sync_client_software.sh @@ -3,8 +3,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # # Central sofwareinstallation script. Should be called from logon-script via sudo and prereserved env -# -source $(dirname "$0")/setup_system.inc.sh #Check for root if [ "$EUID" -ne 0 ]; then @@ -20,12 +18,6 @@ if [ "${DAVTOKEN_USER}." == "." ]; then echo "Press any key to continue" && read -n 1 -s -r && exit 1 fi -#Check if Repository is defined -if [ "${CLIENT_SOFTWARE_DST}." == "." ]; then - echo "No central softwarerepository defined (CLIENT_SOFTWARE_DST). Skipping sync." - exit 0 -fi - #Install or update Nextcloud com.nextcloud.desktopclient.nextcloud echo "Update or install Nextcloud client" /usr/bin/flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo @@ -43,18 +35,25 @@ if [[ ! -z "${DISTCONFIGPATH_SRC}" ]]; then echo "Sync Configuration" echo "====================" echo "" - ${SYNCCMD} >/dev/null | grep 'error\|warning' + ${SYNCCMD} >${TEMPDIR}/synccmd_last.log 2>&1 if [[ $? -ne 0 ]]; then - echo "Error in sync: Check Logfile ${LOGFILE}" + echo "Error in sync:" + echo "" + cat ${TEMPDIR}/synccmd_last.log echo "" echo "Please check if your Token is setup right and for the above Output" read -n 1 -s -r -p "Press any key to continue" echo "" exit 1 fi + echo "Sucessfully synced." fi -# Then, sync all client_software-files -if [[ ! -z "${CLIENT_SOFTWARE_SRC}" ]]; then +#Check if Repository is defined +if [ "${CLIENT_SOFTWARE_DST}." == "." ]; then + echo "No central softwarerepository defined (CLIENT_SOFTWARE_DST). Skipping sync." +else + # Then, sync all client_software-files + if [[ ! -z "${CLIENT_SOFTWARE_SRC}" ]]; then echo "Syncing central softwarerepository ${CLIENT_SOFTWARE_DST}" # Create Directory if not existent mkdir -p ${CLIENT_SOFTWARE_DST} @@ -64,32 +63,31 @@ if [[ ! -z "${CLIENT_SOFTWARE_SRC}" ]]; then echo "Sync Client Software" echo "====================" echo "" - ${SYNCCMD} >/dev/null | grep 'error\|warning' + ${SYNCCMD} >${TEMPDIR}/synccmd_last.log 2>&1 if [[ $? -ne 0 ]]; then - echo "Error in sync: Check Logfile ${LOGFILE}" + echo "Error in sync:" + echo "" + cat ${TEMPDIR}/synccmd_last.log echo "" echo "Please check if your Token is setup right and for the above Output" read -n 1 -s -r -p "Press any key to continue" echo "" exit 1 fi -fi + echo "Sucessfully synced." + fi + # After sync again, restore the rights to all filles. They must be owned by root, changeable by admingroup and readable by otherusers (we are root, so we can change!) + chown root:${CLIENTADMINGROUP} -R ${SYSCONFIGPATH} + chmod ug+rwX,o=rX -R ${SYSCONFIGPATH} + #Make all install.sh executable + find ${CLIENT_SOFTWARE_DST} -type f -name install.sh -exec chmod ugo+x {} \; -# After sync again, restore the right to all filles. They must be owned by root, changeable by admingroup and readable by otherusers (we are root, so we can change!) -chown root:${CLIENTADMINGROUP} -R ${SYSCONFIGPATH} -chmod ug+rwX,o=rX -R ${SYSCONFIGPATH} -#Make all install.sh executable -find ${CLIENT_SOFTWARE_DST} -type f -name install.sh -exec chmod ug+x {} \; -if [ -f "${CLIENT_SOFTWARE_DST}/install.sh" ]; then - chmod u+x "${CLIENT_SOFTWARE_DST}/install.sh" -fi -echo "Sucessfully synced." - -#Run Software setup -echo "Running Setup of Software" -if [ $1 == "install" ]; then + #Run Software setup + echo "Running Setup of Software" + if [ $1 == "install" ]; then ${CLIENT_SOFTWARE_DST}/install.sh $2 if [ $? -ne 0 ]; then exit 1 fi + fi fi