diff --git a/mkosi.extra/usr/bin/set-up-systemd-extension b/mkosi.extra/usr/bin/set-up-systemd-extension index 32c0702..e2ef8f7 100755 --- a/mkosi.extra/usr/bin/set-up-systemd-extension +++ b/mkosi.extra/usr/bin/set-up-systemd-extension @@ -8,7 +8,7 @@ set -e SYSEXT_BASE_LOCATION="${HOME}/kde/usr/" SYSEXT_LOCATION="${SYSEXT_BASE_LOCATION}/lib/extension-release.d/" -SYSEXT_ROOT_LOCATION=/var/lib/extensions/ +SYSEXT_ROOT_LOCATION="/var/lib/extensions/" echo if [ -f "${SYSEXT_LOCATION}/extension-release.kde" ]; then @@ -18,22 +18,27 @@ else echo "Setting up extension at ${SYSEXT_BASE_LOCATION}..." # Create directory to hold this system extension - mkdir -p ${SYSEXT_LOCATION} - sudo mkdir -p ${SYSEXT_ROOT_LOCATION} - sudo ln -fs "${HOME}/kde" ${SYSEXT_ROOT_LOCATION} + mkdir -p "${SYSEXT_LOCATION}" - # Copy the system os-release file to be an extension-release file that identifies this extension - sudo cp /usr/lib/os-release "${SYSEXT_LOCATION}/extension-release.kde" + # Heredoc into run0 so we only have one auth prompt. + run0 sh < /dev/null + # Heredoc into run0 so we only have one auth prompt. + run0 sh < /dev/null - for ITEM in $PREINSTALLED_DEV_APPS; do - run0 cp "${USR_APPS_LOCATION}${ITEM}" "${OPT_APPS_LOCATION}${ITEM}" 1> /dev/null - run0 sed -i "/NoDisplay=true/d" "${OPT_APPS_LOCATION}${ITEM}" 1> /dev/null - echo "- Enabled ${ITEM}" - done +for ITEM in $PREINSTALLED_DEV_APPS; do + cp "${USR_APPS_LOCATION}\${ITEM}" "${OPT_APPS_LOCATION}\${ITEM}" 1> /dev/null + sed -i "/NoDisplay=true/d" "${OPT_APPS_LOCATION}\${ITEM}" 1> /dev/null + echo "- Enabled \${ITEM}" +done +EOF echo "Refreshing app cache…" kbuildsycoca6 @@ -33,19 +37,23 @@ function enable_dev_apps echo "files were installed in ${OPT_APPS_LOCATION}." } -function disable_dev_apps +disable_dev_apps() { echo "Hiding development apps…" - for ITEM in $PREINSTALLED_DEV_APPS; do - run0 rm "${OPT_APPS_LOCATION}${ITEM}" 1> /dev/null - done + # Heredoc into run0 so we only have one auth prompt. + run0 sh < /dev/null +done + +rmdir --ignore-fail-on-non-empty "$OPT_APPS_LOCATION" 1> /dev/null +EOF echo "Refreshing app cache…" kbuildsycoca6 - run0 rmdir --ignore-fail-on-non-empty "$OPT_APPS_LOCATION" 1> /dev/null - echo "Done; development apps are now hidden." }