diff --git a/.gitignore b/.gitignore index dcf422f..9c26c10 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,8 @@ config/setup_system.conf config/setup_system.conf.bak config/skel.tar.zst +config/.sync_*.db +client_software/.sync_*.db +client_software/setup_system.conf *.kdev4 .kdev4/* diff --git a/client_software/.gitignore b/client_software/.gitignore deleted file mode 100644 index 5448d26..0000000 --- a/client_software/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.sync_*.db -setup_system.conf diff --git a/config/setup_system.conf.dist b/config/setup_system.conf.dist index 080d6aa..8cc8490 100644 --- a/config/setup_system.conf.dist +++ b/config/setup_system.conf.dist @@ -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 @@ -18,7 +23,8 @@ else fi 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_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} diff --git a/ks.cfg b/ks.cfg index 3b3c364..1006d75 100644 --- a/ks.cfg +++ b/ks.cfg @@ -38,6 +38,7 @@ mount -L OEMDRV /mnt/anaconda_pre libva-utils libavcodec-freeworld mesa-va-drivers-freeworld +ffmpeg @vlc python-vlc #@development-tools @@ -66,7 +67,7 @@ ktorrent cadaver kdevelop git -ffmpeg +diffuse remmina android-tools -kpat diff --git a/system_setup/sync_client_software.sh b/system_setup/sync_client_software.sh index bca3782..8f28c13 100755 --- a/system_setup/sync_client_software.sh +++ b/system_setup/sync_client_software.sh @@ -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