From 52776a0e133018c1ee0c94ea34cf59a0ac06547d Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Mon, 12 Feb 2024 21:48:29 +0100 Subject: [PATCH] SC2154 fixes --- scripts/config | 12 ++++++------ scripts/install | 32 ++++++++++++++++---------------- scripts/restore | 10 +++++----- scripts/upgrade | 24 ++++++++++++------------ 4 files changed, 39 insertions(+), 39 deletions(-) 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 ee5bbaf..e6e476e 100755 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,7 @@ timezone="$(cat /etc/timezone)" ynh_script_progression --message="Installing dependencies..." --weight=7 # Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -33,9 +33,9 @@ ynh_setup_source --dest_dir="$install_dir" chmod 750 "$install_dir/bootstrap/cache" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" -chown -R $app: "$install_dir/public/sym/" -chmod -R 755 $data_dir +chown -R "$app:www-data" "$install_dir" +chown -R "$app:" "$install_dir/public/sym/" +chmod -R 755 "$data_dir" #================================================= # PHP-FPM CONFIGURATION @@ -55,8 +55,8 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Creating a data directory..." --weight=1 -chgrp $app -R $install_dir/storage $install_dir/public/dist $install_dir/public/sym $data_dir/uploads -chmod -R 2775 $install_dir/storage/* $install_dir/app/* $install_dir/public/dist $install_dir/public/sym $data_dir/uploads $install_dir/bootstrap/ +chgrp "$app" -R "$install_dir/storage" "$install_dir/public/dist" "$install_dir/public/sym" "$data_dir/uploads" +chmod -R 2775 "$install_dir/storage/*" "$install_dir/app/*" "$install_dir/public/dist" "$install_dir/public/sym" "$data_dir/uploads" "$install_dir/bootstrap/" #================================================= # INSTALL APP WITH COMPOSER @@ -70,10 +70,10 @@ ynh_install_composer #================================================= ynh_script_progression --message="Installing $app..." --weight=10 -pushd $install_dir +pushd "$install_dir" ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production $ynh_npm run build + ynh_exec_warn_less sudo -u "$app" env "$ynh_node_load_PATH" "$ynh_npm" install + ynh_exec_warn_less sudo -u "$app" env "$ynh_node_load_PATH" NODE_ENV=production "$ynh_npm" run build popd #================================================= @@ -84,24 +84,24 @@ ynh_script_progression --message="Adding a configuration file..." ynh_add_config --template=".env.example" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" -chown $app:$app "$install_dir/.env" +chown "$app:$app" "$install_dir/.env" #================================================= # BUILDING #================================================= ynh_script_progression --message="Building..." --weight=10 -pushd $install_dir - php$phpversion artisan key:generate -n --force --env - php$phpversion artisan migrate -n --force - php$phpversion artisan config:clear -n - php$phpversion artisan config:cache -n +pushd "$install_dir" + "php$phpversion" artisan key:generate -n --force --env + "php$phpversion" artisan migrate -n --force + "php$phpversion" artisan config:clear -n + "php$phpversion" artisan config:cache -n popd chmod 750 "$install_dir" chmod 750 "$install_dir/bootstrap/cache" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 58a28a6..d96cfa4 100755 --- a/scripts/restore +++ b/scripts/restore @@ -19,7 +19,7 @@ ynh_restore_file --origin_path="$install_dir" chmod 750 "$install_dir/bootstrap/cache" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # RESTORE THE DATA DIRECTORY @@ -28,7 +28,7 @@ ynh_script_progression --message="Restoring the data directory..." ynh_restore_file --origin_path="$data_dir" --not_mandatory -chown -R $app:www-data "$data_dir" +chown -R "$app:www-data" "$data_dir" #================================================= # REINSTALL DEPENDENCIES @@ -36,7 +36,7 @@ chown -R $app:www-data "$data_dir" ynh_script_progression --message="Reinstalling dependencies..." --weight=7 # Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version" #================================================= # RESTORE THE PHP-FPM CONFIGURATION @@ -50,7 +50,7 @@ ynh_add_fpm_config ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql #================================================= # GENERIC FINALIZATION @@ -59,7 +59,7 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./ #================================================= ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." -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 89d24cb..3a59c6d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -31,7 +31,7 @@ fi chmod 750 "$install_dir/bootstrap/cache" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # UPGRADE DEPENDENCIES @@ -39,7 +39,7 @@ chown -R $app:www-data "$install_dir" ynh_script_progression --message="Upgrading dependencies..." --weight=5 # Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version" #================================================= # PHP-FPM CONFIGURATION @@ -62,7 +62,7 @@ ynh_script_progression --message="Updating a configuration file..." ynh_add_config --template=".env.example" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" -chown $app:$app "$install_dir/.env" +chown "$app:$app" "$install_dir/.env" #================================================= # INSTALL APP WITH COMPOSER @@ -76,10 +76,10 @@ ynh_install_composer #================================================= ynh_script_progression --message="Installing $app..." --weight=10 -pushd $install_dir +pushd "$install_dir" ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production $ynh_npm run build + ynh_exec_warn_less sudo -u "$app" env "$ynh_node_load_PATH" "$ynh_npm" install + ynh_exec_warn_less sudo -u "$app" env "$ynh_node_load_PATH" NODE_ENV=production "$ynh_npm" run build popd #================================================= @@ -89,17 +89,17 @@ ynh_script_progression --message="Building..." --weight=4 ynh_exec_warn_less ynh_composer_exec --commands="dump-autoload" -pushd $install_dir - php$phpversion artisan migrate -n --force - php$phpversion artisan config:clear -n - php$phpversion artisan config:cache -n - php$phpversion artisan view:clear +pushd "$install_dir" + "php$phpversion" artisan migrate -n --force + "php$phpversion" artisan config:clear -n + "php$phpversion" artisan config:cache -n + "php$phpversion" artisan view:clear popd chmod 750 "$install_dir" chmod 750 "$install_dir/bootstrap/cache" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # END OF SCRIPT