Moved config files to syncable folder

This commit is contained in:
Daniel Pätzold
2026-04-24 11:31:34 +02:00
parent dfbe9ec625
commit cd5bbd464b
8 changed files with 73 additions and 27 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
.Trash* .Trash*
system_setup/setup_system.conf config/setup_system.conf
system_setup/setup_system.conf.bak config/setup_system.conf.bak
system_setup/skel.tar.zst config/skel.tar.zstd
*.kdev4 *.kdev4
.kdev4/* .kdev4/*
@@ -1,4 +1,6 @@
#!/usr/bin/env sh #!/usr/bin/env sh
# Usage: will make a tar-file from folder skel found in the directory where executed
# If you want to change skel- content, extrakt your skel.tar.zstd to this directory, edit the files and use this script to repack
source $(dirname "$0")/setup_system.inc.sh source $(dirname "$0")/setup_system.inc.sh
mv skel.tar.zst backup_skel.tar.zst mv skel.tar.zst backup_skel.tar.zst
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
@@ -18,6 +18,10 @@ else
fi fi
export FQDN=${HOSTNM}.${DOMAIN} export FQDN=${HOSTNM}.${DOMAIN}
#Configuration Files - maybe syned with your companyies settings
export DISTCONFIGPATH="/opt/sys_config/config"
export DISTCONFIGPATH_SRC="/Shared/sw_geteilt/client_settings"
#Additional Client-Software- Repository-Folder in Nextcloud (Shared Folder / Systemwide) #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_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_SRC="/Shared/sw_geteilt/client_software" Set to the Nextcloud directory where the software should come from
Binary file not shown.
+13 -1
View File
@@ -2,7 +2,8 @@
# Replaces /etc/skel with the contents of skel.tar.zst # Replaces /etc/skel with the contents of skel.tar.zst
source $(dirname "$0")/setup_system.inc.sh source $(dirname "$0")/setup_system.inc.sh
EXECDIR=$(pwd) EXECDIR=$(pwd)
SRCFILE="${SYSCONFIGPATH}/system_setup/skel.tar.zst" SRCFILE="${SYSCONFIGPATH}/config/skel.tar.zst"
SRCFILEDIST="${SYSCONFIGPATH}/config/skel.tar.zst.dist"
#Check for root #Check for root
if [ "$EUID" -ne 0 ]; then if [ "$EUID" -ne 0 ]; then
@@ -10,6 +11,16 @@ if [ "$EUID" -ne 0 ]; then
exit 1 exit 1
fi fi
#Check for existing File - if not there, make a copy of the dist-file
if [[ ! -f "${SRCFILE}" ]]; then
echo "No SKEL file was found. Using distributed skel in ${SRCFILEDIST}"
cp "${SRCFILEDIST}" "${SRCFILE}"
if [[ $? -ne 0 ]]; then
echo "Something went wrong, please check Output"
echo "Press any key to continue" && read -n 1 -s -r && exit 1
fi
fi
cd /etc cd /etc
sudo rm -f -r /etc/skel sudo rm -f -r /etc/skel
sudo tar -xf ${SRCFILE} sudo tar -xf ${SRCFILE}
@@ -19,5 +30,6 @@ if [ $? -eq 0 ]; then
sudo setfacl -R -m u::rwX,g::rX,o::rX /etc/skel sudo setfacl -R -m u::rwX,g::rX,o::rX /etc/skel
else else
echo "Something went wrong, please check Output" echo "Something went wrong, please check Output"
echo "Press any key to continue" && read -n 1 -s -r && exit 1
fi fi
cd ${EXECDIR} cd ${EXECDIR}
+2 -2
View File
@@ -15,11 +15,11 @@
# fi # fi
# return 0 # return 0
#} #}
if [ ! -f $(dirname "$0")/setup_system.conf ]; then if [ ! -f $(dirname "$0")/../config/setup_system.conf ]; then
echo "System configuration not found. Please make a copy of setup_system.conf.dist, name it setup_system.conf and check the settings in it before running." echo "System configuration not found. Please make a copy of setup_system.conf.dist, name it setup_system.conf and check the settings in it before running."
echo "Press any key to continue" && read -n 1 -s -r && exit 1 echo "Press any key to continue" && read -n 1 -s -r && exit 1
fi fi
source $(dirname "$0")/setup_system.conf source $(dirname "$0")/../config/setup_system.conf
#Check if the Data- Directory is encrypted #Check if the Data- Directory is encrypted
check_data_isecrypted() { check_data_isecrypted() {
+49 -21
View File
@@ -40,30 +40,57 @@ 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."
#Sync Files #Sync remote Files
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}"
SYNCCMD_HIDDENPW=$( echo "${SYNCCMD/${DAVTOKEN_PASS}/***HIDDEN***}" )
chown root:${CLIENTADMINGROUP} -R ${SYSCONFIGPATH} chown root:${CLIENTADMINGROUP} -R ${SYSCONFIGPATH}
chmod ug+rwX,o=rX -R ${SYSCONFIGPATH} chmod ug+rwX,o=rX -R ${SYSCONFIGPATH}
echo "Exec: ${SYNCCMD_HIDDENPW}" # At first, sync central configs if they are configured to be synced
echo "Sync Client Software" > ${LOGFILE} if [[ ! -z "${DISTCONFIGPATH_SRC}" ]]; then
echo "====================" >> ${LOGFILE} 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}"
date >> ${LOGFILE} SYNCCMD_HIDDENPW=$( echo "${SYNCCMD/${DAVTOKEN_PASS}/***HIDDEN***}" )
echo ${SYNCCMD_HIDDENPW} >> ${LOGFILE} echo "Exec: ${SYNCCMD_HIDDENPW}"
echo "" >> ${LOGFILE} echo "Sync Configuration" > ${LOGFILE}
${SYNCCMD} >> ${LOGFILE} 2>&1 echo "====================" >> ${LOGFILE}
if [[ $? -ne 0 ]]; then date >> ${LOGFILE}
echo "Error in sync:" echo ${SYNCCMD_HIDDENPW} >> ${LOGFILE}
echo "****" echo "" >> ${LOGFILE}
cat ${LOGFILE} ${SYNCCMD} >> ${LOGFILE} 2>&1
echo "****" if [[ $? -ne 0 ]]; then
echo "" echo "Error in sync:"
echo "Please check if your Token is setup right and for the above Output" echo "****"
read -n 1 -s -r -p "Press any key to continue" cat ${LOGFILE}
echo "" echo "****"
exit 1 echo ""
echo "Please check if your Token is setup right and for the above Output"
read -n 1 -s -r -p "Press any key to continue"
echo ""
exit 1
fi
fi fi
#Files must be owned by root (we are root!) # Then, sync all client_software-files
if [[ ! -z "${CLIENT_SOFTWARE_SRC}" ]]; then
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}"
SYNCCMD_HIDDENPW=$( echo "${SYNCCMD/${DAVTOKEN_PASS}/***HIDDEN***}" )
echo "Exec: ${SYNCCMD_HIDDENPW}"
echo "Sync Client Software" > ${LOGFILE}
echo "====================" >> ${LOGFILE}
date >> ${LOGFILE}
echo ${SYNCCMD_HIDDENPW} >> ${LOGFILE}
echo "" >> ${LOGFILE}
${SYNCCMD} >> ${LOGFILE} 2>&1
if [[ $? -ne 0 ]]; then
echo "Error in sync:"
echo "****"
cat ${LOGFILE}
echo "****"
echo ""
echo "Please check if your Token is setup right and for the above Output"
read -n 1 -s -r -p "Press any key to continue"
echo ""
exit 1
fi
fi
# After sync again, restore the right 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}
#Make all install.sh executable #Make all install.sh executable
@@ -72,6 +99,7 @@ if [ -f "${CLIENT_SOFTWARE_DST}/install.sh" ]; then
chmod u+x "${CLIENT_SOFTWARE_DST}/install.sh" chmod u+x "${CLIENT_SOFTWARE_DST}/install.sh"
fi fi
echo "Sucessfully synced." echo "Sucessfully synced."
#Run Software setup #Run Software setup
echo "Running Setup of Software" echo "Running Setup of Software"
if [ $1 == "install" ]; then if [ $1 == "install" ]; then