diff --git a/scripts/_common.sh b/scripts/_common.sh index 2b3762c..e59c7f7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -149,7 +149,7 @@ EOF # Used by update_config_if_needed.sh hook save_vars_current_value() { for var in $var_list_to_manage; do - ynh_app_setting_set --app="$app" --key=previous_$var --value="${!var}" + ynh_app_setting_set --app="$app" --key="previous_$var" --value="${!var}" done } diff --git a/scripts/backup b/scripts/backup index 02e89fd..d48d15c 100755 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,7 @@ load_vars #================================================= # STOP SYSTEMD SERVICE #================================================= -if systemctl is-active $app.service --quiet; then +if systemctl is-active "$app".service --quiet; then ynh_print_warn --message="It's highly recommended to make your backup when the service is stopped. Please stop $app service with this command before to run the backup 'systemctl stop $app.service'" fi @@ -33,7 +33,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="$nginx_status_conf" ynh_print_info --message="Backing up code..." -ynh_backup --src_path=$install_dir +ynh_backup --src_path="$install_dir" #================================================= # SPECIFIC BACKUP diff --git a/scripts/change_url b/scripts/change_url index 8e33286..5048134 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -18,7 +18,7 @@ load_vars #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # MODIFY URL IN NGINX CONF diff --git a/scripts/install b/scripts/install index 16ba4fe..bb84c97 100755 --- a/scripts/install +++ b/scripts/install @@ -17,10 +17,10 @@ ensure_vars_set # Check datadir empty #================================================= -if [ -n "$(ls -A $data_dir)" ]; then +if [ -n "$(ls -A "$data_dir")" ]; then old_data_dir_path="${data_dir}_$(date '+%Y%m%d.%H%M%S')" ynh_print_warn --message="Data directory was not empty. Data was moved to $old_data_dir_path" - mkdir -p $old_data_dir_path + mkdir -p "$old_data_dir_path" mv -t "$old_data_dir_path" "$data_dir"/* app_data_dirs="$(echo /home/yunohost.app/*)" fi diff --git a/scripts/remove b/scripts/remove index 5204395..bd84296 100755 --- a/scripts/remove +++ b/scripts/remove @@ -18,7 +18,7 @@ load_vars #================================================= # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null +if ynh_exec_warn_less yunohost service status "$app" >/dev/null then ynh_script_progression --message="Removing $app service integration..." --weight=3 yunohost service remove "$app" @@ -48,11 +48,11 @@ for pool_dir_by_version in /etc/php/*; do fi done -if ynh_psql_user_exists --user=$db_user; then - ynh_psql_drop_user $db_user +if ynh_psql_user_exists --user="$db_user"; then + ynh_psql_drop_user "$db_user" fi -if ynh_mysql_user_exists --user=$db_user; then - ynh_mysql_drop_user $db_user +if ynh_mysql_user_exists --user="$db_user"; then + ynh_mysql_drop_user "$db_user" fi ynh_package_autopurge monitorix diff --git a/scripts/upgrade b/scripts/upgrade index e051fa3..5984372 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -11,7 +11,7 @@ source experimental_helper.sh source /usr/share/yunohost/helpers load_vars -upgrade_type=$(ynh_check_app_version_changed) +upgrade_type="$(ynh_check_app_version_changed)" #================================================= # STANDARD UPGRADE STEPS @@ -30,14 +30,14 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 test -e /etc/monitorix/conf.d/00-debian.conf || touch /etc/monitorix/conf.d/00-debian.conf # Remove old hook if exist -ynh_secure_remove --file=/usr/share/yunohost/hooks/post_iptable_rules/50-$app +ynh_secure_remove --file=/usr/share/yunohost/hooks/post_iptable_rules/50-"$app" #================================================= # STOP SYSTEMD SERVICE #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action=stop --log_path="/var/log/$app/$app.log" #================================================= # "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)