helpers 2.1: drop support for 'legacy args' (positionals) in helpers

This commit is contained in:
Alexandre Aubin 2024-05-27 18:31:57 +02:00
parent 084ecd6578
commit b914ad9093
24 changed files with 152 additions and 285 deletions

View file

@ -8,7 +8,6 @@
# Requires YunoHost version *.*.* or higher. # Requires YunoHost version *.*.* or higher.
ynh_install_apps() { ynh_install_apps() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=a
local -A args_array=([a]=apps=) local -A args_array=([a]=apps=)
local apps local apps
# Manage arguments with getopts # Manage arguments with getopts
@ -127,7 +126,6 @@ ynh_remove_apps() {
# If the app relies on a specific PHP version, then `php` will be aliased that version. The PHP command will also be appended with the `phpflags` settings. # If the app relies on a specific PHP version, then `php` will be aliased that version. The PHP command will also be appended with the `phpflags` settings.
ynh_spawn_app_shell() { ynh_spawn_app_shell() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=a
local -A args_array=([a]=app=) local -A args_array=([a]=app=)
local app local app
# Manage arguments with getopts # Manage arguments with getopts

View file

@ -28,7 +28,7 @@ ynh_wait_dpkg_free() {
# Check if the name of this file contains only numbers. # Check if the name of this file contains only numbers.
if echo "$dpkg_file" | grep --perl-regexp --quiet "^[[:digit:]]+$"; then if echo "$dpkg_file" | grep --perl-regexp --quiet "^[[:digit:]]+$"; then
# If so, that a remaining of dpkg. # If so, that a remaining of dpkg.
ynh_print_err "dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem." ynh_print_err --message="dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem."
set -o xtrace # set -x set -o xtrace # set -x
return 1 return 1
fi fi
@ -43,21 +43,15 @@ ynh_wait_dpkg_free() {
# Check either a package is installed or not # Check either a package is installed or not
# #
# example: ynh_package_is_installed --package=yunohost && echo "installed" # example: ynh_package_is_installed foobar && echo "installed"
# #
# usage: ynh_package_is_installed --package=name # usage: ynh_package_is_installed name
# | arg: -p, --package= - the package name to check # | arg: name - the package name to check
# | ret: 0 if the package is installed, 1 else. # | ret: 0 if the package is installed, 1 else.
# #
# Requires YunoHost version 2.2.4 or higher. # Requires YunoHost version 2.2.4 or higher.
ynh_package_is_installed() { ynh_package_is_installed() {
# Declare an array to define the options of this helper. local package=$1
local legacy_args=p
local -A args_array=([p]=package=)
local package
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
dpkg-query --show --showformat='${Status}' "$package" 2>/dev/null \ dpkg-query --show --showformat='${Status}' "$package" 2>/dev/null \
| grep --count "ok installed" &>/dev/null | grep --count "ok installed" &>/dev/null
} }
@ -75,7 +69,6 @@ ynh_package_is_installed() {
# Requires YunoHost version 2.2.4 or higher. # Requires YunoHost version 2.2.4 or higher.
ynh_package_version() { ynh_package_version() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=p
local -A args_array=([p]=package=) local -A args_array=([p]=package=)
local package local package
# Manage arguments with getopts # Manage arguments with getopts
@ -310,7 +303,7 @@ ynh_install_app_dependencies() {
YNH_INSTALL_APP_DEPENDENCIES_REPLACE="false" YNH_INSTALL_APP_DEPENDENCIES_REPLACE="false"
else else
local current_dependencies="" local current_dependencies=""
if ynh_package_is_installed --package="${dep_app}-ynh-deps" if ynh_package_is_installed "${dep_app}-ynh-deps"
then then
current_dependencies="$(dpkg-query --show --showformat='${Depends}' ${dep_app}-ynh-deps) " current_dependencies="$(dpkg-query --show --showformat='${Depends}' ${dep_app}-ynh-deps) "
current_dependencies=${current_dependencies// | /|} current_dependencies=${current_dependencies// | /|}
@ -352,7 +345,6 @@ EOF
# Requires YunoHost version 3.8.1 or higher. # Requires YunoHost version 3.8.1 or higher.
ynh_add_app_dependencies() { ynh_add_app_dependencies() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=pr
local -A args_array=([p]=package= [r]=replace) local -A args_array=([p]=package= [r]=replace)
local package local package
# Manage arguments with getopts # Manage arguments with getopts
@ -375,7 +367,7 @@ ynh_remove_app_dependencies() {
local dep_app=${app//_/-} # Replace all '_' by '-' local dep_app=${app//_/-} # Replace all '_' by '-'
local current_dependencies="" local current_dependencies=""
if ynh_package_is_installed --package="${dep_app}-ynh-deps"; then if ynh_package_is_installed "${dep_app}-ynh-deps"; then
current_dependencies="$(dpkg-query --show --showformat='${Depends}' ${dep_app}-ynh-deps) " current_dependencies="$(dpkg-query --show --showformat='${Depends}' ${dep_app}-ynh-deps) "
current_dependencies=${current_dependencies// | /|} current_dependencies=${current_dependencies// | /|}
fi fi
@ -409,7 +401,6 @@ ynh_remove_app_dependencies() {
# Requires YunoHost version 3.8.1 or higher. # Requires YunoHost version 3.8.1 or higher.
ynh_install_extra_app_dependencies() { ynh_install_extra_app_dependencies() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=rpkn
local -A args_array=([r]=repo= [p]=package= [k]=key= [n]=name=) local -A args_array=([r]=repo= [p]=package= [k]=key= [n]=name=)
local repo local repo
local package local package
@ -454,7 +445,6 @@ ynh_install_extra_app_dependencies() {
# Requires YunoHost version 3.8.1 or higher. # Requires YunoHost version 3.8.1 or higher.
ynh_install_extra_repo() { ynh_install_extra_repo() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=rkpna
local -A args_array=([r]=repo= [k]=key= [p]=priority= [n]=name= [a]=append) local -A args_array=([r]=repo= [k]=key= [p]=priority= [n]=name= [a]=append)
local repo local repo
local key local key
@ -523,7 +513,6 @@ ynh_install_extra_repo() {
# Requires YunoHost version 3.8.1 or higher. # Requires YunoHost version 3.8.1 or higher.
ynh_remove_extra_repo() { ynh_remove_extra_repo() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=n
local -A args_array=([n]=name=) local -A args_array=([n]=name=)
local name local name
# Manage arguments with getopts # Manage arguments with getopts
@ -532,7 +521,7 @@ ynh_remove_extra_repo() {
ynh_secure_remove --file="/etc/apt/sources.list.d/$name.list" ynh_secure_remove --file="/etc/apt/sources.list.d/$name.list"
# Sury pinning is managed by the regenconf in the core... # Sury pinning is managed by the regenconf in the core...
[[ "$name" == "extra_php_version" ]] || ynh_secure_remove "/etc/apt/preferences.d/$name" [[ "$name" == "extra_php_version" ]] || ynh_secure_remove --file="/etc/apt/preferences.d/$name"
if [ -e /etc/apt/trusted.gpg.d/$name.gpg ]; then if [ -e /etc/apt/trusted.gpg.d/$name.gpg ]; then
ynh_secure_remove --file="/etc/apt/trusted.gpg.d/$name.gpg" ynh_secure_remove --file="/etc/apt/trusted.gpg.d/$name.gpg"
fi fi
@ -564,7 +553,6 @@ ynh_remove_extra_repo() {
# Requires YunoHost version 3.8.1 or higher. # Requires YunoHost version 3.8.1 or higher.
ynh_add_repo() { ynh_add_repo() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=uscna
local -A args_array=([u]=uri= [s]=suite= [c]=component= [n]=name= [a]=append) local -A args_array=([u]=uri= [s]=suite= [c]=component= [n]=name= [a]=append)
local uri local uri
local suite local suite
@ -604,7 +592,6 @@ ynh_add_repo() {
# Requires YunoHost version 3.8.1 or higher. # Requires YunoHost version 3.8.1 or higher.
ynh_pin_repo() { ynh_pin_repo() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=pirna
local -A args_array=([p]=package= [i]=pin= [r]=priority= [n]=name= [a]=append) local -A args_array=([p]=package= [i]=pin= [r]=priority= [n]=name= [a]=append)
local package local package
local pin local pin

View file

@ -65,7 +65,6 @@ ynh_backup() {
# TODO find a way to avoid injection by file strange naming ! # TODO find a way to avoid injection by file strange naming !
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=sdbm
local -A args_array=([s]=src_path= [d]=dest_path= [b]=is_big [m]=not_mandatory) local -A args_array=([s]=src_path= [d]=dest_path= [b]=is_big [m]=not_mandatory)
local src_path local src_path
local dest_path local dest_path
@ -237,7 +236,6 @@ with open(sys.argv[1], 'r') as backup_file:
# Requires YunoHost version 3.5.0 or higher for the argument --not_mandatory # Requires YunoHost version 3.5.0 or higher for the argument --not_mandatory
ynh_restore_file() { ynh_restore_file() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=odm
local -A args_array=([o]=origin_path= [d]=dest_path= [m]=not_mandatory) local -A args_array=([o]=origin_path= [d]=dest_path= [m]=not_mandatory)
local origin_path local origin_path
local dest_path local dest_path
@ -305,7 +303,6 @@ ynh_restore_file() {
# Requires YunoHost version 2.6.4 or higher. # Requires YunoHost version 2.6.4 or higher.
ynh_store_file_checksum() { ynh_store_file_checksum() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=f
local -A args_array=([f]=file= [u]=update_only) local -A args_array=([f]=file= [u]=update_only)
local file local file
local update_only local update_only
@ -356,7 +353,6 @@ ynh_store_file_checksum() {
# Requires YunoHost version 2.6.4 or higher. # Requires YunoHost version 2.6.4 or higher.
ynh_backup_if_checksum_is_different() { ynh_backup_if_checksum_is_different() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=f
local -A args_array=([f]=file=) local -A args_array=([f]=file=)
local file local file
# Manage arguments with getopts # Manage arguments with getopts
@ -372,13 +368,13 @@ ynh_backup_if_checksum_is_different() {
backup_file_checksum="/var/cache/yunohost/appconfbackup/$file.backup.$(date '+%Y%m%d.%H%M%S')" backup_file_checksum="/var/cache/yunohost/appconfbackup/$file.backup.$(date '+%Y%m%d.%H%M%S')"
mkdir --parents "$(dirname "$backup_file_checksum")" mkdir --parents "$(dirname "$backup_file_checksum")"
cp --archive "$file" "$backup_file_checksum" # Backup the current file cp --archive "$file" "$backup_file_checksum" # Backup the current file
ynh_print_warn "File $file has been manually modified since the installation or last upgrade. So it has been duplicated in $backup_file_checksum" ynh_print_warn --message="File $file has been manually modified since the installation or last upgrade. So it has been duplicated in $backup_file_checksum"
echo "$backup_file_checksum" # Return the name of the backup file echo "$backup_file_checksum" # Return the name of the backup file
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
local file_path_base64=$(echo "$file" | base64 -w0) local file_path_base64=$(echo "$file" | base64 -w0)
if test -e /var/cache/yunohost/appconfbackup/original_${file_path_base64} if test -e /var/cache/yunohost/appconfbackup/original_${file_path_base64}
then then
ynh_print_warn "Diff with the original file:" ynh_print_warn --message="Diff with the original file:"
diff --report-identical-files --unified --color=always /var/cache/yunohost/appconfbackup/original_${file_path_base64} $file >&2 || true diff --report-identical-files --unified --color=always /var/cache/yunohost/appconfbackup/original_${file_path_base64} $file >&2 || true
fi fi
fi fi
@ -396,7 +392,6 @@ ynh_backup_if_checksum_is_different() {
# Requires YunoHost version 3.3.1 or higher. # Requires YunoHost version 3.3.1 or higher.
ynh_delete_file_checksum() { ynh_delete_file_checksum() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=f
local -A args_array=([f]=file=) local -A args_array=([f]=file=)
local file local file
# Manage arguments with getopts # Manage arguments with getopts

View file

@ -320,7 +320,7 @@ ynh_app_action_run() {
#ynh_return "result:" #ynh_return "result:"
#ynh_return "$(echo "${result}" | sed 's/^/ /g')" #ynh_return "$(echo "${result}" | sed 's/^/ /g')"
else else
ynh_die "No handler defined in app's script for action $1. If you are the maintainer of this app, you should define '$runner'" ynh_die --message="No handler defined in app's script for action $1. If you are the maintainer of this app, you should define '$runner'"
fi fi
} }

View file

@ -59,7 +59,6 @@
# Requires YunoHost version 4.1.0 or higher. # Requires YunoHost version 4.1.0 or higher.
ynh_add_fail2ban_config() { ynh_add_fail2ban_config() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=lrmptv
local -A args_array=([l]=logpath= [r]=failregex= [m]=max_retry= [p]=ports= [t]=use_template) local -A args_array=([l]=logpath= [r]=failregex= [m]=max_retry= [p]=ports= [t]=use_template)
local logpath local logpath
local failregex local failregex

View file

@ -48,168 +48,138 @@
ynh_handle_getopts_args() { ynh_handle_getopts_args() {
# Manage arguments only if there's some provided # Manage arguments only if there's some provided
set +o xtrace # set +x set +o xtrace # set +x
if [ $# -ne 0 ]; then if [ $# -eq 0 ]; then
# Store arguments in an array to keep each argument separated set -o xtrace # set -x
local arguments=("$@") return
fi
# For each option in the array, reduce to short options for getopts (e.g. for [u]=user, --user will be -u) # Store arguments in an array to keep each argument separated
# And built parameters string for getopts local arguments=("$@")
# ${!args_array[@]} is the list of all option_flags in the array (An option_flag is 'u' in [u]=user, user is a value)
local getopts_parameters="" # For each option in the array, reduce to short options for getopts (e.g. for [u]=user, --user will be -u)
local option_flag="" # And built parameters string for getopts
for option_flag in "${!args_array[@]}"; do # ${!args_array[@]} is the list of all option_flags in the array (An option_flag is 'u' in [u]=user, user is a value)
# Concatenate each option_flags of the array to build the string of arguments for getopts local getopts_parameters=""
# Will looks like 'abcd' for -a -b -c -d local option_flag=""
# If the value of an option_flag finish by =, it's an option with additionnal values. (e.g. --user bob or -u bob) for option_flag in "${!args_array[@]}"; do
# Check the last character of the value associate to the option_flag # Concatenate each option_flags of the array to build the string of arguments for getopts
if [ "${args_array[$option_flag]: -1}" = "=" ]; then # Will looks like 'abcd' for -a -b -c -d
# For an option with additionnal values, add a ':' after the letter for getopts. # If the value of an option_flag finish by =, it's an option with additionnal values. (e.g. --user bob or -u bob)
getopts_parameters="${getopts_parameters}${option_flag}:" # Check the last character of the value associate to the option_flag
else if [ "${args_array[$option_flag]: -1}" = "=" ]; then
getopts_parameters="${getopts_parameters}${option_flag}" # For an option with additionnal values, add a ':' after the letter for getopts.
fi getopts_parameters="${getopts_parameters}${option_flag}:"
# Check each argument given to the function else
local arg="" getopts_parameters="${getopts_parameters}${option_flag}"
# ${#arguments[@]} is the size of the array fi
for arg in $(seq 0 $((${#arguments[@]} - 1))); do # Check each argument given to the function
# Escape options' values starting with -. Otherwise the - will be considered as another option. local arg=""
arguments[arg]="${arguments[arg]//--${args_array[$option_flag]}-/--${args_array[$option_flag]}\\TOBEREMOVED\\-}" # ${#arguments[@]} is the size of the array
# And replace long option (value of the option_flag) by the short option, the option_flag itself for arg in $(seq 0 $((${#arguments[@]} - 1))); do
# (e.g. for [u]=user, --user will be -u) # Escape options' values starting with -. Otherwise the - will be considered as another option.
# Replace long option with = (match the beginning of the argument) arguments[arg]="${arguments[arg]//--${args_array[$option_flag]}-/--${args_array[$option_flag]}\\TOBEREMOVED\\-}"
arguments[arg]="$(printf '%s\n' "${arguments[arg]}" | sed "s/^--${args_array[$option_flag]}/-${option_flag} /")" # And replace long option (value of the option_flag) by the short option, the option_flag itself
# And long option without = (match the whole line) # (e.g. for [u]=user, --user will be -u)
arguments[arg]="$(printf '%s\n' "${arguments[arg]}" | sed "s/^--${args_array[$option_flag]%=}$/-${option_flag} /")" # Replace long option with = (match the beginning of the argument)
done arguments[arg]="$(printf '%s\n' "${arguments[arg]}" | sed "s/^--${args_array[$option_flag]}/-${option_flag} /")"
# And long option without = (match the whole line)
arguments[arg]="$(printf '%s\n' "${arguments[arg]}" | sed "s/^--${args_array[$option_flag]%=}$/-${option_flag} /")"
done done
done
# Read and parse all the arguments # Read and parse all the arguments
# Use a function here, to use standart arguments $@ and be able to use shift. # Use a function here, to use standart arguments $@ and be able to use shift.
parse_arg() { parse_arg() {
# Read all arguments, until no arguments are left # Read all arguments, until no arguments are left
while [ $# -ne 0 ]; do while [ $# -ne 0 ]; do
# Initialize the index of getopts # Initialize the index of getopts
OPTIND=1 OPTIND=1
# Parse with getopts only if the argument begin by -, that means the argument is an option # Parse with getopts only if the argument begin by -, that means the argument is an option
# getopts will fill $parameter with the letter of the option it has read. # getopts will fill $parameter with the letter of the option it has read.
local parameter="" local parameter=""
getopts ":$getopts_parameters" parameter || true getopts ":$getopts_parameters" parameter || true
if [ "$parameter" = "?" ]; then if [ "$parameter" = "?" ]; then
ynh_die --message="Invalid argument: -${OPTARG:-}" ynh_die --message="Invalid argument: -${OPTARG:-}"
elif [ "$parameter" = ":" ]; then elif [ "$parameter" = ":" ]; then
ynh_die --message="-$OPTARG parameter requires an argument." ynh_die --message="-$OPTARG parameter requires an argument."
else else
local shift_value=1 local shift_value=1
# Use the long option, corresponding to the short option read by getopts, as a variable # Use the long option, corresponding to the short option read by getopts, as a variable
# (e.g. for [u]=user, 'user' will be used as a variable)
# Also, remove '=' at the end of the long option
# The variable name will be stored in 'option_var'
local option_var="${args_array[$parameter]%=}"
# If this option doesn't take values
# if there's a '=' at the end of the long option name, this option takes values
if [ "${args_array[$parameter]: -1}" != "=" ]; then
# 'eval ${option_var}' will use the content of 'option_var'
eval ${option_var}=1
else
# Read all other arguments to find multiple value for this option.
# Load args in a array
local all_args=("$@")
# If the first argument is longer than 2 characters,
# There's a value attached to the option, in the same array cell
if [ ${#all_args[0]} -gt 2 ]; then
# Remove the option and the space, so keep only the value itself.
all_args[0]="${all_args[0]#-${parameter} }"
# At this point, if all_args[0] start with "-", then the argument is not well formed
if [ "${all_args[0]:0:1}" == "-" ]; then
ynh_die --message="Argument \"${all_args[0]}\" not valid! Did you use a single \"-\" instead of two?"
fi
# Reduce the value of shift, because the option has been removed manually
shift_value=$((shift_value - 1))
fi
# Declare the content of option_var as a variable.
eval ${option_var}=""
# Then read the array value per value
local i
for i in $(seq 0 $((${#all_args[@]} - 1))); do
# If this argument is an option, end here.
if [ "${all_args[$i]:0:1}" == "-" ]; then
# Ignore the first value of the array, which is the option itself
if [ "$i" -ne 0 ]; then
break
fi
else
# Ignore empty parameters
if [ -n "${all_args[$i]}" ]; then
# Else, add this value to this option
# Each value will be separated by ';'
if [ -n "${!option_var}" ]; then
# If there's already another value for this option, add a ; before adding the new value
eval ${option_var}+="\;"
fi
# Remove the \ that escape - at beginning of values.
all_args[i]="${all_args[i]//\\TOBEREMOVED\\/}"
# For the record.
# We're using eval here to get the content of the variable stored itself as simple text in $option_var...
# Other ways to get that content would be to use either ${!option_var} or declare -g ${option_var}
# But... ${!option_var} can't be used as left part of an assignation.
# declare -g ${option_var} will create a local variable (despite -g !) and will not be available for the helper itself.
# So... Stop fucking arguing each time that eval is evil... Go find an other working solution if you can find one!
eval ${option_var}+='"${all_args[$i]}"'
fi
shift_value=$((shift_value + 1))
fi
done
fi
fi
# Shift the parameter and its argument(s)
shift $shift_value
done
}
# LEGACY MODE
# Check if there's getopts arguments
if [ "${arguments[0]:0:1}" != "-" ]; then
# If not, enter in legacy mode and manage the arguments as positionnal ones..
# Dot not echo, to prevent to go through a helper output. But print only in the log.
set -x
echo "! Helper used in legacy mode !" >/dev/null
set +x
local i
for i in $(seq 0 $((${#arguments[@]} - 1))); do
# Try to use legacy_args as a list of option_flag of the array args_array
# Otherwise, fallback to getopts_parameters to get the option_flag. But an associative arrays isn't always sorted in the correct order...
# Remove all ':' in getopts_parameters
getopts_parameters=${legacy_args:-${getopts_parameters//:/}}
# Get the option_flag from getopts_parameters, by using the option_flag according to the position of the argument.
option_flag=${getopts_parameters:$i:1}
if [ -z "$option_flag" ]; then
ynh_print_warn --message="Too many arguments ! \"${arguments[$i]}\" will be ignored."
continue
fi
# Use the long option, corresponding to the option_flag, as a variable
# (e.g. for [u]=user, 'user' will be used as a variable) # (e.g. for [u]=user, 'user' will be used as a variable)
# Also, remove '=' at the end of the long option # Also, remove '=' at the end of the long option
# The variable name will be stored in 'option_var' # The variable name will be stored in 'option_var'
local option_var="${args_array[$option_flag]%=}" local option_var="${args_array[$parameter]%=}"
# If this option doesn't take values
# if there's a '=' at the end of the long option name, this option takes values
if [ "${args_array[$parameter]: -1}" != "=" ]; then
# 'eval ${option_var}' will use the content of 'option_var'
eval ${option_var}=1
else
# Read all other arguments to find multiple value for this option.
# Load args in a array
local all_args=("$@")
# Store each value given as argument in the corresponding variable # If the first argument is longer than 2 characters,
# The values will be stored in the same order than $args_array # There's a value attached to the option, in the same array cell
eval ${option_var}+='"${arguments[$i]}"' if [ ${#all_args[0]} -gt 2 ]; then
done # Remove the option and the space, so keep only the value itself.
unset legacy_args all_args[0]="${all_args[0]#-${parameter} }"
else
# END LEGACY MODE # At this point, if all_args[0] start with "-", then the argument is not well formed
# Call parse_arg and pass the modified list of args as an array of arguments. if [ "${all_args[0]:0:1}" == "-" ]; then
parse_arg "${arguments[@]}" ynh_die --message="Argument \"${all_args[0]}\" not valid! Did you use a single \"-\" instead of two?"
fi fi
fi # Reduce the value of shift, because the option has been removed manually
shift_value=$((shift_value - 1))
fi
# Declare the content of option_var as a variable.
eval ${option_var}=""
# Then read the array value per value
local i
for i in $(seq 0 $((${#all_args[@]} - 1))); do
# If this argument is an option, end here.
if [ "${all_args[$i]:0:1}" == "-" ]; then
# Ignore the first value of the array, which is the option itself
if [ "$i" -ne 0 ]; then
break
fi
else
# Ignore empty parameters
if [ -n "${all_args[$i]}" ]; then
# Else, add this value to this option
# Each value will be separated by ';'
if [ -n "${!option_var}" ]; then
# If there's already another value for this option, add a ; before adding the new value
eval ${option_var}+="\;"
fi
# Remove the \ that escape - at beginning of values.
all_args[i]="${all_args[i]//\\TOBEREMOVED\\/}"
# For the record.
# We're using eval here to get the content of the variable stored itself as simple text in $option_var...
# Other ways to get that content would be to use either ${!option_var} or declare -g ${option_var}
# But... ${!option_var} can't be used as left part of an assignation.
# declare -g ${option_var} will create a local variable (despite -g !) and will not be available for the helper itself.
# So... Stop fucking arguing each time that eval is evil... Go find an other working solution if you can find one!
eval ${option_var}+='"${all_args[$i]}"'
fi
shift_value=$((shift_value + 1))
fi
done
fi
fi
# Shift the parameter and its argument(s)
shift $shift_value
done
}
# Call parse_arg and pass the modified list of args as an array of arguments.
parse_arg "${arguments[@]}"
set -o xtrace # set -x set -o xtrace # set -x
} }

View file

@ -95,7 +95,6 @@ ynh_use_go () {
# Requires YunoHost version 3.2.2 or higher. # Requires YunoHost version 3.2.2 or higher.
ynh_install_go () { ynh_install_go () {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=v
local -A args_array=( [v]=go_version= ) local -A args_array=( [v]=go_version= )
local go_version local go_version
# Manage arguments with getopts # Manage arguments with getopts

View file

@ -14,7 +14,6 @@
# Requires YunoHost version 3.8.1 or higher. # Requires YunoHost version 3.8.1 or higher.
ynh_get_ram() { ynh_get_ram() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=ftso
local -A args_array=([f]=free [t]=total [s]=ignore_swap [o]=only_swap) local -A args_array=([f]=free [t]=total [s]=ignore_swap [o]=only_swap)
local free local free
local total local total
@ -78,7 +77,6 @@ ynh_get_ram() {
# Requires YunoHost version 3.8.1 or higher. # Requires YunoHost version 3.8.1 or higher.
ynh_require_ram() { ynh_require_ram() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=rftso
local -A args_array=([r]=required= [f]=free [t]=total [s]=ignore_swap [o]=only_swap) local -A args_array=([r]=required= [f]=free [t]=total [s]=ignore_swap [o]=only_swap)
local required local required
local free local free

View file

@ -9,7 +9,6 @@
# Requires YunoHost version 2.4.0 or higher. # Requires YunoHost version 2.4.0 or higher.
ynh_die() { ynh_die() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=mc
local -A args_array=([m]=message= [c]=ret_code=) local -A args_array=([m]=message= [c]=ret_code=)
local message local message
local ret_code local ret_code
@ -29,7 +28,6 @@ ynh_die() {
# Requires YunoHost version 3.2.0 or higher. # Requires YunoHost version 3.2.0 or higher.
ynh_print_info() { ynh_print_info() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=m
local -A args_array=([m]=message=) local -A args_array=([m]=message=)
local message local message
# Manage arguments with getopts # Manage arguments with getopts
@ -55,7 +53,6 @@ ynh_print_log() {
# Requires YunoHost version 3.2.0 or higher. # Requires YunoHost version 3.2.0 or higher.
ynh_print_warn() { ynh_print_warn() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=m
local -A args_array=([m]=message=) local -A args_array=([m]=message=)
local message local message
# Manage arguments with getopts # Manage arguments with getopts
@ -72,7 +69,6 @@ ynh_print_warn() {
# Requires YunoHost version 3.2.0 or higher. # Requires YunoHost version 3.2.0 or higher.
ynh_print_err() { ynh_print_err() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=m
local -A args_array=([m]=message=) local -A args_array=([m]=message=)
local message local message
# Manage arguments with getopts # Manage arguments with getopts
@ -201,7 +197,7 @@ ynh_exec_and_print_stderr_only_if_error() {
"$@" 2> "$logfile" || rc="$?" "$@" 2> "$logfile" || rc="$?"
if (( rc != 0 )); then if (( rc != 0 )); then
ynh_exec_warn cat "$logfile" ynh_exec_warn cat "$logfile"
ynh_secure_remove "$logfile" ynh_secure_remove --file="$logfile"
return "$rc" return "$rc"
fi fi
} }
@ -257,7 +253,6 @@ base_time=$(date +%s)
ynh_script_progression() { ynh_script_progression() {
set +o xtrace # set +x set +o xtrace # set +x
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=mwtl
local -A args_array=([m]=message= [w]=weight= [t]=time [l]=last) local -A args_array=([m]=message= [w]=weight= [t]=time [l]=last)
local message local message
local weight local weight
@ -332,7 +327,7 @@ ynh_script_progression() {
print_exec_time=" [$(bc <<< "scale=1; $exec_time / 60" ) minutes]" print_exec_time=" [$(bc <<< "scale=1; $exec_time / 60" ) minutes]"
fi fi
ynh_print_info "[$progression_bar] > ${message}${print_exec_time}" echo "[$progression_bar] > ${message}${print_exec_time}" >&$YNH_STDINFO
set -o xtrace # set -x set -o xtrace # set -x
} }

View file

@ -27,7 +27,6 @@ ynh_use_logrotate() {
set -- "${all_args[@]}" set -- "${all_args[@]}"
# Argument parsing # Argument parsing
local legacy_args=lu
local -A args_array=([l]=logfile= [u]=specific_user=) local -A args_array=([l]=logfile= [u]=specific_user=)
local logfile local logfile
local specific_user local specific_user

View file

@ -18,7 +18,6 @@
# #
ynh_mongo_exec() { ynh_mongo_exec() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=upadhPce
local -A args_array=( [u]=user= [p]=password= [a]=authenticationdatabase= [d]=database= [h]=host= [P]=port= [c]=command= [e]=eval ) local -A args_array=( [u]=user= [p]=password= [a]=authenticationdatabase= [d]=database= [h]=host= [P]=port= [c]=command= [e]=eval )
local user local user
local password local password
@ -115,7 +114,6 @@ EOF
# #
ynh_mongo_drop_db() { ynh_mongo_drop_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=d
local -A args_array=( [d]=database= ) local -A args_array=( [d]=database= )
local database local database
# Manage arguments with getopts # Manage arguments with getopts
@ -135,7 +133,6 @@ ynh_mongo_drop_db() {
# #
ynh_mongo_dump_db() { ynh_mongo_dump_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=d
local -A args_array=( [d]=database= ) local -A args_array=( [d]=database= )
local database local database
# Manage arguments with getopts # Manage arguments with getopts
@ -156,7 +153,6 @@ ynh_mongo_dump_db() {
# #
ynh_mongo_create_user() { ynh_mongo_create_user() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=unp
local -A args_array=( [u]=db_user= [n]=db_name= [p]=db_pwd= ) local -A args_array=( [u]=db_user= [n]=db_name= [p]=db_pwd= )
local db_user local db_user
local db_name local db_name
@ -180,7 +176,6 @@ ynh_mongo_create_user() {
# #
ynh_mongo_database_exists() { ynh_mongo_database_exists() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=d
local -A args_array=([d]=database=) local -A args_array=([d]=database=)
local database local database
# Manage arguments with getopts # Manage arguments with getopts
@ -204,7 +199,6 @@ ynh_mongo_database_exists() {
# #
ynh_mongo_restore_db() { ynh_mongo_restore_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=d
local -A args_array=( [d]=database= ) local -A args_array=( [d]=database= )
local database local database
# Manage arguments with getopts # Manage arguments with getopts
@ -224,7 +218,6 @@ ynh_mongo_restore_db() {
# #
ynh_mongo_drop_user() { ynh_mongo_drop_user() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=un
local -A args_array=( [u]=db_user= [n]=db_name= ) local -A args_array=( [u]=db_user= [n]=db_name= )
local db_user local db_user
local db_name local db_name
@ -247,7 +240,6 @@ ynh_mongo_drop_user() {
# #
ynh_mongo_setup_db() { ynh_mongo_setup_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=unp
local -A args_array=( [u]=db_user= [n]=db_name= [p]=db_pwd= ) local -A args_array=( [u]=db_user= [n]=db_name= [p]=db_pwd= )
local db_user local db_user
local db_name local db_name
@ -275,7 +267,6 @@ ynh_mongo_setup_db() {
# #
ynh_mongo_remove_db() { ynh_mongo_remove_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=un
local -A args_array=( [u]=db_user= [n]=db_name= ) local -A args_array=( [u]=db_user= [n]=db_name= )
local db_user local db_user
local db_name local db_name
@ -300,7 +291,6 @@ ynh_mongo_remove_db() {
# #
ynh_install_mongo() { ynh_install_mongo() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=m
local -A args_array=([m]=mongo_version=) local -A args_array=([m]=mongo_version=)
local mongo_version local mongo_version
# Manage arguments with getopts # Manage arguments with getopts
@ -343,7 +333,7 @@ ynh_install_mongo() {
# #
ynh_remove_mongo() { ynh_remove_mongo() {
# Only remove the mongodb service if it is not installed. # Only remove the mongodb service if it is not installed.
if ! ynh_package_is_installed --package="mongodb*" if ! ynh_package_is_installed "mongodb*"
then then
ynh_print_info --message="Removing MongoDB service..." ynh_print_info --message="Removing MongoDB service..."
mongodb_servicename=mongod mongodb_servicename=mongod

View file

@ -64,7 +64,6 @@ ynh_multimedia_build_main_dir() {
ynh_multimedia_addfolder() { ynh_multimedia_addfolder() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=sd
local -A args_array=([s]=source_dir= [d]=dest_dir=) local -A args_array=([s]=source_dir= [d]=dest_dir=)
local source_dir local source_dir
local dest_dir local dest_dir
@ -92,7 +91,6 @@ ynh_multimedia_addfolder() {
# Requires YunoHost version 4.2 or higher. # Requires YunoHost version 4.2 or higher.
ynh_multimedia_addaccess() { ynh_multimedia_addaccess() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=u
declare -Ar args_array=([u]=user_name=) declare -Ar args_array=([u]=user_name=)
local user_name local user_name
# Manage arguments with getopts # Manage arguments with getopts

View file

@ -14,7 +14,6 @@
# Requires YunoHost version 2.2.4 or higher. # Requires YunoHost version 2.2.4 or higher.
ynh_mysql_connect_as() { ynh_mysql_connect_as() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=upd
local -A args_array=([u]=user= [p]=password= [d]=database=) local -A args_array=([u]=user= [p]=password= [d]=database=)
local user local user
local password local password
@ -35,7 +34,6 @@ ynh_mysql_connect_as() {
# Requires YunoHost version 2.2.4 or higher. # Requires YunoHost version 2.2.4 or higher.
ynh_mysql_execute_as_root() { ynh_mysql_execute_as_root() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=sd
local -A args_array=([s]=sql= [d]=database=) local -A args_array=([s]=sql= [d]=database=)
local sql local sql
local database local database
@ -59,7 +57,6 @@ ynh_mysql_execute_as_root() {
# Requires YunoHost version 2.2.4 or higher. # Requires YunoHost version 2.2.4 or higher.
ynh_mysql_execute_file_as_root() { ynh_mysql_execute_file_as_root() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=fd
local -A args_array=([f]=file= [d]=database=) local -A args_array=([f]=file= [d]=database=)
local file local file
local database local database
@ -127,7 +124,6 @@ ynh_mysql_drop_db() {
# Requires YunoHost version 2.2.4 or higher. # Requires YunoHost version 2.2.4 or higher.
ynh_mysql_dump_db() { ynh_mysql_dump_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=d
local -A args_array=([d]=database=) local -A args_array=([d]=database=)
local database local database
# Manage arguments with getopts # Manage arguments with getopts
@ -161,7 +157,6 @@ ynh_mysql_create_user() {
# Requires YunoHost version 2.2.4 or higher. # Requires YunoHost version 2.2.4 or higher.
ynh_mysql_user_exists() { ynh_mysql_user_exists() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=u
local -A args_array=([u]=user=) local -A args_array=([u]=user=)
local user local user
# Manage arguments with getopts # Manage arguments with getopts
@ -201,7 +196,6 @@ ynh_mysql_drop_user() {
# Requires YunoHost version 2.6.4 or higher. # Requires YunoHost version 2.6.4 or higher.
ynh_mysql_setup_db() { ynh_mysql_setup_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=unp
local -A args_array=([u]=db_user= [n]=db_name= [p]=db_pwd=) local -A args_array=([u]=db_user= [n]=db_name= [p]=db_pwd=)
local db_user local db_user
local db_name local db_name
@ -215,7 +209,7 @@ ynh_mysql_setup_db() {
db_pwd="${db_pwd:-$new_db_pwd}" db_pwd="${db_pwd:-$new_db_pwd}"
# Dirty patch for super-legacy apps # Dirty patch for super-legacy apps
dpkg --list | grep -q "^ii mariadb-server" || { ynh_print_warn "Packager: you called ynh_mysql_setup_db without declaring a dependency to mariadb-server. Please add it to your apt dependencies !"; ynh_apt install mariadb-server; } dpkg --list | grep -q "^ii mariadb-server" || { ynh_print_warn --message="Packager: you called ynh_mysql_setup_db without declaring a dependency to mariadb-server. Please add it to your apt dependencies !"; ynh_apt install mariadb-server; }
ynh_mysql_create_db "$db_name" "$db_user" "$db_pwd" ynh_mysql_create_db "$db_name" "$db_user" "$db_pwd"
ynh_app_setting_set --app=$app --key=mysqlpwd --value=$db_pwd ynh_app_setting_set --app=$app --key=mysqlpwd --value=$db_pwd
@ -232,7 +226,6 @@ ynh_mysql_setup_db() {
# Requires YunoHost version 2.6.4 or higher. # Requires YunoHost version 2.6.4 or higher.
ynh_mysql_remove_db() { ynh_mysql_remove_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=un
local -Ar args_array=([u]=db_user= [n]=db_name=) local -Ar args_array=([u]=db_user= [n]=db_name=)
local db_user local db_user
local db_name local db_name

View file

@ -13,7 +13,6 @@
# Requires YunoHost version 2.6.4 or higher. # Requires YunoHost version 2.6.4 or higher.
ynh_find_port() { ynh_find_port() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=p
local -A args_array=([p]=port=) local -A args_array=([p]=port=)
local port local port
# Manage arguments with getopts # Manage arguments with getopts
@ -39,7 +38,6 @@ ynh_find_port() {
# Requires YunoHost version 3.8.0 or higher. # Requires YunoHost version 3.8.0 or higher.
ynh_port_available() { ynh_port_available() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=p
local -A args_array=([p]=port=) local -A args_array=([p]=port=)
local port local port
# Manage arguments with getopts # Manage arguments with getopts
@ -70,7 +68,6 @@ ynh_validate_ip() {
# http://stackoverflow.com/questions/319279/how-to-validate-ip-address-in-python#319298 # http://stackoverflow.com/questions/319279/how-to-validate-ip-address-in-python#319298
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=fi
local -A args_array=([f]=family= [i]=ip_address=) local -A args_array=([f]=family= [i]=ip_address=)
local family local family
local ip_address local ip_address
@ -102,7 +99,6 @@ EOF
# Requires YunoHost version 2.2.4 or higher. # Requires YunoHost version 2.2.4 or higher.
ynh_validate_ip4() { ynh_validate_ip4() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=i
local -A args_array=([i]=ip_address=) local -A args_array=([i]=ip_address=)
local ip_address local ip_address
# Manage arguments with getopts # Manage arguments with getopts
@ -122,7 +118,6 @@ ynh_validate_ip4() {
# Requires YunoHost version 2.2.4 or higher. # Requires YunoHost version 2.2.4 or higher.
ynh_validate_ip6() { ynh_validate_ip6() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=i
local -A args_array=([i]=ip_address=) local -A args_array=([i]=ip_address=)
local ip_address local ip_address
# Manage arguments with getopts # Manage arguments with getopts

View file

@ -95,7 +95,6 @@ ynh_install_nodejs() {
# Use n, https://github.com/tj/n to manage the nodejs versions # Use n, https://github.com/tj/n to manage the nodejs versions
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=n
local -A args_array=([n]=nodejs_version=) local -A args_array=([n]=nodejs_version=)
local nodejs_version local nodejs_version
# Manage arguments with getopts # Manage arguments with getopts

View file

@ -67,7 +67,6 @@
# Requires YunoHost version 3.7.0 or higher. # Requires YunoHost version 3.7.0 or higher.
ynh_permission_create() { ynh_permission_create() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=puAhaltP
local -A args_array=([p]=permission= [u]=url= [A]=additional_urls= [h]=auth_header= [a]=allowed= [l]=label= [t]=show_tile= [P]=protected=) local -A args_array=([p]=permission= [u]=url= [A]=additional_urls= [h]=auth_header= [a]=allowed= [l]=label= [t]=show_tile= [P]=protected=)
local permission local permission
local url local url
@ -155,7 +154,6 @@ ynh_permission_create() {
# Requires YunoHost version 3.7.0 or higher. # Requires YunoHost version 3.7.0 or higher.
ynh_permission_delete() { ynh_permission_delete() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=p
local -A args_array=([p]=permission=) local -A args_array=([p]=permission=)
local permission local permission
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
@ -174,7 +172,6 @@ ynh_permission_delete() {
# Requires YunoHost version 3.7.0 or higher. # Requires YunoHost version 3.7.0 or higher.
ynh_permission_exists() { ynh_permission_exists() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=p
local -A args_array=([p]=permission=) local -A args_array=([p]=permission=)
local permission local permission
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
@ -199,7 +196,6 @@ ynh_permission_exists() {
# Requires YunoHost version 3.7.0 or higher. # Requires YunoHost version 3.7.0 or higher.
ynh_permission_url() { ynh_permission_url() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=puarhc
local -A args_array=([p]=permission= [u]=url= [a]=add_url= [r]=remove_url= [h]=auth_header= [c]=clear_urls) local -A args_array=([p]=permission= [u]=url= [a]=add_url= [r]=remove_url= [h]=auth_header= [c]=clear_urls)
local permission local permission
local url local url
@ -269,7 +265,6 @@ ynh_permission_url() {
# Requires YunoHost version 3.7.0 or higher. # Requires YunoHost version 3.7.0 or higher.
ynh_permission_update() { ynh_permission_update() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=parltP
local -A args_array=([p]=permission= [a]=add= [r]=remove= [l]=label= [t]=show_tile= [P]=protected=) local -A args_array=([p]=permission= [a]=add= [r]=remove= [l]=label= [t]=show_tile= [P]=protected=)
local permission local permission
local add local add
@ -337,7 +332,6 @@ ynh_permission_update() {
# #
# Requires YunoHost version 3.7.1 or higher. # Requires YunoHost version 3.7.1 or higher.
ynh_permission_has_user() { ynh_permission_has_user() {
local legacy_args=pu
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local -A args_array=([p]=permission= [u]=user=) local -A args_array=([p]=permission= [u]=user=)
local permission local permission

View file

@ -70,7 +70,6 @@ YNH_PHP_VERSION=${YNH_PHP_VERSION:-$YNH_DEFAULT_PHP_VERSION}
ynh_add_fpm_config() { ynh_add_fpm_config() {
local _globalphpversion=${phpversion-:} local _globalphpversion=${phpversion-:}
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=vufg
local -A args_array=([v]=phpversion= [u]=usage= [f]=footprint= [g]=group=) local -A args_array=([v]=phpversion= [u]=usage= [f]=footprint= [g]=group=)
local group local group
local phpversion local phpversion
@ -243,7 +242,6 @@ ynh_remove_fpm_config() {
# #
# | arg: -p, --print - Print the result (intended for debug purpose only when packaging the app) # | arg: -p, --print - Print the result (intended for debug purpose only when packaging the app)
ynh_get_scalable_phpfpm() { ynh_get_scalable_phpfpm() {
local legacy_args=ufp
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local -A args_array=([u]=usage= [f]=footprint= [p]=print) local -A args_array=([u]=usage= [f]=footprint= [p]=print)
local usage local usage
@ -376,7 +374,6 @@ YNH_COMPOSER_VERSION=${YNH_COMPOSER_VERSION:-$YNH_DEFAULT_COMPOSER_VERSION}
ynh_composer_exec() { ynh_composer_exec() {
local _globalphpversion=${phpversion-:} local _globalphpversion=${phpversion-:}
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=vwc
declare -Ar args_array=([v]=phpversion= [w]=workdir= [c]=commands=) declare -Ar args_array=([v]=phpversion= [w]=workdir= [c]=commands=)
local phpversion local phpversion
local workdir local workdir
@ -408,7 +405,6 @@ ynh_composer_exec() {
ynh_install_composer() { ynh_install_composer() {
local _globalphpversion=${phpversion-:} local _globalphpversion=${phpversion-:}
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=vwac
declare -Ar args_array=([v]=phpversion= [w]=workdir= [a]=install_args= [c]=composerversion=) declare -Ar args_array=([v]=phpversion= [w]=workdir= [a]=install_args= [c]=composerversion=)
local phpversion local phpversion
local workdir local workdir

View file

@ -17,7 +17,6 @@ PSQL_VERSION=13
# Requires YunoHost version 3.5.0 or higher. # Requires YunoHost version 3.5.0 or higher.
ynh_psql_connect_as() { ynh_psql_connect_as() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=upd
local -A args_array=([u]=user= [p]=password= [d]=database=) local -A args_array=([u]=user= [p]=password= [d]=database=)
local user local user
local password local password
@ -38,7 +37,6 @@ ynh_psql_connect_as() {
# Requires YunoHost version 3.5.0 or higher. # Requires YunoHost version 3.5.0 or higher.
ynh_psql_execute_as_root() { ynh_psql_execute_as_root() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=sd
local -A args_array=([s]=sql= [d]=database=) local -A args_array=([s]=sql= [d]=database=)
local sql local sql
local database local database
@ -63,7 +61,6 @@ ynh_psql_execute_as_root() {
# Requires YunoHost version 3.5.0 or higher. # Requires YunoHost version 3.5.0 or higher.
ynh_psql_execute_file_as_root() { ynh_psql_execute_file_as_root() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=fd
local -A args_array=([f]=file= [d]=database=) local -A args_array=([f]=file= [d]=database=)
local file local file
local database local database
@ -134,7 +131,6 @@ ynh_psql_drop_db() {
# Requires YunoHost version 3.5.0 or higher. # Requires YunoHost version 3.5.0 or higher.
ynh_psql_dump_db() { ynh_psql_dump_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=d
local -A args_array=([d]=database=) local -A args_array=([d]=database=)
local database local database
# Manage arguments with getopts # Manage arguments with getopts
@ -169,7 +165,6 @@ ynh_psql_create_user() {
# Requires YunoHost version 3.5.0 or higher. # Requires YunoHost version 3.5.0 or higher.
ynh_psql_user_exists() { ynh_psql_user_exists() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=u
local -A args_array=([u]=user=) local -A args_array=([u]=user=)
local user local user
# Manage arguments with getopts # Manage arguments with getopts
@ -191,7 +186,6 @@ ynh_psql_user_exists() {
# Requires YunoHost version 3.5.0 or higher. # Requires YunoHost version 3.5.0 or higher.
ynh_psql_database_exists() { ynh_psql_database_exists() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=d
local -A args_array=([d]=database=) local -A args_array=([d]=database=)
local database local database
# Manage arguments with getopts # Manage arguments with getopts
@ -201,7 +195,7 @@ ynh_psql_database_exists() {
# though it could exists. # though it could exists.
if ! command -v psql if ! command -v psql
then then
ynh_print_err -m "PostgreSQL is not installed, impossible to check for db existence." ynh_print_err --message="PostgreSQL is not installed, impossible to check for db existence."
return 1 return 1
elif ! sudo --login --user=postgres PGUSER="postgres" PGPASSWORD="$(cat $PSQL_ROOT_PWD_FILE)" psql -tAc "SELECT datname FROM pg_database WHERE datname='$database';" | grep --quiet "$database"; then elif ! sudo --login --user=postgres PGUSER="postgres" PGPASSWORD="$(cat $PSQL_ROOT_PWD_FILE)" psql -tAc "SELECT datname FROM pg_database WHERE datname='$database';" | grep --quiet "$database"; then
return 1 return 1
@ -237,7 +231,6 @@ ynh_psql_drop_user() {
# Requires YunoHost version 2.7.13 or higher. # Requires YunoHost version 2.7.13 or higher.
ynh_psql_setup_db() { ynh_psql_setup_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=unp
local -A args_array=([u]=db_user= [n]=db_name= [p]=db_pwd=) local -A args_array=([u]=db_user= [n]=db_name= [p]=db_pwd=)
local db_user local db_user
local db_name local db_name
@ -270,7 +263,6 @@ ynh_psql_setup_db() {
# Requires YunoHost version 2.7.13 or higher. # Requires YunoHost version 2.7.13 or higher.
ynh_psql_remove_db() { ynh_psql_remove_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=un
local -A args_array=([u]=db_user= [n]=db_name=) local -A args_array=([u]=db_user= [n]=db_name=)
local db_user local db_user
local db_name local db_name

View file

@ -97,7 +97,6 @@ ynh_use_ruby () {
# Requires YunoHost version 3.2.2 or higher. # Requires YunoHost version 3.2.2 or higher.
ynh_install_ruby () { ynh_install_ruby () {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=v
local -A args_array=( [v]=ruby_version= ) local -A args_array=( [v]=ruby_version= )
local ruby_version local ruby_version
# Manage arguments with getopts # Manage arguments with getopts

View file

@ -10,7 +10,6 @@
ynh_app_setting_get() { ynh_app_setting_get() {
local _globalapp=${app-:} local _globalapp=${app-:}
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=ak
local -A args_array=([a]=app= [k]=key=) local -A args_array=([a]=app= [k]=key=)
local app local app
local key local key
@ -32,7 +31,6 @@ ynh_app_setting_get() {
ynh_app_setting_set() { ynh_app_setting_set() {
local _globalapp=${app-:} local _globalapp=${app-:}
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=akv
local -A args_array=([a]=app= [k]=key= [v]=value=) local -A args_array=([a]=app= [k]=key= [v]=value=)
local app local app
local key local key
@ -54,7 +52,6 @@ ynh_app_setting_set() {
ynh_app_setting_delete() { ynh_app_setting_delete() {
local _globalapp=${app-:} local _globalapp=${app-:}
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=ak
local -A args_array=([a]=app= [k]=key=) local -A args_array=([a]=app= [k]=key=)
local app local app
local key local key
@ -112,7 +109,6 @@ EOF
# Requires YunoHost version 2.6.4 or higher. # Requires YunoHost version 2.6.4 or higher.
ynh_webpath_available() { ynh_webpath_available() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=dp
local -A args_array=([d]=domain= [p]=path_url=) local -A args_array=([d]=domain= [p]=path_url=)
local domain local domain
local path_url local path_url
@ -136,7 +132,6 @@ ynh_webpath_available() {
# Requires YunoHost version 2.6.4 or higher. # Requires YunoHost version 2.6.4 or higher.
ynh_webpath_register() { ynh_webpath_register() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=adp
local -A args_array=([a]=app= [d]=domain= [p]=path_url=) local -A args_array=([a]=app= [d]=domain= [p]=path_url=)
local app local app
local domain local domain

View file

@ -12,7 +12,6 @@
# Requires YunoHost version 2.2.4 or higher. # Requires YunoHost version 2.2.4 or higher.
ynh_string_random() { ynh_string_random() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=lf
local -A args_array=([l]=length= [f]=filter=) local -A args_array=([l]=length= [f]=filter=)
local length local length
local filter local filter
@ -39,7 +38,6 @@ ynh_string_random() {
# Requires YunoHost version 2.6.4 or higher. # Requires YunoHost version 2.6.4 or higher.
ynh_replace_string() { ynh_replace_string() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=mrf
local -A args_array=([m]=match_string= [r]=replace_string= [f]=target_file=) local -A args_array=([m]=match_string= [r]=replace_string= [f]=target_file=)
local match_string local match_string
local replace_string local replace_string
@ -70,7 +68,6 @@ ynh_replace_string() {
# Requires YunoHost version 2.7.7 or higher. # Requires YunoHost version 2.7.7 or higher.
ynh_replace_special_string() { ynh_replace_special_string() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=mrf
local -A args_array=([m]=match_string= [r]=replace_string= [f]=target_file=) local -A args_array=([m]=match_string= [r]=replace_string= [f]=target_file=)
local match_string local match_string
local replace_string local replace_string
@ -104,7 +101,6 @@ ynh_replace_special_string() {
# Requires YunoHost version 2.2.4 or higher. # Requires YunoHost version 2.2.4 or higher.
ynh_sanitize_dbid() { ynh_sanitize_dbid() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=n
local -A args_array=([n]=db_name=) local -A args_array=([n]=db_name=)
local db_name local db_name
# Manage arguments with getopts # Manage arguments with getopts
@ -134,7 +130,6 @@ ynh_sanitize_dbid() {
# Requires YunoHost version 2.6.4 or higher. # Requires YunoHost version 2.6.4 or higher.
ynh_normalize_url_path() { ynh_normalize_url_path() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=p
local -A args_array=([p]=path_url=) local -A args_array=([p]=path_url=)
local path_url local path_url
# Manage arguments with getopts # Manage arguments with getopts

View file

@ -14,7 +14,6 @@
# Requires YunoHost version 4.1.0 or higher. # Requires YunoHost version 4.1.0 or higher.
ynh_add_systemd_config() { ynh_add_systemd_config() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=stv
local -A args_array=([s]=service= [t]=template=) local -A args_array=([s]=service= [t]=template=)
local service local service
local template local template
@ -37,7 +36,6 @@ ynh_add_systemd_config() {
# Requires YunoHost version 2.7.2 or higher. # Requires YunoHost version 2.7.2 or higher.
ynh_remove_systemd_config() { ynh_remove_systemd_config() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=s
local -A args_array=([s]=service=) local -A args_array=([s]=service=)
local service local service
# Manage arguments with getopts # Manage arguments with getopts
@ -66,7 +64,6 @@ ynh_remove_systemd_config() {
# Requires YunoHost version 3.5.0 or higher. # Requires YunoHost version 3.5.0 or higher.
ynh_systemd_action() { ynh_systemd_action() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=nalpte
local -A args_array=([n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length=) local -A args_array=([n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length=)
local service_name local service_name
local action local action

View file

@ -11,7 +11,6 @@
# Requires YunoHost version 2.2.4 or higher. # Requires YunoHost version 2.2.4 or higher.
ynh_user_exists() { ynh_user_exists() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=u
local -A args_array=([u]=username=) local -A args_array=([u]=username=)
local username local username
# Manage arguments with getopts # Manage arguments with getopts
@ -32,7 +31,6 @@ ynh_user_exists() {
# Requires YunoHost version 2.2.4 or higher. # Requires YunoHost version 2.2.4 or higher.
ynh_user_get_info() { ynh_user_get_info() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=uk
local -A args_array=([u]=username= [k]=key=) local -A args_array=([u]=username= [k]=key=)
local username local username
local key local key
@ -65,7 +63,6 @@ ynh_user_list() {
# Requires YunoHost version 2.2.4 or higher. # Requires YunoHost version 2.2.4 or higher.
ynh_system_user_exists() { ynh_system_user_exists() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=u
local -A args_array=([u]=username=) local -A args_array=([u]=username=)
local username local username
# Manage arguments with getopts # Manage arguments with getopts
@ -85,7 +82,6 @@ ynh_system_user_exists() {
# Requires YunoHost version 3.5.0.2 or higher. # Requires YunoHost version 3.5.0.2 or higher.
ynh_system_group_exists() { ynh_system_group_exists() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=g
local -A args_array=([g]=group=) local -A args_array=([g]=group=)
local group local group
# Manage arguments with getopts # Manage arguments with getopts
@ -116,7 +112,6 @@ ynh_system_group_exists() {
# Requires YunoHost version 2.6.4 or higher. # Requires YunoHost version 2.6.4 or higher.
ynh_system_user_create() { ynh_system_user_create() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=uhs
local -A args_array=([u]=username= [h]=home_dir= [s]=use_shell [g]=groups=) local -A args_array=([u]=username= [h]=home_dir= [s]=use_shell [g]=groups=)
local username local username
local home_dir local home_dir
@ -129,7 +124,7 @@ ynh_system_user_create() {
home_dir="${home_dir:-}" home_dir="${home_dir:-}"
groups="${groups:-}" groups="${groups:-}"
if ! ynh_system_user_exists "$username"; then # Check if the user exists on the system if ! ynh_system_user_exists --username="$username"; then # Check if the user exists on the system
# If the user doesn't exist # If the user doesn't exist
if [ -n "$home_dir" ]; then # If a home dir is mentioned if [ -n "$home_dir" ]; then # If a home dir is mentioned
local user_home_dir="--home-dir $home_dir" local user_home_dir="--home-dir $home_dir"
@ -160,21 +155,20 @@ ynh_system_user_create() {
# Requires YunoHost version 2.6.4 or higher. # Requires YunoHost version 2.6.4 or higher.
ynh_system_user_delete() { ynh_system_user_delete() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=u
local -A args_array=([u]=username=) local -A args_array=([u]=username=)
local username local username
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
# Check if the user exists on the system # Check if the user exists on the system
if ynh_system_user_exists "$username"; then if ynh_system_user_exists --username="$username"; then
deluser $username deluser $username
else else
ynh_print_warn --message="The user $username was not found" ynh_print_warn --message="The user $username was not found"
fi fi
# Check if the group exists on the system # Check if the group exists on the system
if ynh_system_group_exists "$username"; then if ynh_system_group_exists --group="$username"; then
delgroup $username delgroup $username
fi fi
} }

View file

@ -155,7 +155,6 @@ fi
# Requires YunoHost version 2.6.4 or higher. # Requires YunoHost version 2.6.4 or higher.
ynh_setup_source() { ynh_setup_source() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=dsk
local -A args_array=([d]=dest_dir= [s]=source_id= [k]=keep= [r]=full_replace=) local -A args_array=([d]=dest_dir= [s]=source_id= [k]=keep= [r]=full_replace=)
local dest_dir local dest_dir
local source_id local source_id
@ -186,8 +185,8 @@ ynh_setup_source() {
local src_platform="$(jq -r ".platform" <<< "$sources_json" | sed 's/^null$//')" local src_platform="$(jq -r ".platform" <<< "$sources_json" | sed 's/^null$//')"
local src_rename="$(jq -r ".rename" <<< "$sources_json" | sed 's/^null$//')" local src_rename="$(jq -r ".rename" <<< "$sources_json" | sed 's/^null$//')"
[[ -n "$src_url" ]] || ynh_die "No URL defined for source $source_id$arch_prefix ?" [[ -n "$src_url" ]] || ynh_die --message="No URL defined for source $source_id$arch_prefix ?"
[[ -n "$src_sum" ]] || ynh_die "No sha256 sum defined for source $source_id$arch_prefix ?" [[ -n "$src_sum" ]] || ynh_die --message="No sha256 sum defined for source $source_id$arch_prefix ?"
if [[ -z "$src_format" ]] if [[ -z "$src_format" ]]
then then
@ -233,7 +232,7 @@ ynh_setup_source() {
if [[ "$src_extract" != "true" ]] && [[ "$src_extract" != "false" ]] if [[ "$src_extract" != "true" ]] && [[ "$src_extract" != "false" ]]
then then
ynh_die "For source $source_id, expected either 'true' or 'false' for the extract parameter" ynh_die --message="For source $source_id, expected either 'true' or 'false' for the extract parameter"
fi fi
@ -251,7 +250,7 @@ ynh_setup_source() {
cp $local_src $src_filename cp $local_src $src_filename
fi fi
[ -n "$src_url" ] || ynh_die "Couldn't parse SOURCE_URL from $src_file_path ?" [ -n "$src_url" ] || ynh_die --message="Couldn't parse SOURCE_URL from $src_file_path ?"
# If the file was prefetched but somehow doesn't match the sum, rm and redownload it # If the file was prefetched but somehow doesn't match the sum, rm and redownload it
if [ -e "$src_filename" ] && ! echo "${src_sum} ${src_filename}" | ${src_sumprg} --check --status if [ -e "$src_filename" ] && ! echo "${src_sum} ${src_filename}" | ${src_sumprg} --check --status
@ -436,14 +435,14 @@ ynh_local_curl() {
# Temporarily enable visitors if needed... # Temporarily enable visitors if needed...
local visitors_enabled=$(ynh_permission_has_user "main" "visitors" && echo yes || echo no) local visitors_enabled=$(ynh_permission_has_user "main" "visitors" && echo yes || echo no)
if [[ $visitors_enabled == "no" ]]; then if [[ $visitors_enabled == "no" ]]; then
ynh_permission_update --permission "main" --add "visitors" ynh_permission_update --permission="main" --add="visitors"
fi fi
# Curl the URL # Curl the URL
curl --silent --show-error --insecure --location --header "Host: $domain" --resolve $domain:443:127.0.0.1 $POST_data "$full_page_url" --cookie-jar $cookiefile --cookie $cookiefile curl --silent --show-error --insecure --location --header "Host: $domain" --resolve $domain:443:127.0.0.1 $POST_data "$full_page_url" --cookie-jar $cookiefile --cookie $cookiefile
if [[ $visitors_enabled == "no" ]]; then if [[ $visitors_enabled == "no" ]]; then
ynh_permission_update --permission "main" --remove "visitors" ynh_permission_update --permission="main" --remove="visitors"
fi fi
} }
@ -489,7 +488,6 @@ ynh_local_curl() {
# Requires YunoHost version 4.1.0 or higher. # Requires YunoHost version 4.1.0 or higher.
ynh_add_config() { ynh_add_config() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=tdv
local -A args_array=([t]=template= [d]=destination=) local -A args_array=([t]=template= [d]=destination=)
local template local template
local destination local destination
@ -550,7 +548,6 @@ ynh_add_config() {
# Requires YunoHost version 4.1.0 or higher. # Requires YunoHost version 4.1.0 or higher.
ynh_replace_vars() { ynh_replace_vars() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=f
local -A args_array=([f]=file=) local -A args_array=([f]=file=)
local file local file
# Manage arguments with getopts # Manage arguments with getopts
@ -647,7 +644,6 @@ ynh_replace_vars() {
# Requires YunoHost version 4.3 or higher. # Requires YunoHost version 4.3 or higher.
ynh_read_var_in_file() { ynh_read_var_in_file() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=fka
local -A args_array=([f]=file= [k]=key= [a]=after=) local -A args_array=([f]=file= [k]=key= [a]=after=)
local file local file
local key local key
@ -725,7 +721,6 @@ ynh_read_var_in_file() {
# Requires YunoHost version 4.3 or higher. # Requires YunoHost version 4.3 or higher.
ynh_write_var_in_file() { ynh_write_var_in_file() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=fkva
local -A args_array=([f]=file= [k]=key= [v]=value= [a]=after=) local -A args_array=([f]=file= [k]=key= [v]=value= [a]=after=)
local file local file
local key local key
@ -873,7 +868,6 @@ _acceptable_path_to_delete() {
# Requires YunoHost version 2.6.4 or higher. # Requires YunoHost version 2.6.4 or higher.
ynh_secure_remove() { ynh_secure_remove() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=f
local -A args_array=([f]=file=) local -A args_array=([f]=file=)
local file local file
# Manage arguments with getopts # Manage arguments with getopts
@ -907,7 +901,6 @@ ynh_secure_remove() {
# Requires YunoHost version 3.5.0 or higher. # Requires YunoHost version 3.5.0 or higher.
ynh_read_manifest() { ynh_read_manifest() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=mk
local -A args_array=([m]=manifest= [k]=manifest_key=) local -A args_array=([m]=manifest= [k]=manifest_key=)
local manifest local manifest
local manifest_key local manifest_key
@ -923,7 +916,7 @@ ynh_read_manifest() {
then then
manifest="$YNH_APP_BASEDIR/manifest.toml" manifest="$YNH_APP_BASEDIR/manifest.toml"
else else
ynh_die --message "No manifest found !?" ynh_die --message="No manifest found !?"
fi fi
fi fi
@ -950,7 +943,6 @@ ynh_read_manifest() {
# Requires YunoHost version 3.5.0 or higher. # Requires YunoHost version 3.5.0 or higher.
ynh_app_upstream_version() { ynh_app_upstream_version() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=m
local -A args_array=([m]=manifest=) local -A args_array=([m]=manifest=)
local manifest local manifest
# Manage arguments with getopts # Manage arguments with getopts
@ -981,7 +973,6 @@ ynh_app_upstream_version() {
# Requires YunoHost version 3.5.0 or higher. # Requires YunoHost version 3.5.0 or higher.
ynh_app_package_version() { ynh_app_package_version() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=m
local -A args_array=([m]=manifest=) local -A args_array=([m]=manifest=)
local manifest local manifest
# Manage arguments with getopts # Manage arguments with getopts
@ -1031,7 +1022,6 @@ ynh_check_app_version_changed() {
# #
# Requires YunoHost version 3.8.0 or higher. # Requires YunoHost version 3.8.0 or higher.
ynh_compare_current_package_version() { ynh_compare_current_package_version() {
local legacy_args=cv
declare -Ar args_array=([c]=comparison= [v]=version=) declare -Ar args_array=([c]=comparison= [v]=version=)
local version local version
local comparison local comparison
@ -1077,7 +1067,7 @@ _ynh_apply_default_permissions() {
chmod o-rwx $target chmod o-rwx $target
chmod g-w $target chmod g-w $target
chown -R root:root $target chown -R root:root $target
if ynh_system_user_exists $app; then if ynh_system_user_exists --username=$app; then
chown $app:$app $target chown $app:$app $target
fi fi