sync client: Fixed logging

This commit is contained in:
Daniel Pätzold
2026-04-24 12:42:51 +02:00
parent 15b15b90b0
commit 18382846a3
+17 -19
View File
@@ -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,16 +35,23 @@ 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
#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}"
@@ -64,26 +63,24 @@ 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
echo "Sucessfully synced."
fi
# 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!)
# 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 ug+x {} \;
if [ -f "${CLIENT_SOFTWARE_DST}/install.sh" ]; then
chmod u+x "${CLIENT_SOFTWARE_DST}/install.sh"
fi
echo "Sucessfully synced."
find ${CLIENT_SOFTWARE_DST} -type f -name install.sh -exec chmod ugo+x {} \;
#Run Software setup
echo "Running Setup of Software"
@@ -93,3 +90,4 @@ if [ $1 == "install" ]; then
exit 1
fi
fi
fi