Introduce client_software_cust

For customer setups, the software repository was split into client_software and client_software_cust.

Obsoleted sync for client_software.
This commit is contained in:
Daniel unbrot Pätzold
2026-05-08 12:10:19 +02:00
parent 84527d6384
commit a237f58813
5 changed files with 125 additions and 33 deletions
+6 -4
View File
@@ -1,12 +1,14 @@
.Trash*
*.kdev4
.kdev4/*
client_software/.sync_*.db
client_software/setup_system.conf
ks_pc_prof/*
ks.cfg
config/*
!config/README.md
config.d/*.conf
config.d/*.sys
config.d/*.bak
ks_pc_prof/*
ks.cfg
client_software/.sync_*.db
client_software/setup_system.conf
client_software_cust/*
!client_software_cust/README.md
+14
View File
@@ -0,0 +1,14 @@
# Companys Software Repository
This Repository contains the software of you company, which is delivered by your company admins.
All files here despite this README ar not traked by git and are not part of installation packages.
Your Company is completely free to add files to it.
Your Company is encouraged to setup its own git repository
The scripts will be run at logon time after the scripts of the predefined software has been installed.
Each package is in one directory and may include two scripts which will be called from user logon script:
- install.sh - will be called with root- privileges to install software or other administrative tasks
- user_run.sh - will get executed after all admins scripts had been executed in user context to setup user configs ad data
The execution will be sorted by directory name.
@@ -31,8 +31,13 @@ fi
export FQDN=${HOSTNM}.${DOMAIN}
#Additional Client-Software- Repository-Folder in Nextcloud (Shared Folder / Systemwide)
export CLIENT_SOFTWARE_DST="/opt/sys_config/client_software" # Optional. If you don't have a Folder that should always be synced, leave this empty
export CLIENT_SOFTWARE_SRC="/Shared/sw_geteilt/client_software" Set to the Nextcloud directory where the software should come from
export CLIENT_SOFTWARE_CUST_DST="${SYSCONFIGPATH}/client_software_cust" # Required. Must not be changed!
export CLIENT_SOFTWARE_CUST_SRC="/Shared/sw_geteilt/client_software_cust" # Set to the Nextcloud directory where the software should come from
# OBSOLETE / OLD Variables for packaged files under client_software. Those files will not be synced to NC any more!
# if still set, they will cause sync to complain about it
unset CLIENT_SOFTWARE_DST
unset CLIENT_SOFTWARE_SRC
#Secure File Encryption
#Needs a running KRA- Service on FreeIPA
+39 -4
View File
@@ -79,6 +79,17 @@ elog_add "Update and install client software"
#Set global to enable git
git config --global --add safe.directory /opt/sys_config
# Pre check for old configuration parameters, will be removed in the future
if [ ! -z "${CLIENT_SOFTWARE_DST}" ] || [ ! -z "${CLIENT_SOFTWARE_SRC}" ]; then
elog_add " ===================="
elog_add "WARNING: Your company/setup has still CLIENT_SOFTWARE_DST or CLIENT_SOFTWARE_SRC set."
elog_add "These parameters are obsolete and must be removed! The new parameters are CLIENT_SOFTWARE_CUST_DST and CLIENT_SOFTWARE_CUST_SRC"
elog_add "as the software repository has been split into customer software and distributed software."
elog_add "Please try to relog first. If this problem reoccures, contact your system admins to correct it."
elog_add "Will continue with the new path. Press any key to continue."
read -n 1 -s -r
fi
# First, check the sudo rule
elog_add "Check the matching client rule:"
#Somewhat strange "sudo -l" will *sometimes* ask for password instead of just checking if the rule can be found, so it needs -n to be silent
@@ -117,8 +128,6 @@ else
elog_add ""
elog_add "Running client software sync..."
elog_add_command "/usr/bin/sudo -n --preserve-env ${SYSCONFIGPATH}/system_setup/sync_client_software.sh install $1"
#ERRTXT=$( { /usr/bin/sudo -n --preserve-env ${SYSCONFIGPATH}/system_setup/sync_client_software.sh install > >(tee -a ${LOGFILE}); } 2>&1 )
#ERR=$?
if [[ $RETNO -ne 0 ]]; then
elog_add "Errorcode was $RETNO"
elog_add "Error executing software sync and install, please check your output!"
@@ -131,7 +140,8 @@ fi
#elog_add_command "${CLIENT_SOFTWARE_DST}/user_run.sh $1"
elog_add "Running all software scripts in user- context."
#1. Run the scripts, that are delivered by the package maintainers
for DIR in $(ls -d ${CLIENT_SOFTWARE_DST}/*/ | sort); # list directories in the form "/tmp/dirname/"
elog_add "Pre Installed scripts"
for DIR in $(ls -d ${SYSCONFIGPATH}/client_software/*/ | sort); # list directories in the form "/tmp/dirname/"
do
DIR=${DIR%*/} # remove the trailing "/"
if [[ "$1." != "." ]] && [[ "${DIR}" != *"$1"* ]]; then
@@ -148,12 +158,37 @@ do
elog_add "Some Error in script, will not continue. Please check."
elog_add "Press any key to continue."
read -n 1 -s -r
cd ${SCRIPTPATH}
exit 1
fi
elog_add " ===================="
fi
done
#2. Run the scripts, that are delivered by the package maintainers
if [ -d "${CLIENT_SOFTWARE_CUST_DST}" ]; then
elog_add "Company delivered scripts in ${CLIENT_SOFTWARE_CUST_DST}"
for DIR in $(ls -d ${CLIENT_SOFTWARE_CUST_DST}/*/ | sort); # list directories in the form "/tmp/dirname/"
do
DIR=${DIR%*/} # remove the trailing "/"
if [[ "$1." != "." ]] && [[ "${DIR}" != *"$1"* ]]; then
#search for string in dir
elog_add "Skipping ${DIR} while not in search parameter ( $1 )."
continue
fi
if [ -f "${DIR}/user_run.sh" ]; then
elog_add " >>> Running ${DIR}/user_run.sh"
cd ${DIR}
elog_add_command "${DIR}/user_run.sh"
if [ $? -ne 0 ]; then
elog_add " ===================="
elog_add "Some Error in script, will not continue. Please check."
elog_add "Press any key to continue."
read -n 1 -s -r
exit 1
fi
elog_add " ===================="
fi
done
fi
elog_add "Completed user scripts in software."
elog_add ""
+56 -20
View File
@@ -130,16 +130,51 @@ if [[ ! -z "${DISTCONFIGPATH_SRC}" ]]; then
fi
fi
#Check if Repository is defined
if [ "${CLIENT_SOFTWARE_DST}." == "." ]; then
echo "No central softwarerepository defined (CLIENT_SOFTWARE_DST). Skipping sync."
echo "Running all software scripts in admin- context."
# Run pre installed scripts in client_software
echo "Running pre installed scripts first."
for DIR in $(ls -d ${SYSCONFIGPATH}/client_software/*/ | sort); do
DIR=${DIR%*/} # remove the trailing "/"
if [[ "$1." != "." ]] && [[ "${DIR}" != *"$1"* ]]; then
#search for string in dir
echo "Skipping ${DIR} while not in search parameter ( $1 )."
continue
fi
if [ -f "${DIR}/install.sh" ]; then
echo " ===================="
echo " >>> Running ${DIR}/install.sh"
cd ${DIR}
${DIR}/install.sh
if [ $? -ne 0 ]; then
echo " ===================="
echo "Some Error in script, will not continue. Please check."
echo "Press any key to continue."
read -n 1 -s -r
exit 1
fi
echo " ===================="
fi
done
echo "Sucessfully installed pre-defined software."
echo
# Repository must be the right path (but maybe empty, which is fine)
if [ "${CLIENT_SOFTWARE_CUST_DST}" != "${SYSCONFIGPATH}/client_software_cust" ]; then
echo "Error in config: Required parameter CLIENT_SOFTWARE_CUST_DST is missing or set wrong."
echo "Please relog and if the problem reoccures, contact your system admins to correct the Values."
read -n 1 -s -r -p "Press any key to continue"
echo ""
exit 1
else
# Then, sync all client_software-files
if [[ ! -z "${CLIENT_SOFTWARE_SRC}" ]]; then
echo "Syncing central softwarerepository ${CLIENT_SOFTWARE_DST}"
if [[ -z "${CLIENT_SOFTWARE_CUST_SRC}" ]]; then
echo "No customer software sync is defined, skipping sync"
echo "${CLIENT_SOFTWARE_CUST_DST} with ${CLIENT_SOFTWARE_CUST_SRC}"
else
echo "Syncing customer software repository ${CLIENT_SOFTWARE_CUST_DST}"
# Create Directory if not existent
mkdir -p ${CLIENT_SOFTWARE_DST}
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 ${CLIENT_SOFTWARE_SRC} ${CLIENT_SOFTWARE_DST} https://${SERVERFQDN_NC}"
mkdir -p ${CLIENT_SOFTWARE_CUST_DST}
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 ${CLIENT_SOFTWARE_CUST_SRC} ${CLIENT_SOFTWARE_CUST_DST} https://${SERVERFQDN_NC}"
SYNCCMD_HIDDENPW=$( echo "${SYNCCMD/${DAVTOKEN_PASS}/***HIDDEN***}" )
echo "Exec: ${SYNCCMD_HIDDENPW}"
echo "Sync Client Software"
@@ -155,19 +190,20 @@ else
exit 1
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}
#Make all install.sh executable
find ${CLIENT_SOFTWARE_DST} -type f -name install.sh -exec chmod ugo+x {} \;
fi
fi
echo
#Run Software setup
#Run customer setup
if [ ! -z "${CLIENT_SOFTWARE_CUST_DST}" ]; then
echo "Running all software scripts in admin- context."
for DIR in $(ls -d ${CLIENT_SOFTWARE_DST}/*/ | sort); # list directories in the form "/tmp/dirname/"
do
#Make all install.sh executable
find ${CLIENT_SOFTWARE_CUST_DST} -type f -name install.sh -exec chmod ugo+x {} \;
for DIR in $(ls -d ${CLIENT_SOFTWARE_CUST_DST}/*/ | sort); do
DIR=${DIR%*/} # remove the trailing "/"
if [[ "$1." != "." ]] && [[ "${DIR}" != *"$1"* ]]; then
#search for string in dir
@@ -189,12 +225,12 @@ else
echo " ===================="
fi
done
#Last, remove unused Flatpak- Runtimes and unused Data
echo "Removing unused Flatpak- Data."
flatpak uninstall --unused -y
echo "Sucessfully installed software."
fi
#Last, remove unused Flatpak- Runtimes and unused Data
echo "Removing unused Flatpak- Data."
flatpak uninstall --unused -y
echo "Sucessfully installed software."
echo ""
exit 0