[neon/neon/calamares-settings/Neon/release-lts] oem-prepare/calamares/oem-prepare/prepare-system: throw away oem-config.service

Harald Sitter null at kde.org
Mon Mar 15 13:59:47 GMT 2021


Git commit 96b0756db784b1dceb909212190943a22588b777 by Harald Sitter.
Committed on 15/03/2021 at 13:58.
Pushed by sitter into branch 'Neon/release-lts'.

throw away oem-config.service

it's not used for anything. this left over from an earlier attempt at
recycling ubiquity's tooling. obviously that didn't come to fruition
making the oem-config.service related code utterly pointless

this needs careful testing as the service relationships might change

the .target file is unrelated and still relevant! it replaces the
standard graphical.target

M  +6    -9    oem-prepare/calamares/oem-prepare/prepare-system/calamares-oem-prepare-root
M  +11   -18   oem-prepare/calamares/oem-prepare/prepare-system/oem-cleanup
D  +0    -35   oem-prepare/calamares/oem-prepare/prepare-system/oem-config.service

https://invent.kde.org/neon/neon/calamares-settings/commit/96b0756db784b1dceb909212190943a22588b777

diff --git a/oem-prepare/calamares/oem-prepare/prepare-system/calamares-oem-prepare-root b/oem-prepare/calamares/oem-prepare/prepare-system/calamares-oem-prepare-root
index d067fc1..f7fb46a 100755
--- a/oem-prepare/calamares/oem-prepare/prepare-system/calamares-oem-prepare-root
+++ b/oem-prepare/calamares/oem-prepare/prepare-system/calamares-oem-prepare-root
@@ -2,8 +2,6 @@
 # SPDX-FileCopyrightText: 2018-2021 Harald Sitter <sitter at kde.org>
 # SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
 
-# FIXME: oem-config.service is actually not used and silly for us?
-
 set -ex
 
 cd `dirname "$(realpath $0)"`
@@ -49,6 +47,11 @@ cp -a oem-cleanup.service /lib/systemd/system
 cp -a /lib/systemd/system/sddm.service /lib/systemd/system/calamares-sddm.service
 /bin/systemctl enable calamares-sddm.service
 
+# Lastly switch to our config target (that will use the fancy unit from above)
+cp -a oem-config.target /lib/systemd/system
+/bin/systemctl enable oem-config.target
+/bin/systemctl set-default oem-config.target
+
 # NB: Mind the check in calamares-oem-prepare2 when changing this!
 cat << CONF >>/etc/polkit-1/localauthority/10-vendor.d/10-calamares-oem-config.pkla
 [Allow Calamares OEM Config]
@@ -60,7 +63,7 @@ ResultActive=yes
 CONF
 chmod 600 /etc/polkit-1/localauthority/10-vendor.d/10-calamares-oem-config.pkla
 
-### from oem-config
+### from Ubuntu's oem-config
 # Machine-specific, so remove in case this system is going to be
 # cloned.  These will be regenerated on the first boot.
 rm -f /etc/udev/rules.d/70-persistent-cd.rules \
@@ -70,10 +73,4 @@ rm -f /etc/NetworkManager/system-connections/*
 
 # Potentially sensitive.
 rm -f /home/oem/.ssh/known_hosts
-
-cp -a oem-config.service /lib/systemd/system
-cp -a oem-config.target /lib/systemd/system
-/bin/systemctl enable oem-config.service
-/bin/systemctl enable oem-config.target
-/bin/systemctl set-default oem-config.target
 ### end from oem-config
diff --git a/oem-prepare/calamares/oem-prepare/prepare-system/oem-cleanup b/oem-prepare/calamares/oem-prepare/prepare-system/oem-cleanup
index 1d116a3..9bda760 100755
--- a/oem-prepare/calamares/oem-prepare/prepare-system/oem-cleanup
+++ b/oem-prepare/calamares/oem-prepare/prepare-system/oem-cleanup
@@ -8,28 +8,21 @@ set -ex
 # there is more cleanup we need to do after the oem configuration is done though
 # and the user is no longer needed to run any programs.
 
-# Remove the temporary OEM configuration user, if possible
-# and desired.
-# RET="$(echo GET oem-config/remove | debconf-communicate)"
-# if [ "${RET#* }" = true ] && getent passwd oem >/dev/null; then
-  pkill -u oem || true
-  userdel --force --remove oem || true
-# fi
-/bin/systemctl set-default graphical.target || true
-/bin/systemctl disable oem-config.service || true
-/bin/systemctl disable oem-config.target || true
-rm -f /lib/systemd/system/oem-config.* || true
-# /bin/systemctl --no-block isolate graphical.target || true
-
-# Additions for neon
+# Throw out the user
+pkill -u oem || true
+userdel --force --remove oem || true
 
 rm -f /etc/polkit-1/localauthority/10-vendor.d/10-calamares-oem-config.pkla
 
-/bin/systemctl disable calamares-sddm.service || true
-rm -f /lib/systemd/system/calamares-sddm.service
+# This was already done by the undo module but since we'll now remove
+# oem-config we had better be certain this was called, otherwise the use
+# won't be getting a GUI anymore.
+/bin/systemctl set-default graphical.target || true
 
-/bin/systemctl disable oem-cleanup.service || true
-rm -f /lib/systemd/system/oem-cleanup.service
+for unit in oem-config.target calamares-sddm.service oem-cleanup.service; do
+  /bin/systemctl disable $unit || true
+  rm -f /lib/systemd/system/$unit
+done
 
 # We aren't managed by the calamares package but rather copied into place.
 # This means we are around after calamares already cleaned itself up and
diff --git a/oem-prepare/calamares/oem-prepare/prepare-system/oem-config.service b/oem-prepare/calamares/oem-prepare/prepare-system/oem-config.service
deleted file mode 100644
index 6d24fe3..0000000
--- a/oem-prepare/calamares/oem-prepare/prepare-system/oem-config.service
+++ /dev/null
@@ -1,35 +0,0 @@
-# SPDX-FileCopyrightText: 2018 Harald Sitter <sitter at kde.org>
-# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
-
-[Unit]
-Description=End-user configuration after initial OEM installation
-ConditionFileIsExecutable=/usr/sbin/oem-config-firstboot
-ConditionPathExists=/dev/tty1
-
-# We never want to run the oem-config job in the live environment (as is the
-# case in some custom configurations) or in recovery mode.
-ConditionKernelCommandLine=!boot=casper
-ConditionKernelCommandLine=!single
-ConditionKernelCommandLine=!rescue
-ConditionKernelCommandLine=!emergency
-
-[Service]
-Type=oneshot
-StandardInput=tty
-StandardOutput=tty
-StandardError=tty
-TTYPath=/dev/tty1
-TTYReset=yes
-TTYVHangup=yes
-ExecStart=/bin/sh -ec '\
-    for x in $(cat /proc/cmdline); do				\
-	case $x in						\
-	    debug-oem-config) debug=--debug ;;			\
-	    ubiquity/frontend=*) export frontend="${x#*=}" ;;	\
-	    automatic-oem-config) automatic=--automatic ;;	\
-	esac;							\
-	done;							\
-	'
-
-[Install]
-WantedBy=oem-config.target



More information about the Neon-commits mailing list