#!/bin/sh # SPDX-FileCopyrightText: Daniel Pätzold # SPDX-License-Identifier: AGPL-3.0-or-later # # User logon script for KDE Environement # source ./setup_system.conf source ./setup_system.inc.sh elog_init "User Logon Script" elog_add "==================" elog_add "" elog_add `date` elog_add "Logging to File ${LOGFILE}" if [ "$EUID" -eq 0 ]; then elog_add "Error: Cannot run this script as root." exit 1 fi #TODO C: Check if Desktop is KDE/Plasma and support other Displays # Make kdesu use sudo kwriteconfig5 --file kdesurc --group super-user-command --key super-user-command sudo if [ $? -ne 0 ]; then elog_add "This script should be run in KDE- Desktop. The setup of kwriteconfig5 has failed. Please check, if you are using KDE." exit 1 fi #Copy current Version of Autostart-Entry cp "${SCRIPTPATH}/logon_script.sh.desktop" "${HOME}/.config/autostart" if [ $? -ne 0 ]; then elog_add "Failed to setup autostart- entry. Check your installation of these scripts." exit 1 fi # Mount the private Directory if [ ${IPAVAULTUSE} == "true" ]; then ./mount_ecrypt_home.sh else ./mount_nocrypt_home.sh fi if [ $? -ne 0 ]; then elog_add "Some Error when mounting private Directory, cannot continue. Your Data will not be available." elog_add "If you want to redo this script here, execute ${SCRIPTPATH}/${SCRIPTNAME}" read -n 1 -s -r -p "Press any key to continue" exit 1 fi #Get WEBDAV TOKEN from Nextcloud get_nc_token elog_add "Successfully obtained Token for User ${DAVTOKEN_USER}" #SYNC Firefox + Thunderbird Profile ./mozilla_starter.sh firefox sync && ./mozilla_starter.sh thunderbird sync #Install additional Software elog_add "" elog_add "Update and install client Software" # Without sudoers-rule for run without asking for password, it won't run and quit complaining about not askpass utilities found # Hint: To get this working, create a new ipa rule with options "!authenticate" and "setenv" # And also add the following sudo-rule: "^\/sys_config\/system_setup\/sync_client_software\.sh.*$" /usr/bin/sudo -A --preserve-env /sys_config/system_setup/sync_client_software.sh install 2>&1 | tee ${LOGFILE} -a | grep -v askpass INST_RET=$? INST_OUT=$( cat ${LOGFILE} ) if [[ $INST_RET -ne 0 ]]; then if [[ $INST_OUT == *"askpass"* ]]; then elog_add "Not doing Software Updates, as your user is not allowed to execute the script without a password." elog_add "If you want to change this, make a FreeIPA sudoers rule for the script sync_client_software.sh with !authenticate for you and become a member." else elog_add "*** Error executing software sync and install, please check your output! ***" fi fi elog_add "Sucessfully run logon script (Wait 3 seconds)" sleep 3 #read -n 1 -s -r -p "Press any key to continue" #echo "" exit 0