Upgrade Feature #8

Merged
obel1x merged 4 commits from :main into main 2026-04-25 11:45:07 +02:00
5 changed files with 48 additions and 8 deletions
+3
View File
@@ -2,5 +2,8 @@
config/setup_system.conf config/setup_system.conf
config/setup_system.conf.bak config/setup_system.conf.bak
config/skel.tar.zst config/skel.tar.zst
config/.sync_*.db
client_software/.sync_*.db
client_software/setup_system.conf
*.kdev4 *.kdev4
.kdev4/* .kdev4/*
-2
View File
@@ -1,2 +0,0 @@
.sync_*.db
setup_system.conf
+10 -4
View File
@@ -6,8 +6,13 @@ export TLDOMAIN=domain.tld
export DOMAIN=clients.${TLDOMAIN} export DOMAIN=clients.${TLDOMAIN}
export SERVERFQDN_IPA=ipa.${TLDOMAIN} # Needs to be the IPA- Server export SERVERFQDN_IPA=ipa.${TLDOMAIN} # Needs to be the IPA- Server
export SERVERFQDN_NC=nextcloud.${TLDOMAIN} export SERVERFQDN_NC=nextcloud.${TLDOMAIN}
export SYSCONFIGPATH="/opt/sys_config"
export INSTALLDOCS="https://gitea.dtext.online/obel1x/fedora-OEMDRV/src/branch/main/README.md" 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" export CLIENTADMINGROUP="clientadmins"
# Method to determine Unique Hostname / FQDN of the Client. May be replaced by your needs # Method to determine Unique Hostname / FQDN of the Client. May be replaced by your needs
@@ -18,7 +23,8 @@ else
fi fi
export FQDN=${HOSTNM}.${DOMAIN} export FQDN=${HOSTNM}.${DOMAIN}
#Configuration Files - maybe syned with your companyies settings #Configuration Files - maybe syned with your companies settings
export SYSCONFIGPATH="/opt/sys_config"
export DISTCONFIGPATH="/opt/sys_config/config" export DISTCONFIGPATH="/opt/sys_config/config"
export DISTCONFIGPATH_SRC="/Shared/sw_geteilt/client_settings" 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" export FIRSTRUN_SCRIPTPATH="/usr/lib/systemd/system"
# temp and log files # temp and log files
TEMPDIR="${HOME}/temp/system_setup" export TEMPDIR="${HOME}/temp/system_setup"
LOGFILE="${TEMPDIR}/${SCRIPTNAME}.log" export LOGFILE="${TEMPDIR}/${SCRIPTNAME}.log"
mkdir -p ${TEMPDIR} mkdir -p ${TEMPDIR}
+2 -1
View File
@@ -38,6 +38,7 @@ mount -L OEMDRV /mnt/anaconda_pre
libva-utils libva-utils
libavcodec-freeworld libavcodec-freeworld
mesa-va-drivers-freeworld mesa-va-drivers-freeworld
ffmpeg
@vlc @vlc
python-vlc python-vlc
#@development-tools #@development-tools
@@ -66,7 +67,7 @@ ktorrent
cadaver cadaver
kdevelop kdevelop
git git
ffmpeg diffuse
remmina remmina
android-tools android-tools
-kpat -kpat
+33 -1
View File
@@ -22,18 +22,45 @@ fi
echo "Update or install Nextcloud client" 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 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." /usr/bin/flatpak install -y --or-update --noninteractive flathub com.nextcloud.desktopclient.nextcloud && echo "Done Update/Install of Nextcloud."
echo ""
#Sync remote Files #Sync remote Files
chown root:${CLIENTADMINGROUP} -R ${SYSCONFIGPATH} chown root:${CLIENTADMINGROUP} -R ${SYSCONFIGPATH}
chmod ug+rwX,o=rX -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 # At first, sync central configs if they are configured to be synced
if [[ ! -z "${DISTCONFIGPATH_SRC}" ]]; then if [[ ! -z "${DISTCONFIGPATH_SRC}" ]]; then
echo "===================="
echo "Synced config path was found, doing remote sync." 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="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***}" ) SYNCCMD_HIDDENPW=$( echo "${SYNCCMD/${DAVTOKEN_PASS}/***HIDDEN***}" )
echo "Exec: ${SYNCCMD_HIDDENPW}" echo "Exec: ${SYNCCMD_HIDDENPW}"
echo "Sync Configuration" echo "Sync Configuration"
echo "===================="
echo "" echo ""
${SYNCCMD} >${TEMPDIR}/synccmd_last.log 2>&1 ${SYNCCMD} >${TEMPDIR}/synccmd_last.log 2>&1
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
@@ -47,8 +74,10 @@ if [[ ! -z "${DISTCONFIGPATH_SRC}" ]]; then
exit 1 exit 1
fi fi
echo "Sucessfully synced." echo "Sucessfully synced."
echo ""
fi fi
#Check if Repository is defined #Check if Repository is defined
echo "===================="
if [ "${CLIENT_SOFTWARE_DST}." == "." ]; then if [ "${CLIENT_SOFTWARE_DST}." == "." ]; then
echo "No central softwarerepository defined (CLIENT_SOFTWARE_DST). Skipping sync." echo "No central softwarerepository defined (CLIENT_SOFTWARE_DST). Skipping sync."
else else
@@ -76,6 +105,8 @@ else
fi fi
echo "Sucessfully synced." echo "Sucessfully synced."
fi 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!) # 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} chown root:${CLIENTADMINGROUP} -R ${SYSCONFIGPATH}
chmod ug+rwX,o=rX -R ${SYSCONFIGPATH} chmod ug+rwX,o=rX -R ${SYSCONFIGPATH}
@@ -90,4 +121,5 @@ else
exit 1 exit 1
fi fi
fi fi
echo ""
fi fi