mirror of
https://github.com/KDE/kde-linux.git
synced 2026-08-03 18:52:33 -04:00
Script asks user for name and directory if not supplied
This commit is contained in:
23
mkosi.extra/usr/bin/set-up-systemd-extension
Normal file → Executable file
23
mkosi.extra/usr/bin/set-up-systemd-extension
Normal file → Executable file
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user