Files
fedora-OEMDRV/system_setup/mozilla_starter.sh
T
Daniel Pätzold 21d1144813 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
2026-02-21 20:50:02 +01:00

108 lines
3.0 KiB
Bash
Executable File

#!/bin/sh
# SPDX-FileCopyrightText: Daniel Pätzold
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# Usage
source ./setup_system.conf
source ./setup_system.inc.sh
#Lokal Vars
LOGFILE="${TEMPDIR}/${SCRIPTNAME}.log"
#Check or get Token
if [ "${DAVTOKEN_USER}." == "." ]; then
get_nc_token
fi
# Use optional Profilename
profilename=${3:-"default"}
#Parametercheck:
if [ "${1}." == "." ]; then
echo "ERROR: Parameter 1 missing."
BREAK_ERROR=1
elif [ ${1} == 'firefox' ]; then
REMOTE_PATH=${PROFILE_FIREFOX_SRC}
PROFILE_PATH=${PROFILE_FIREFOX_DST}
if [ "${2}." == 'run.' ]; then
RUNCMD="/usr/bin/firefox --profile ${PROFILE_FIREFOX_DST}/${profilename}"
elif [ "${2}." == 'sync.' ]; then
RUNCMD=""
else
RUNCMD=""
echo "ERROR: Parameter 2 wrong"
BREAK_ERROR=1
fi
elif [ ${1} == 'thunderbird' ]; then
REMOTE_PATH=${PROFILE_TB_SRC}
PROFILE_PATH=${PROFILE_TB_DST}
if [ "${2}." == 'run.' ]; then
RUNCMD="/usr/bin/thunderbird -profile ${PROFILE_TB_DST}/${profilename}"
elif [ "${2}." == 'sync.' ]; then
RUNCMD=""
else
RUNCMD=""
echo "ERROR: Parameter 2 wrong"
BREAK_ERROR=1
fi
else
echo "Error: First Parameter wrong"
BREAK_ERROR=1
fi
if [[ ${BREAK_ERROR} == 1 ]]; then
echo "Call: ${SCRIPTNAME} [firefox | thunderbird] [run | sync] [ profilename ]"
exit 1
fi
echo "Synchronise profile"
# optional: -s = silentmodus
SYNCCMD="/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=nextcloudcmd com.nextcloud.desktopclient.nextcloud -h -u ${DAVTOKEN_USER} -p ${DAVTOKEN_PASS} --path ${REMOTE_PATH} ${PROFILE_PATH} https://${SERVERFQDN_NC}"
SYNCCMD_HIDDENPW=$( echo "${SYNCCMD/${DAVTOKEN_PASS}/***HIDDEN***}" )
echo "Exec: ${SYNCCMD_HIDDENPW}"
mkdir -p ${TEMPDIR}
echo "Mozilla Starter" > ${LOGFILE}
echo "===============" >> ${LOGFILE}
date >> ${LOGFILE}
echo "Parameters: $@" >> ${LOGFILE}
echo ${SYNCCMD_HIDDENPW} >> ${LOGFILE}
echo "" >> ${LOGFILE}
mkdir -p ${PROFILE_PATH}
${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 Output"
read -n 1 -s -r -p "Press any key to continue"
echo ""
exit 1
fi
#Execute
if [ "${RUNCMD}." != "." ]; then
echo "OK. Starting ${1}..."
echo ${RUNCMD}
${RUNCMD} && echo "${1} ended successfully. Please wait for the Profile to sync."
if [[ $? -ne 0 ]]; then
echo "****"
echo ""
echo "Error running ${1}, not syncing Profile!"
read -n 1 -s -r -p "Press any key to continue"
echo ""
exit 2
fi
sleep 5
${SYNCCMD} >> ${LOGFILE} 2>&1
if [[ $? -ne 0 ]]; then
echo "****"
echo ""
echo "Error syncing ${SYNCCMD_HIDDENPW} - check Logfile ${LOGFILE}!"
read -n 1 -s -r -p "Press any key to continue"
echo ""
exit 3
fi
fi
echo "Sucessfully synced. Quit."