Merge pull request 'Improved configure.sh and fixing KDE on Fedora 44 kickstarter' (#26) from unbrot/fedora-OEMDRV:main into main

Reviewed-on: obel1x/fedora-OEMDRV#26
This commit is contained in:
2026-05-06 09:20:47 +02:00
6 changed files with 193 additions and 35 deletions
@@ -10,7 +10,9 @@
echo "Setup Nextcloud- Sync"
#Local Vars
BASECMD="/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=nextcloud com.nextcloud.desktopclient.nextcloud"
NC_FLATPAK_APP="com.nextcloud.desktopclient.nextcloud"
NC_FLATPAK_DIR="${HOME}/.var/app/${NC_FLATPAK_APP}"
BASECMD="/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=nextcloud ${NC_FLATPAK_APP}"
#Check Token
if [ "${DAVTOKEN_USER}." = "." ]; then
@@ -21,15 +23,20 @@ fi
#Remove Nextcloud from autostart anyway! Must be started by this script manually, because if it was started befor the ecrypted mount,
#it will never sync and always throw an error that the local dir is missing
if [ -f "$SUDO_HOME/.config/autostart/com.nextcloud.desktopclient.nextcloud.desktop" ]; then
echo "Remove Autostart Nextcloud"
rm $SUDO_HOME/.config/autostart/com.nextcloud.desktopclient.nextcloud.desktop
if [ -f "$HOME/.config/autostart/${NC_FLATPAK_APP}.desktop" ]; then
echo "Remove Autostart Nextcloud (old)"
rm $HOME/.config/autostart/${NC_FLATPAK_APP}.desktop
fi
# Same for NCs nuild-in autostart
if [ -f "$HOME/.config/autostart/Nextcloud.desktop" ]; then
echo "Remove Autostart Nextcloud (from installed binary)"
rm $HOME/.config/autostart/Nextcloud.desktop
fi
NC_PID=$( pgrep -u $USER nextcloud )
if [ -n "${NC_PID}" ]; then
echo "Stopping Nextcloud with PID ${NC_PID}"
/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=nextcloud com.nextcloud.desktopclient.nextcloud --quit >/dev/null
/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=nextcloud ${NC_FLATPAK_APP} --quit >/dev/null
if [ $? -ne 0 ]; then
echo "Service could not be stopped, please check why."
exit 1
@@ -40,14 +47,14 @@ fi
NC_PID=$( pgrep -u $USER nextcloud )
if [ -n "${NC_PID}" ]; then
echo "Nextcloud still running with PID ${NC_PID}. Force stop"
# Kill does not remove lockfiles in ~/.var/app/com.nextcloud.desktopclient.nextcloud/cache/tmp/ which will prevent next start
# Kill does not remove lockfiles in ${NC_FLATPAK_DIR}/cache/tmp/ which will prevent next start
kill ${NC_PID}
if [ $? -ne 0 ]; then
echo "Service could not be stopped, please check why."
exit 1
fi
sleep 0.5
rm -rif ${HOME}/.var/app/com.nextcloud.desktopclient.nextcloud/cache/temp/*
rm -rif ${NC_FLATPAK_DIR}/cache/temp/*
fi
#Check if Option is Configured to use Nextcloud Desktop Data- Sync
@@ -90,7 +97,7 @@ for CLIENT_DATA_DECLARE_LINE in "${CLIENT_DATA_SYNC[@]}"; do
eval "${CLIENT_DATA_DECLARE_LINE}"
# echo "DEBUG user_run.sh(0020)_2: ${CLIENT_DATA_SYNC_LINE[@]}"
# Now, CLIENT_DATA_SYNC_LINE[0] contains the local path and CLIENT_DATA_SYNC_LINE[1] contains the remote path
if grep -q "localPath=${CLIENT_DATA_SYNC_LINE[0]}" "/${HOME}/.var/app/com.nextcloud.desktopclient.nextcloud/config/Nextcloud/nextcloud.cfg"; then
if grep -q "localPath=${CLIENT_DATA_SYNC_LINE[0]}" "${NC_FLATPAK_DIR}/config/Nextcloud/nextcloud.cfg"; then
echo "Already found configured local folder ${CLIENT_DATA_SYNC_LINE[0]} syncing with ${CLIENT_DATA_SYNC_LINE[1]} . Leaving it unchanged."
_nc_first=0
else
@@ -111,8 +118,8 @@ for CLIENT_DATA_DECLARE_LINE in "${CLIENT_DATA_SYNC[@]}"; do
echo "Exec: ${SYNCCMD_HIDDENPW}"
if [ "${_nc_wipe_done}" -eq 0 ]; then
# Autoprovisioning only works when no configuration is existent — wipe once before first new setup
rm -rif ${HOME}/.var/app/com.nextcloud.desktopclient.nextcloud/data/Nextcloud
rm -rif ${HOME}/.var/app/com.nextcloud.desktopclient.nextcloud/config/Nextcloud
rm -rif ${NC_FLATPAK_DIR}/data/Nextcloud
rm -rif ${NC_FLATPAK_DIR}/config/Nextcloud
_nc_wipe_done=1
fi
#Now, execute Nextcloud autoprovisionig
+18 -5
View File
@@ -37,24 +37,37 @@ curl -fsSL ${REPO_URL%.git}/raw/branch/${REPO_BRANCH:-main}/system_setup/install
sudo -E bash /tmp/install.sh
```
Both are optional. That way, install.sh should know what to pull.
Both are export parameters are optional. That way, install.sh should know what to pull and use it for your new setup.
## After the script completes
Configure your environment before running any installation:
At the end of the installation, you will be asked wheter to run configure.sh . You are encouraged to do this always.
But bevor letting `configure.sh` start, there are some options for making your life easier:
1. You can either get some `setup_system.conf` file from your system admin and put it to `/opt/sys_config/config` . That way all your settings will be prefilled the right way.
2. You may also use some preconfigured file from `config.d/configure.conf(.bak)` and put it to `config.d/configure.conf` - if thats existing from the first setup of this pc.
Pleas mind, that in the meantime your config may have changed dramatically, so this may be only a good choice if your last configure was not that long ago.
3. You may also configure your environment before manually:
```sh
cp /opt/sys_config/system_setup/config.dist/setup_system.conf.dist /opt/sys_config/config/setup_system.conf
# Edit setup_system.conf — set TLDOMAIN, SERVERFQDN_IPA, SERVERFQDN_NC, and paths.
# Edit setup_system.conf — set TLDOMAIN, SERVERFQDN_IPA, SERVERFQDN_NC, paths and all you need
```
Optionally add local per-machine overrides in `config.d/`:
Mind, that this would be the job of `configure.sh`
4. Optionally add additional local per-machine overrides in `config.d/`:
```sh
# Example: use the devel branch on this machine
# Example: always use the devel branch on this machine, no matter what was specified anywhere
echo 'export REPO_BRANCH="devel"' > /opt/sys_config/config.d/system_defines.conf
```
5. Otherwise, let `configure.sh` do it's job.
Once configured, boot the Fedora installer from USB — Anaconda will detect the `OEMDRV` partition and run the Kickstart automatically.
## Supported filesystems for shrinking
@@ -68,6 +68,49 @@ android-tools
-samba-client
-samba-usershares
-BackupPC
#Exclude akonadi and all packages requiring it (pulled in via @office optional: kmymoney)
-akonadi-server
-akonadi-server-mysql
-akonadi-calendar
-akonadi-calendar-tools
-akonadi-contacts
-akonadi-mime
-akonadi-search
-akonadi-import-wizard
-akonadiconsole
-kdepim-runtime
-kdepim-runtime-libs
-kdepim-addons
-kalarm
-kgpg
-kleopatra
-kmail
-kmail-libs
-kmail-account-wizard
-kaddressbook
-kaddressbook-libs
-korganizer
-korganizer-libs
-kontact
-akregator
-merkuro
-zanshin
-kjots
-knotes
-knotes-libs
-pimcommon
-calendarsupport
-eventviews
-incidenceeditor
-mailcommon
-mailimporter-akonadi
-mbox-importer
-pim-data-exporter
-pim-data-exporter-libs
-messagelib
-maui-mauikit-calendar
-kmymoney
-kmymoney-libs
#Needed by SSSD
oddjob-mkhomedir
nss-pam-ldapd
@@ -27,7 +27,6 @@ mount -L OEMDRV /mnt/anaconda_pre
@domain-client
@system-tools
@kde-media
@kde-spin-initial-setup
@libreoffice
@office
@sound-and-video
@@ -68,9 +67,50 @@ android-tools
-kmines
#Annoying plasmoids
-kdeplasma-addons
#Search - Powerful, but slow
#Exclude akonadi and all packages requiring it (@kde-pim is optional and not selected)
# @kde-spin-initial-setup
-akonadi-server
-akonadi-server-mysql
-akonadi-calendar
-akonadi-calendar-tools
-akonadi-contacts
-akonadi-mime
-akonadi-search
-akonadi-import-wizard
-akonadiconsole
-kdepim-runtime
-kdepim-runtime-libs
-kdepim-addons
-kalarm
-kgpg
-kleopatra
-kmail
-kmail-libs
-kmail-account-wizard
-kaddressbook
-kaddressbook-libs
-korganizer
-korganizer-libs
-kontact
-akregator
-merkuro
-zanshin
-kjots
-knotes
-knotes-libs
-pimcommon
-calendarsupport
-eventviews
-incidenceeditor
-mailcommon
-mailimporter-akonadi
-mbox-importer
-pim-data-exporter
-pim-data-exporter-libs
-messagelib
-maui-mauikit-calendar
-kmymoney
-kmymoney-libs
-dragon
-kdeconnectd
-kde-connect
+67 -18
View File
@@ -5,14 +5,9 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
CONF_FILE="${SCRIPTDIR}/../config.d/configure.conf"
CONF_EXISTING="${SCRIPTDIR}/../config/setup_system.conf"
if [[ -f "$CONF_EXISTING" ]]; then
CONF_DIST="$CONF_EXISTING"
else
CONF_DIST="${SCRIPTDIR}/config.dist/setup_system.conf.dist"
fi
CONF_DIST="${SCRIPTDIR}/config.dist/setup_system.conf.dist"
CONF_FILE="${SCRIPTDIR}/../config/setup_system.conf"
CONF_PRE="${SCRIPTDIR}/../config.d/configure.conf"
# Prompt for a single value; returns the old value unchanged if the user presses Enter.
prompt_value() {
@@ -25,22 +20,70 @@ prompt_value() {
# Replace the first matching simple export line in configure.conf.
set_conf_var() {
local varname="$1" value="$2"
sed -i "s|^[[:space:]]*export ${varname}=.*|export ${varname}=\"${value}\"|" "$CONF_FILE"
sed -i "s|^[[:space:]]*export ${varname}=.*|export ${varname}=\"${value}\"|" "$CONF_PRE"
}
# Update an existing bare "export VAR=…" line at the top level, or append one.
override_conf_var() {
local varname="$1" value="$2"
if grep -q "^export ${varname}=" "$CONF_FILE"; then
sed -i "s|^export ${varname}=.*|export ${varname}=\"${value}\"|" "$CONF_FILE"
if grep -q "^export ${varname}=" "$CONF_PRE"; then
sed -i "s|^export ${varname}=.*|export ${varname}=\"${value}\"|" "$CONF_PRE"
else
printf 'export %s="%s"\n' "$varname" "$value" >> "$CONF_FILE"
printf 'export %s="%s"\n' "$varname" "$value" >> "$CONF_PRE"
fi
}
do_configure() {
mkdir -p "$(dirname "$CONF_FILE")"
cp "$CONF_DIST" "$CONF_FILE" # Either setup_system.conf or setup_system.conf.dist to config.d/configure.conf
# Possibilities:
# 1 Found CONF_FILE="${SCRIPTDIR}/../config/setup_system.conf": This is a preinstalled company-value filled complete conf file
# 2 Found CONF_PRE="${SCRIPTDIR}/../config.d/configure.conf": This a a configure file from a previous configure run
# 3 Found none of these: use CONF_DIST="${SCRIPTDIR}/config.dist/setup_system.conf.dist"
# -> if 1 or 2 found, ask the user if to use one of them
# -> either choice, the CONF_PRE="${SCRIPTDIR}/../config.d/configure.conf" is written from it and used for further setup
if [ -f "$CONF_FILE" ] || [ -f "$CONF_PRE" ]; then
echo "Some alternatives found for configure source:"
if [[ -f "$CONF_PRE" ]]; then
echo " Choice (p): Another config run result was found in $CONF_PRE ."
echo " Hint: May contain Values that already were setup different for your details"
else
unset CONF_PRE
fi
if [[ -f "$CONF_FILE" ]]; then
echo " Choice (c): Found companys full config in $CONF_FILE ."
echo " This may be a full config, that is valid for your company."
else
unset CONF_FILE
fi
# Always possible: Use new dist
echo " Choice (d): You may discard all, and use distributed defaults from the maintainers."
echo " Hint: Will always start from scratch which guaranties to have a valid config for your current version"
while true; do
read -r -p " Please make a coice: " CHOICE
case "${CHOICE}" in
"p")
if [[ -f "$CONF_PRE" ]]; then
echo "Using the existing config run file."
break
fi
;;
"c")
if [[ -f "$CONF_FILE" ]]; then
rm "$CONF_PRE" >/dev/null 2>&1
cp "$CONF_FILE" "$CONF_PRE" && break
fi
;;
"d")
rm "$CONF_PRE" >/dev/null 2>&1
cp "$CONF_DIST" "$CONF_PRE" && break
;;
esac
echo "Invalid choice or error in selection made."
done
else
cp "${CONF_DIST}" "$CONF_PRE"
fi
echo ""
echo "=== System Configuration ==="
@@ -58,7 +101,12 @@ do_configure() {
set_conf_var "REPO_BRANCH" "$REPO_BRANCH"
fi
source "$( dirname "$0" )/setup_system.inc.sh"
# Now there should all starting values be defined in $CONF_PRE file.
# We will additionally first read the dists defaults again to make sure, that all relevant settings that may be new to existing configs are predefined
# Could be no good idea when sysadmins are only deleting lines instead of unsettings its value, but makes sure there is not missing something for setup
source "$CONF_DIST"
#Now, read the users setting
source "$CONF_PRE"
VARS=("TLDOMAIN" "SERVERFQDN_IPA" "DOMAIN" "SERVERFQDN_NC" "IPAVAULTUSE" "IPAVAULTNAME" "DISTCONFIGPATH_SRC" "CLIENTADMINGROUP" )
for ELE in "${VARS[@]}"
do
@@ -66,7 +114,7 @@ do_configure() {
echo ""
new_ELE=$(prompt_value "${ELE}" "${!ELE}")
set_conf_var "${ELE}" "${new_ELE}"
source "$( dirname "$0" )/setup_system.inc.sh"
source "$CONF_PRE"
REPEAT_TEST=1
case ${ELE} in
"SERVERFQDN_NC") echo "=== Testing: Nextcloud server ==="
@@ -130,7 +178,8 @@ do_configure() {
fi
fi
;;
*) REPEAT_TEST=0
*) echo "Not tests available."
REPEAT_TEST=0
;;
esac
[[ $REPEAT_TEST == 0 ]] && break
@@ -138,7 +187,7 @@ do_configure() {
done
echo ""
echo "Configuration written to: ${CONF_FILE}"
echo "Configuration written to: ${CONF_PRE}"
}
while true; do
+6
View File
@@ -408,7 +408,13 @@ if [[ -n "$EXISTING_OEMDRV_DEV" ]]; then
|| die "git fetch failed."
git -C "$MOUNT_POINT" checkout -B "$REPO_BRANCH" FETCH_HEAD \
|| die "git checkout failed."
#Backup Repovalues if the config was read from existing config with production values and we configured
#devel values above
BACK_REPO_URL="$REPO_URL"
BACK_REPO_BRANCH="$REPO_BRANCH"
source "$MOUNT_POINT/system_setup/setup_system.inc.sh" --missingconfok
export REPO_URL="$EXIST_URL"
export REPO_BRANCH="$BACK_REPO_BRANCH"
finish_install "$EXISTING_OEMDRV_DEV"
exit 0
fi