From d492dbd1bec5ec19e3650d5f1bbcc5a1e300e142 Mon Sep 17 00:00:00 2001 From: Paul Brown Date: Sat, 1 Aug 2026 15:47:51 +0200 Subject: [PATCH] Script asks user for name and directory if not supplied --- mkosi.extra/usr/bin/set-up-systemd-extension | 23 +++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) mode change 100644 => 100755 mkosi.extra/usr/bin/set-up-systemd-extension diff --git a/mkosi.extra/usr/bin/set-up-systemd-extension b/mkosi.extra/usr/bin/set-up-systemd-extension old mode 100644 new mode 100755 index 4b72573..83718ea --- a/mkosi.extra/usr/bin/set-up-systemd-extension +++ b/mkosi.extra/usr/bin/set-up-systemd-extension @@ -11,9 +11,6 @@ usage() { set -e -# Test to see if the user added a name for their extension. Otherwise use 'kde' -SYSEXT_NAME="kde" - # Check for parameters (see "usage" function above) while getopts "n:d:h" option; do case "${option}" in @@ -23,16 +20,32 @@ while getopts "n:d:h" option; do d) SYSEXT_DIR="$OPTARG" ;; - h | *) + h) usage exit 0 ;; esac done + +# If name has not been defined, offer the user the possibility of defining it now or accepting the default 'kde' + +if [ -z ${SYSEXT_NAME} ]; then + echo -e "Extension name [default: kde]: \c" + read -r + SYSEXT_NAME="${REPLY:-kde}" +fi + # If a directory has been defined, the extension will be under 'directory/name'; if not, the extension will be under 'name' + if [ -z ${SYSEXT_DIR} ]; then - SYSEXT_DIR="${SYSEXT_NAME}" + echo -e "Extension directory [default: current directory]: \c" + read -r + if [ -z "${REPLY}" ]; then + SYSEXT_DIR="${SYSEXT_NAME}" + else + SYSEXT_DIR="${REPLY}/${SYSEXT_NAME}" + fi else SYSEXT_DIR="${SYSEXT_DIR}/${SYSEXT_NAME}" fi