From 1bcaa934ee9f60b475302cae9eee68ff80a56ace Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 31 Mar 2022 20:40:32 +0200 Subject: [PATCH] Better resilience to `?` used in password --- helpers/app | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/helpers/app b/helpers/app index d272194af..7bbf351c0 100644 --- a/helpers/app +++ b/helpers/app @@ -1,8 +1,8 @@ #!/bin/bash -# Install other YunoHost apps when they are not multi-instance +# Install others YunoHost apps # -# usage: ynh_install_apps --apps="appfoo appbar?domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666" +# usage: ynh_install_apps --apps="appfoo?domain=domain.foo&path=/foo appbar?domain=domain.bar&path=/bar&admin=USER&language=fr&is_public=1&pass?word=pass&port=666" # | arg: -a, --apps= - apps to install # # Requires YunoHost version *.*.* or higher. @@ -22,7 +22,7 @@ ynh_install_apps() { for one_app_and_its_args in "${apps_list[@]}" do # Retrieve the name of the app (part before ?) - local one_app=$(echo "$one_app_and_its_args" | awk -F'?' '{print $1}') + local one_app=$(cut -d "?" -f1 <<< "$str") [ -z "$one_app" ] && ynh_die --message="You didn't provided a YunoHost app to install" yunohost tools update apps @@ -31,7 +31,7 @@ ynh_install_apps() { if ! yunohost app list --output-as json --quiet | jq -e --arg id $one_app '.apps[] | select(.id == $id)' >/dev/null then # Retrieve the arguments of the app (part after ?) - local one_argument=$(echo "$one_app_and_its_args" | awk -F'?' '{print $2}') + local one_argument=$(cut -d "?" -f2- <<< "$one_app_and_its_args") [ ! -z "$one_argument" ] && one_argument="--args \"$one_argument\"" # Install the app with its arguments