Relocate dist files, fix path references, and misc script improvements
- Move setup_system.conf.dist to system_setup/config.dist/ and skel.tar.zst.dist + pack_skel.sh to system_setup/skel/; config/ now holds only gitignored local files - Fix configure.sh CONF_DIST path (was pointing at non-existent config/setup_system.conf.dist) - Fix skel/pack_skel.sh: remove vestigial source line whose path was wrong in both old and new location - Update error messages in setup_system.inc.sh and sync_client_software.sh to reference new dist file location - Move machine_uuid reading/writing into setup_system.inc.sh so all scripts have MACHINEID available; setup_system.conf.dist now uses MACHINEID conditionally with a hostname fallback - sync_client_software.sh: fix && / typo (should be && \) that broke the flatpak remote-add → install chain; add network error handling after flatpak install; cleanup upgrade logic and chown placement - Update CLAUDE.md and install.md to reflect new dist file locations Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
# Include for System Settings
|
||||
# SPDX-FileCopyrightText: Daniel Pätzold
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#
|
||||
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 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"
|
||||
|
||||
#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"
|
||||
|
||||
#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
|
||||
# MACHINEID should be set by install.sh. The Determination is done by setup_system.inc.sh as root for old installs.
|
||||
if [ -z ${MACHINEID} ]; then
|
||||
#Fallback if not configured, should only be needed once for very old installations
|
||||
export HOSTNM=$( hostname -s )
|
||||
else
|
||||
export HOSTNM="pc-${MACHINEID}"
|
||||
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
|
||||
|
||||
#Secure File Encryption
|
||||
#Needs a running KRA- Service on FreeIPA
|
||||
# Set to "true" to use Encryption via IPAVAULT - OTHERWISE YOUR FILES WILL NOT BE ENCRYPTED
|
||||
export IPAVAULTUSE="true"
|
||||
# Vaultname - can be any Name
|
||||
export IPAVAULTNAME="CLIENT_FILEENCRYPTION_"${HOSTNM}
|
||||
|
||||
#Following settings are only available when run in Userspace
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
#This is the Path, that will be mapped from encryptet filesystem at logon - only available for users, not for root
|
||||
export DECRYPTEDDATADIR="${HOME}/data" # Decrypted Dir to work for the User
|
||||
export ENCRYPTEDDATADIR="${HOME}/.data" # Contains the encrypted Data
|
||||
|
||||
#Important Files
|
||||
export DAVTOKENFILENAME="${DECRYPTEDDATADIR}/WEBDAVTOKEN"
|
||||
|
||||
#Optional: Sync Folders with nextcloud client
|
||||
CLIENT_DATA_SYNC=() # Do not remove
|
||||
|
||||
# If you dont want to use Folder synchronisation: comment out each line starting with CLIENT_DATA_SYNC_LINE= or CLIENT_DATA_SYNC+=
|
||||
#First Sync Folder
|
||||
CLIENT_DATA_SYNC_LINE=("${DECRYPTEDDATADIR}/Dokumente" "/Documents")
|
||||
CLIENT_DATA_SYNC+=("$(declare -p CLIENT_DATA_SYNC_LINE)") # Repeat for each CLIENT_DATA_SYNC_LINE
|
||||
|
||||
#Next Sync Folder
|
||||
CLIENT_DATA_SYNC_LINE=("${DECRYPTEDDATADIR}/Bilder" "/Photos")
|
||||
CLIENT_DATA_SYNC+=("$(declare -p CLIENT_DATA_SYNC_LINE)") # Repeat for each CLIENT_DATA_SYNC_LINE
|
||||
|
||||
#Next Sync Folder
|
||||
#...
|
||||
|
||||
export CLIENT_DATA_SYNC_DECLARE="$(declare -p CLIENT_DATA_SYNC)" # Do not remove
|
||||
#End of Sync Folder for nextcloud client
|
||||
|
||||
#Firefox Profiles of the User
|
||||
export PROFILE_FIREFOX_RESET_LOCAL="true" # Set this to wipe ~/.mozilla each time if you don't want users to setup their own firefox profile
|
||||
export PROFILE_FIREFOX_SRC="mozilla_profiles/firefox"
|
||||
export PROFILE_FIREFOX_DST="${DECRYPTEDDATADIR}/firefox"
|
||||
|
||||
#Thunderbird Profiles
|
||||
export PROFILE_TB_SRC="mozilla_profiles/thunderbird"
|
||||
export PROFILE_TB_DST="${DECRYPTEDDATADIR}/thunderbird"
|
||||
|
||||
# Mail account auto-provisioning for DAVTOKEN_USER@TLDOMAIN in Thunderbird
|
||||
export SERVERFQDN_IMAP="imap.${TLDOMAIN}" # IMAP server hostname (e.g. imap.strato.de)
|
||||
fi
|
||||
|
||||
#Basic commons not needing change
|
||||
export CDATEC8=$(date '+%Y%m%d') # Date 8 Characters long: YYYYMMDD
|
||||
export CTIMEC6=$(date '+%H%M%S') # Time 6 Chars: HHMMSS
|
||||
|
||||
#Basic runtime-Vars
|
||||
export EXECDIR=$(pwd)
|
||||
export SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
if [ ${SCRIPTPATH::2} == "//" ]; then
|
||||
export SCRIPTPATH=${SCRIPTPATH:1}
|
||||
fi
|
||||
export SCRIPTNAME=$(basename "$0")
|
||||
|
||||
#First run Service Name
|
||||
export FIRSTRUN_SERVICENAME="setup-system.service"
|
||||
export FIRSTRUN_SCRIPTPATH="/usr/lib/systemd/system"
|
||||
|
||||
# temp and log files
|
||||
export TEMPDIR="${HOME}/temp/system_setup"
|
||||
export LOGFILE="${TEMPDIR}/${SCRIPTNAME}.log"
|
||||
mkdir -p ${TEMPDIR}
|
||||
@@ -5,7 +5,7 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
CONF_DIST="${SCRIPTDIR}/../config/setup_system.conf.dist"
|
||||
CONF_DIST="${SCRIPTDIR}/config.dist/setup_system.conf.dist"
|
||||
CONF_FILE="${SCRIPTDIR}/../config.d/configure.conf"
|
||||
|
||||
if [[ "$EUID" -eq 0 ]]; then
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
source $(dirname "$0")/setup_system.inc.sh
|
||||
EXECDIR=$(pwd)
|
||||
SRCFILE="${SYSCONFIGPATH}/config/skel.tar.zst"
|
||||
SRCFILEDIST="${SYSCONFIGPATH}/config/skel.tar.zst.dist"
|
||||
SRCFILEDIST="$(dirname "$0")/skel/skel.tar.zst.dist"
|
||||
|
||||
#Check for root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
|
||||
@@ -16,6 +16,19 @@
|
||||
# return 0
|
||||
#}
|
||||
|
||||
#First, get the machine_uuid wich is needed by some userspace programs.
|
||||
#As all Parameters that are bound to CPU or Mainboard, are only readable by root, we need to get the values at installtime.
|
||||
#On old installations without the file, we will write it whenever possible
|
||||
if [ -f $( dirname "$0" )/config.d/machine_uuid.sys ]; then
|
||||
export MACHINEID="$( cat $( dirname "$0" )/config.d/machine_uuid.sys )"
|
||||
elif [ "$EUID" -eq 0 ]; then
|
||||
dmidecode -t system | grep -i 'UUID' \
|
||||
| sed 's/UUID: //' | tr '[:upper:]' '[:lower:]' \
|
||||
| sed 's/[^0-9a-z]*//g' | xargs | tail -c 13 \
|
||||
> "$( dirname "$0" )/config.d/machine_uuid.sys"
|
||||
export MACHINEID="$( cat $( dirname "$0" )/config.d/machine_uuid.sys )"
|
||||
fi
|
||||
|
||||
#Check for configure.conf - used for frist setup of system
|
||||
if [[ -f $(dirname "$0")/../config.d/configure.conf ]]; then
|
||||
echo "System in configure-mode. Will use $(dirname "$0")/../config.d/configure.conf for setup."
|
||||
@@ -23,7 +36,7 @@ if [[ -f $(dirname "$0")/../config.d/configure.conf ]]; then
|
||||
else
|
||||
#Load default system setup file
|
||||
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 copy system_setup/config.dist/setup_system.conf.dist to config/setup_system.conf and adjust the settings before running."
|
||||
echo "Press any key to continue" && read -n 1 -s -r && exit 1
|
||||
fi
|
||||
source $(dirname "$0")/../config/setup_system.conf
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/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
|
||||
mv skel.tar.zst backup_skel.tar.zst
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Old Archive renamed to backup_skel.tar.zst"
|
||||
|
||||
@@ -20,15 +20,20 @@ fi
|
||||
|
||||
#Install or update Nextcloud com.nextcloud.desktopclient.nextcloud
|
||||
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."
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo ""
|
||||
echo "There seems to be a problem with your network connection. Please first check, if your network can be established before reuming."
|
||||
echo "You can press CRTL+C to abort now. Than your data wont be accessible and you need to run \"$0\" again."
|
||||
echo "You can also continue without network. You may need your personal encryptionkey for accessing your data."
|
||||
read -n 1 -s -r -p "Please check Network and press any Key to continue"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
#Sync remote Files
|
||||
#Do an upgrade of the Base package if its configured and if there are changes
|
||||
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 "Checking for Upgrades on ${UPGRADEURL} and Branch ${UPGRADEBRANCH}"
|
||||
REMOTEURL=$( git config --get remote.origin.url )
|
||||
@@ -43,14 +48,17 @@ if [[ ! -z "${UPGRADEURL}" ]]; then
|
||||
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^
|
||||
#Fetch latest Updates and remove all history
|
||||
git fetch origin && git reset --hard origin/${UPGRADEBRANCH} && git rebase HEAD^
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Error: Failure while updating, will continue as is."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
else
|
||||
echo "UPGRADEURL is not specified in conf - No Upgrade option available."
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# At first, sync central configs if they are configured to be synced
|
||||
if [[ ! -z "${DISTCONFIGPATH_SRC}" ]]; then
|
||||
@@ -85,12 +93,13 @@ if [[ ! -z "${DISTCONFIGPATH_SRC}" ]]; then
|
||||
echo "System is in configure-mode and configuration repository was found and synced, but still not configuration was found"
|
||||
echo "checking file $(dirname "$0")/../config/setup_system.conf"
|
||||
echo ""
|
||||
echo "Please make a inital copy of config/setup_system.conf.dist to config/setup_system.conf and check all settings there."
|
||||
echo "Please make a copy of system_setup/config.dist/setup_system.conf.dist to config/setup_system.conf and check all settings there."
|
||||
echo "Then rerun the logon script to sync the file to your repository."
|
||||
echo "Press any key to continue" && read -n 1 -s -r && exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
#Check if Repository is defined
|
||||
if [ "${CLIENT_SOFTWARE_DST}." == "." ]; then
|
||||
echo "No central softwarerepository defined (CLIENT_SOFTWARE_DST). Skipping sync."
|
||||
|
||||
Reference in New Issue
Block a user