From 3b6e27f1fa36c1274d4c39b363fd5605ff2b3f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Fri, 7 Jan 2022 09:51:27 +0100 Subject: [PATCH 1/3] `RETURN_LABEL_NAME` implemented When using DEPNotify I would like Installomator to return a nice name for the label to show as status in DEPNotify, instead of only the label name. This way we can do that. And maybe in the fute include a description of the software, if people are seeking inspiration to software by looking at Installomator (that contains a lot of preferred solution for many) --- fragments/functions.sh | 4 ++++ fragments/header.sh | 8 ++++++++ fragments/main.sh | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/fragments/functions.sh b/fragments/functions.sh index f5d5137..c49003d 100644 --- a/fragments/functions.sh +++ b/fragments/functions.sh @@ -18,6 +18,10 @@ cleanupAndExit() { # $1 = exit code, $2 message # If we closed any processes, reopen the app again reopenClosedProcess printlog "################## End Installomator, exit code $1 \n\n" + # if label is wrong and we wanted name of the label, then return ################## + if [[ $RETURN_LABEL_NAME -eq 1 ]]; then + echo "##################" + fi exit "$1" } diff --git a/fragments/header.sh b/fragments/header.sh index c41879d..a60c22b 100644 --- a/fragments/header.sh +++ b/fragments/header.sh @@ -103,6 +103,14 @@ REOPEN="yes" # - yes App wil be reopened if it was closed # - no App not reopened +# Only let Installomator return the name of the label +# RETURN_LABEL_NAME=0 +# options: +# - 1 Installomator will return the name of the label and exit, so last line of +# output will be that name. When Installomator is locally installed and we +# use DEPNotify, then DEPNotify can present a more nice name to the user, +# instead of just the label name. + # NOTE: How labels work diff --git a/fragments/main.sh b/fragments/main.sh index 493e2f7..e81fe03 100644 --- a/fragments/main.sh +++ b/fragments/main.sh @@ -5,6 +5,13 @@ ;; esac +# Are we only asked to return label name +if [[ $RETURN_LABEL_NAME -eq 1 ]]; then + printlog "Only returning label name." + printlog "$name" + echo "$name" + exit +fi # MARK: application download and installation starts here From a1afc4727e2e47ce817e73676de8cf9ff10f5827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Sat, 8 Jan 2022 15:37:08 +0100 Subject: [PATCH 2/3] Update functions.sh Now return one `#` when unknown label is given, not a whole bunch of them. ``` Installomator/utils/assemble.sh strangelabel RETURN_LABEL_NAME=1 DEBUG=0 | tail -1 # ``` --- fragments/functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fragments/functions.sh b/fragments/functions.sh index c49003d..d70eee6 100644 --- a/fragments/functions.sh +++ b/fragments/functions.sh @@ -20,7 +20,7 @@ cleanupAndExit() { # $1 = exit code, $2 message printlog "################## End Installomator, exit code $1 \n\n" # if label is wrong and we wanted name of the label, then return ################## if [[ $RETURN_LABEL_NAME -eq 1 ]]; then - echo "##################" + echo "#" fi exit "$1" } From aa2f4146f74b637ad053e26e77a6ad4df7cd3736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Sun, 9 Jan 2022 10:45:06 +0100 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f87508..6521dcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## v9? - We have moved the root check to the beginning of the script, and improved DEBUG handling with two different modes. `DEBUG=0` is still for production, and `1` is still for the DEBUG we previously knew downloading to the directory it is running from, but `2` will download to temporary folder, will detect updates, but will not install anything, but it will notify the user (almost as running the script without root before). +- New variable `RETURN_LABEL_NAME`. If given the value `1`, like `RETURN_LABEL_NAME=1` then Installomator only returns the name of the label. It makes for a better user friendly message for displaying in DEPNotify if that is integrated. ## v8.0