First Version of upgrade
This commit is contained in:
@@ -22,18 +22,45 @@ fi
|
||||
echo "Update or install Nextcloud client"
|
||||
/usr/bin/flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
/usr/bin/flatpak install -y --or-update --noninteractive flathub com.nextcloud.desktopclient.nextcloud && echo "Done Update/Install of Nextcloud."
|
||||
echo ""
|
||||
|
||||
#Sync remote Files
|
||||
chown root:${CLIENTADMINGROUP} -R ${SYSCONFIGPATH}
|
||||
chmod ug+rwX,o=rX -R ${SYSCONFIGPATH}
|
||||
|
||||
#Do an upgrade of the Base package if its configured and if there are changes
|
||||
if [[ ! -z "${UPGRADEURL}" ]]; then
|
||||
echo "===================="
|
||||
echo "Checking for Upgrades on ${UPGRADEURL} and Branch ${UPGRADEBRANCH}"
|
||||
REMOTEURL=$( git config --get remote.origin.url )
|
||||
echo "Remote git URL is ${REMOTEURL}"
|
||||
if [[ "${REMOTEURL}" != "${UPGRADEURL}" ]]; then
|
||||
echo "This Repo is not on the matching URL, so no update is possible. If you want to change this, check out the docs on how to setup from scratch."
|
||||
else
|
||||
GITBRANCH=$( git rev-parse --abbrev-ref HEAD )
|
||||
echo "Current branch is ${GITBRANCH}"
|
||||
if [[ "${GITBRANCH}" != "${UPGRADEBRANCH}" ]]; then
|
||||
echo "This Repo is not on the right branch, so no update is possible."
|
||||
else
|
||||
# Doing upgrade, discarding all local changes frist (is more save than forced pull)
|
||||
echo "Checks have passed, we are now upgrading via git."
|
||||
git fetch origin
|
||||
git reset --hard origin/${UPGRADEBRANCH}
|
||||
#Remove all history
|
||||
git rebase HEAD^
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# At first, sync central configs if they are configured to be synced
|
||||
if [[ ! -z "${DISTCONFIGPATH_SRC}" ]]; then
|
||||
echo "===================="
|
||||
echo "Synced config path was found, doing remote sync."
|
||||
SYNCCMD="sudo -i /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=nextcloudcmd com.nextcloud.desktopclient.nextcloud -h -u ${DAVTOKEN_USER} -p ${DAVTOKEN_PASS} --path ${DISTCONFIGPATH_SRC} ${DISTCONFIGPATH} https://${SERVERFQDN_NC}"
|
||||
SYNCCMD_HIDDENPW=$( echo "${SYNCCMD/${DAVTOKEN_PASS}/***HIDDEN***}" )
|
||||
echo "Exec: ${SYNCCMD_HIDDENPW}"
|
||||
echo "Sync Configuration"
|
||||
echo "===================="
|
||||
echo ""
|
||||
${SYNCCMD} >${TEMPDIR}/synccmd_last.log 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
@@ -47,8 +74,10 @@ if [[ ! -z "${DISTCONFIGPATH_SRC}" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
echo "Sucessfully synced."
|
||||
echo ""
|
||||
fi
|
||||
#Check if Repository is defined
|
||||
echo "===================="
|
||||
if [ "${CLIENT_SOFTWARE_DST}." == "." ]; then
|
||||
echo "No central softwarerepository defined (CLIENT_SOFTWARE_DST). Skipping sync."
|
||||
else
|
||||
@@ -76,6 +105,8 @@ else
|
||||
fi
|
||||
echo "Sucessfully synced."
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# 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}
|
||||
@@ -90,4 +121,5 @@ else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user