From ec48edfef8b1a05094e7b0ae234e576f7a8a498a Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sat, 13 Apr 2019 10:44:48 +0200 Subject: [PATCH 1/3] [fix] No fucking uppercase ! Uppercase variables are for environment variables. Fix line 80: SRC_PATH: unbound variable --- data/helpers.d/filesystem | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/helpers.d/filesystem b/data/helpers.d/filesystem index 07614d179..c471a6872 100644 --- a/data/helpers.d/filesystem +++ b/data/helpers.d/filesystem @@ -77,7 +77,7 @@ ynh_backup() { echo "Source path '${src_path}' does not exist" >&2 if [ "$not_mandatory" == "0" ] then - echo "Source path '${SRC_PATH}' does not exist" >&2 + echo "Source path '${src_path}' does not exist" >&2 # This is a temporary fix for fail2ban config files missing after the migration to stretch. if echo "${src_path}" | grep --quiet "/etc/fail2ban" From 2dd48e2e7e673d90030692e3bc8553e21038cebe Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sat, 13 Apr 2019 17:12:12 +0200 Subject: [PATCH 2/3] [fix] Fix extraction of weight value for ynh_script_progression --- data/helpers.d/print | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/helpers.d/print b/data/helpers.d/print index f1120367a..fcf7f1ea8 100644 --- a/data/helpers.d/print +++ b/data/helpers.d/print @@ -223,9 +223,9 @@ ynh_script_progression () { local weight_calls=$(grep --perl-regexp --count "^[^#]*ynh_script_progression.*(--weight|-w )" $0) # Get the weight of each occurrences of 'ynh_script_progression' in the script using --weight - local weight_valuesA="$(grep --perl-regexp "^[^#]*ynh_script_progression.*--weight" $0 | sed 's/.*--weight[= ]\([[:digit:]].*\)/\1/g')" - # Get the weight of each occurrences of 'ynh_script_progression' in the script using -w - local weight_valuesB="$(grep --perl-regexp "^[^#]*ynh_script_progression.*-w " $0 | sed 's/.*-w[= ]\([[:digit:]].*\)/\1/g')" + local weight_valuesA="$(grep --perl-regexp "^[^#]*ynh_script_progression.*--weight" $0 | sed 's/.*--weight[= ]\([[:digit:]]*\).*/\1/g')" + # Get the weight of each occurrences of 'ynh_script_progression' in the script using -w + local weight_valuesB="$(grep --perl-regexp "^[^#]*ynh_script_progression.*-w " $0 | sed 's/.*-w[= ]\([[:digit:]]*\).*/\1/g')" # Each value will be on a different line. # Remove each 'end of line' and replace it by a '+' to sum the values. local weight_values=$(( $(echo "$weight_valuesA" | tr '\n' '+') + $(echo "$weight_valuesB" | tr '\n' '+') 0 )) From 1220a366cec455dd7c55966ce1816e94c58ae757 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sat, 13 Apr 2019 17:28:40 +0200 Subject: [PATCH 3/3] Add a comment about --time argument --- data/helpers.d/print | 1 + 1 file changed, 1 insertion(+) diff --git a/data/helpers.d/print b/data/helpers.d/print index fcf7f1ea8..468c41e96 100644 --- a/data/helpers.d/print +++ b/data/helpers.d/print @@ -192,6 +192,7 @@ ynh_print_ON () { # | arg: -m, --message= - The text to print # | arg: -w, --weight= - The weight for this progression. This value is 1 by default. Use a bigger value for a longer part of the script. # | arg: -t, --time= - Print the execution time since the last call to this helper. Especially usefull to define weights. +# The execution time is given for the duration since the previous call. So the weight should be applied to this previous call. # | arg: -l, --last= - Use for the last call of the helper, to fill te progression bar. # # Requires YunoHost version 3.?.? or higher.