From 6830760bf54a58eb4f0ba55dacc8fb74d65da821 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Wed, 1 Nov 2023 03:45:41 +0100 Subject: [PATCH] fix SC2086 linter alerts --- scripts/change_url | 2 +- scripts/config | 12 ++++++------ scripts/install | 12 ++++++------ scripts/restore | 6 +++--- scripts/upgrade | 18 +++++++++--------- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 84fc887..b737c17 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,7 +24,7 @@ ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_add_config --template="application.ini" --destination="$install_dir/app/data/_data_/_default_/configs/application.ini" chmod 400 "$install_dir/app/data/_data_/_default_/configs/application.ini" -chown $app:$app "$install_dir/app/data/_data_/_default_/configs/application.ini" +chown "$app":"$app" "$install_dir/app/data/_data_/_default_/configs/application.ini" #================================================= # SETUP SSO diff --git a/scripts/config b/scripts/config index 91c2de7..06f34e2 100644 --- a/scripts/config +++ b/scripts/config @@ -15,8 +15,8 @@ ynh_abort_if_errors # RETRIEVE ARGUMENTS #================================================= -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) +phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) +current_fpm_footprint=$(ynh_app_setting_get --app="$app" --key=fpm_footprint) #================================================= # SPECIFIC GETTERS FOR TOML SHORT KEY @@ -52,14 +52,14 @@ get__free_footprint() { set__fpm_footprint() { if [ "$fpm_footprint" != "specific" ] then - ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint" + ynh_app_setting_set --app="$app" --key=fpm_footprint --value="$fpm_footprint" fi } set__fpm_free_footprint() { if [ "$fpm_footprint" = "specific" ] then - ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_free_footprint" + ynh_app_setting_set --app="$app" --key=fpm_footprint --value="$fpm_free_footprint" fi } @@ -89,7 +89,7 @@ ynh_app_config_validate() { ynh_app_config_apply() { _ynh_app_config_apply - ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint + ynh_add_fpm_config --phpversion="$phpversion" --usage="$fpm_usage" --footprint="$fpm_footprint" } -ynh_app_config_run $1 +ynh_app_config_run "$1" diff --git a/scripts/install b/scripts/install index f1ed103..54e9353 100755 --- a/scripts/install +++ b/scripts/install @@ -21,9 +21,9 @@ fpm_usage="low" # STORE SETTINGS FROM MANIFEST #================================================= -ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint -ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint -ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage +ynh_app_setting_set --app="$app" --key=fpm_footprint --value=$fpm_footprint +ynh_app_setting_set --app="$app" --key=fpm_free_footprint --value=$fpm_free_footprint +ynh_app_setting_set --app="$app" --key=fpm_usage --value=$fpm_usage #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -34,7 +34,7 @@ ynh_script_progression --message="Setting up source files..." --weight=3 ynh_setup_source --dest_dir="$install_dir/app" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app":www-data "$install_dir" #================================================= # SYSTEM CONFIGURATION @@ -58,12 +58,12 @@ ynh_use_logrotate ynh_script_progression --message="Adding a configuration file..." --weight=1 mkdir -p "$install_dir/app/data/_data_/_default_/configs" -chown $app:$app -R "$install_dir/app/data/_data_" +chown "$app":"$app" -R "$install_dir/app/data/_data_" ynh_add_config --template="application.ini" --destination="$install_dir/app/data/_data_/_default_/configs/application.ini" chmod 600 "$install_dir/app/data/_data_/_default_/configs/application.ini" -chown $app:$app "$install_dir/app/data/_data_/_default_/configs/application.ini" +chown "$app":"$app" "$install_dir/app/data/_data_/_default_/configs/application.ini" #================================================= # SETUP SSO diff --git a/scripts/restore b/scripts/restore index 797fa49..d62a702 100755 --- a/scripts/restore +++ b/scripts/restore @@ -18,7 +18,7 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app":www-data "$install_dir" #================================================= # RESTORE SYSTEM CONFIGURATIONS @@ -26,7 +26,7 @@ chown -R $app:www-data "$install_dir" ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=4 ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion +ynh_add_fpm_config --usage="$fpm_usage" --footprint="$fpm_footprint" --phpversion="$phpversion" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -39,7 +39,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload +ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 73f3a12..36f34fe 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,19 +23,19 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # If fpm_footprint doesn't exist, create it if [ -z "${fpm_footprint:-}" ]; then fpm_footprint=low - ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint + ynh_app_setting_set --app="$app" --key=fpm_footprint --value=$fpm_footprint fi # If fpm_free_footprint doesn't exist, create it if [ -z "${fpm_free_footprint:-}" ]; then fpm_free_footprint=0 - ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint + ynh_app_setting_set --app="$app" --key=fpm_free_footprint --value=$fpm_free_footprint fi # If fpm_usage doesn't exist, create it if [ -z "${fpm_usage:-}" ]; then fpm_usage=low - ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage + ynh_app_setting_set --app="$app" --key=fpm_usage --value=$fpm_usage fi # Do something when upgrading from 2.3.2~ynh1 or lower @@ -43,10 +43,10 @@ if ynh_compare_current_package_version --comparison le --version 2.28.4~ynh1 then # Move everything inside a $install_dir/app/ subfolder # This allows to have a $install_dir/index.php handling the SSO - mkdir -p $install_dir/app + mkdir -p "$install_dir/app" # Ugly way to not return an error when moving everything to a subfolter of the same folder https://stackoverflow.com/a/43262922 - find $install_dir -maxdepth 1 -mindepth 1 -not -name app -exec mv -t $install_dir/app {} + - chown $app:root $install_dir/app/ + find "$install_dir" -maxdepth 1 -mindepth 1 -not -name app -exec mv -t "$install_dir/app" {} + + chown "$app":root "$install_dir/app/" fi #================================================= @@ -62,7 +62,7 @@ then fi chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app":www-data "$install_dir" #================================================= # REAPPLY SYSTEM CONFIGURATIONS @@ -70,7 +70,7 @@ chown -R $app:www-data "$install_dir" ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=5 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint +ynh_add_fpm_config --phpversion="$phpversion" --usage="$fpm_usage" --footprint="$fpm_footprint" # Create a dedicated NGINX config ynh_add_nginx_config @@ -88,7 +88,7 @@ ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_add_config --template="application.ini" --destination="$install_dir/app/data/_data_/_default_/configs/application.ini" chmod 600 "$install_dir/app/data/_data_/_default_/configs/application.ini" -chown $app:$app "$install_dir/app/data/_data_/_default_/configs/application.ini" +chown "$app":"$app" "$install_dir/app/data/_data_/_default_/configs/application.ini" #================================================= # SETUP SSO