First Version of upgrade

This commit is contained in:
2026-04-25 11:05:47 +02:00
parent 06f28d1064
commit 39e181def7
2 changed files with 42 additions and 4 deletions
+9 -3
View File
@@ -6,8 +6,13 @@ export TLDOMAIN=domain.tld
export DOMAIN=clients.${TLDOMAIN}
export SERVERFQDN_IPA=ipa.${TLDOMAIN} # Needs to be the IPA- Server
export SERVERFQDN_NC=nextcloud.${TLDOMAIN}
export SYSCONFIGPATH="/opt/sys_config"
export INSTALLDOCS="https://gitea.dtext.online/obel1x/fedora-OEMDRV/src/branch/main/README.md"
#If the UPGRADEURL and branch is set, this script collection will do automatic upgrades
export UPGRADEURL="https://gitea.dtext.online/obel1x/fedora-OEMDRV.git"
export UPGRADEBRANCH="main"
#Group, that will have sudo rights on the client
export CLIENTADMINGROUP="clientadmins"
# Method to determine Unique Hostname / FQDN of the Client. May be replaced by your needs
@@ -19,6 +24,7 @@ fi
export FQDN=${HOSTNM}.${DOMAIN}
#Configuration Files - maybe syned with your companyies settings
export SYSCONFIGPATH="/opt/sys_config"
export DISTCONFIGPATH="/opt/sys_config/config"
export DISTCONFIGPATH_SRC="/Shared/sw_geteilt/client_settings"
@@ -87,6 +93,6 @@ export FIRSTRUN_SERVICENAME="setup-system.service"
export FIRSTRUN_SCRIPTPATH="/usr/lib/systemd/system"
# temp and log files
TEMPDIR="${HOME}/temp/system_setup"
LOGFILE="${TEMPDIR}/${SCRIPTNAME}.log"
export TEMPDIR="${HOME}/temp/system_setup"
export LOGFILE="${TEMPDIR}/${SCRIPTNAME}.log"
mkdir -p ${TEMPDIR}
+33 -1
View File
@@ -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