forked from obel1x/fedora-OEMDRV
Changes:
- use sudo for software installation in logon script - logon script desktop-entry - new log functions in include - renamed include file - mozilla starter with profilename option - added kdevelop profilename
This commit is contained in:
@@ -2,17 +2,35 @@
|
||||
# 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
|
||||
source ./setup_system.inc.sh
|
||||
|
||||
echo "User Logon Script"
|
||||
echo "=================="
|
||||
echo ""
|
||||
elog_init "User Logon Script"
|
||||
elog_add "=================="
|
||||
elog_add ""
|
||||
elog_add `date`
|
||||
elog_add "Logging to File ${LOGFILE}"
|
||||
|
||||
#Check and copy Autostart-Entry
|
||||
#TODO: Check if Desktop is KDE/Plasma and support other Displays
|
||||
if [ ! -f "${HOME}/.config/autostart/Logon_Script.desktop" ]; then
|
||||
cp "${SCRIPTPATH}/Logon_Script.desktop" "${HOME}/.config/autostart"
|
||||
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
|
||||
@@ -22,31 +40,39 @@ else
|
||||
./mount_nocrypt_home.sh
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Some Error when mounting private Directory, cannot continue. Your Data will not be available."
|
||||
echo "If you want to redo this script here, execute ${SCRIPTPATH}/${SCRIPTNAME}"
|
||||
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
|
||||
echo "Successfully obtained Token for User "${DAVTOKEN_USER}
|
||||
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
|
||||
./sync_client_software.sh
|
||||
if [ -f "${CLIENT_SOFTWARE_DST}/install.sh" ]; then
|
||||
/bin/sh "${CLIENT_SOFTWARE_DST}/install.sh"
|
||||
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
|
||||
|
||||
#Last, remove unused Flatpak- Runtimes and unused Data
|
||||
echo "Removing unused Flatpak- Data."
|
||||
flatpak uninstall --unused -y
|
||||
flatpak uninstall --delete-data -y
|
||||
echo "Sucessfully run logon script (Wait 5 seconds)"
|
||||
sleep 5
|
||||
elog_add "Sucessfully run logon script (Wait 3 seconds)"
|
||||
sleep 3
|
||||
|
||||
#read -n 1 -s -r -p "Press any key to continue"
|
||||
#echo ""
|
||||
|
||||
Reference in New Issue
Block a user