sync client: Fixed logging
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user