[kde-linux/kde-linux] mkosi.extra/usr/bin: Adding an option that allows the user to name their extensions

Paul Brown <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit d2c98e6599a5e36f9bbd28222a595fee87108ec0 by Paul Brown.
Committed on 25/07/2026 at 13:06.
Pushed by paulb into branch 'master'.

Adding an option that allows the user to name their extensions

With these modifications, the user can name their extensions whatever they want, or even have several extensions operating at the same time.

M  +15   -9    mkosi.extra/usr/bin/set-up-systemd-extension

https://invent.kde.org/kde-linux/kde-linux/-/commit/d2c98e6599a5e36f9bbd28222a595fee87108ec0

diff --git a/mkosi.extra/usr/bin/set-up-systemd-extension b/mkosi.extra/usr/bin/set-up-systemd-extension
index e2ef8f72..447f29af 100755
--- a/mkosi.extra/usr/bin/set-up-systemd-extension
+++ b/mkosi.extra/usr/bin/set-up-systemd-extension
@@ -6,16 +6,22 @@
 
 set -e
 
-SYSEXT_BASE_LOCATION="${HOME}/kde/usr/"
+SYSEXT_NAME="kde"
+
+if test -n "$1"; then
+  SYSEXT_NAME="$1"
+fi
+
+SYSEXT_BASE_LOCATION="${HOME}/${SYSEXT_NAME}/usr/"
 SYSEXT_LOCATION="${SYSEXT_BASE_LOCATION}/lib/extension-release.d/"
 SYSEXT_ROOT_LOCATION="/var/lib/extensions/"
 
 echo
-if [ -f "${SYSEXT_LOCATION}/extension-release.kde" ]; then
-    echo '== Systemd system extension: already set up, skipping =='
+if [ -f "${SYSEXT_LOCATION}/extension-release.${SYSEXT_NAME}" ]; then
+    echo '== Systemd system extension ${SYSEXT_NAME}: already set up, skipping =='
 else
     echo '== Systemd system extension: needs setup =='
-    echo "Setting up extension at ${SYSEXT_BASE_LOCATION}..."
+    echo "Setting up extension ${SYSEXT_NAME} at ${SYSEXT_BASE_LOCATION}..."
 
     # Create directory to hold this system extension
     mkdir -p "${SYSEXT_LOCATION}"
@@ -24,21 +30,21 @@ else
     run0 sh <<EOF
 set -e
 mkdir -p "${SYSEXT_ROOT_LOCATION}"
-ln -fs "${HOME}/kde" "${SYSEXT_ROOT_LOCATION}"
+ln -fs "${HOME}/${SYSEXT_NAME}" "${SYSEXT_ROOT_LOCATION}"
 
 # Copy the system os-release file to be an extension-release file that identifies this extension
-cp /usr/lib/os-release "${SYSEXT_LOCATION}/extension-release.kde"
+cp /usr/lib/os-release "${SYSEXT_LOCATION}/extension-release.${SYSEXT_NAME}"
 
 # Set its ID to "_any" so system updates don't break the extension
 # Skip this step if you want the extension to only work for the current system build
-sed -i "s/^ID=.*/ID=_any/g" "${SYSEXT_LOCATION}/extension-release.kde"
+sed -i "s/^ID=.*/ID=_any/g" "${SYSEXT_LOCATION}/extension-release.${SYSEXT_NAME}"
 
 # Make the release file immutable so it can't be accidentally removed
-chattr +i "${SYSEXT_LOCATION}/extension-release.kde"
+chattr +i "${SYSEXT_LOCATION}/extension-release.${SYSEXT_NAME}"
 
 # Turn it on!
 systemd-sysext refresh || systemd-sysext merge
 EOF
 
-    echo "Finished setting up extension! When you put files in ${SYSEXT_BASE_LOCATION} and run 'run0 systemd-sysext refresh', they will appear in /usr/. See https://community.kde.org/KDE_Linux/Add_or_override_content_in_/usr for more information."
+    echo "Finished setting up extension ${SYSEXT_NAME}! When you put files in ${SYSEXT_BASE_LOCATION} and run 'run0 systemd-sysext refresh', they will appear in /usr/. See https://community.kde.org/KDE_Linux/Add_or_override_content_in_/usr for more information."
 fi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.