From 008d77a7ae7f6866aae611f3807ca80180b6db35 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Tue, 3 May 2022 18:01:38 +0200 Subject: [PATCH] new: [monujo] add option ``version`` to set the target code version Signed-off-by: Valentin Lab --- monujo/README.org | 16 ++++++++++++++++ monujo/hooks/init | 4 +++- monujo/lib/common | 9 +++++++-- monujo/metadata.yml | 3 +++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/monujo/README.org b/monujo/README.org index 451af40..859ab14 100644 --- a/monujo/README.org +++ b/monujo/README.org @@ -143,3 +143,19 @@ monujo: tabs-link-color: rgba(0 0 0 0.6) navbar-fixed-z: 50 #+end_src + + +** Version + +The monujo app version deployed by this charm is set by default in +=metadata.yml= in =default-options.version=. + +You can enforce a different version by using the =version= option: + +#+begin_src yaml +monujo: + options: + version: 1.0.0-rc.1 + +odoo: +#+end_src diff --git a/monujo/hooks/init b/monujo/hooks/init index 8433634..09f0547 100755 --- a/monujo/hooks/init +++ b/monujo/hooks/init @@ -14,7 +14,9 @@ set -e -monujo:code_init +version=$(options-get version 2>/dev/null) + +monujo:code_init "$version" monujo:code_config_base diff --git a/monujo/lib/common b/monujo/lib/common index 1f078b3..7d487e6 100644 --- a/monujo/lib/common +++ b/monujo/lib/common @@ -8,8 +8,9 @@ CONFIGFILE="$LOCATION/config.json" monujo:code_init() { + local version="$1" if [ -e "$LOCATION/.version" ] && \ - [ "$(cat "$LOCATION/.version")" == "$VERSION" ]; then + [ "$(cat "$LOCATION/.version")" == "$version" ]; then return 0 fi [ -d "$LOCATION" ] && rm -rf "$LOCATION" @@ -24,7 +25,7 @@ monujo:code_init() { tar xjf file.tar.bz2 && rm file.tar.bz2 && chown root:root "$LOCATION" -R && - echo "$VERSION" > "$LOCATION/.version" + echo "$version" > "$LOCATION/.version" } export MONUJO_OPTIONS=( @@ -33,6 +34,7 @@ export MONUJO_OPTIONS=( map-url:string local-password-retention-time:numeric theme:struct\* + version:ignore ) export MONUJO_OPTIONS_CONCAT=" ${MONUJO_OPTIONS[*]} " @@ -58,6 +60,9 @@ monujo:json-make() { key=$(e "$key" | shyaml get-value) ytype=$(e "$val" | shyaml get-type) case "$MONUJO_OPTIONS_CONCAT" in + *" ${key}:ignore "*) + continue + ;; *" ${key}:bool "*) val=$(e "$val" | shyaml get-value) case "${val,,}" in diff --git a/monujo/metadata.yml b/monujo/metadata.yml index c9de2be..87bec30 100644 --- a/monujo/metadata.yml +++ b/monujo/metadata.yml @@ -2,6 +2,9 @@ description: "LokWallet" maintainer: "Valentin Lab " subordinate: true +default-options: + version: 1.0.0-rc.3 + uses: publish-dir: #constraint: required | recommended | optional