From 9549a8d5424c85c20ffe97ee1fb4289bb8bf9c1e Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Wed, 17 Jan 2024 01:43:15 +0100 Subject: [PATCH] quoting vars --- scripts/change_url | 6 +++--- scripts/install | 14 +++++++------- scripts/remove | 4 ++-- scripts/restore | 10 +++++----- scripts/upgrade | 18 +++++++++--------- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 0339ec5..5df6755 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" +ynh_systemd_action --service_name="$app" --action="stop" #================================================= # MODIFY URL IN NGINX CONF @@ -36,7 +36,7 @@ domain=$new_domain ynh_add_config --template="../conf/config.js" --destination="$install_dir/server/config.js" chmod 400 "$install_dir/server/config.js" -chown $app:$app "$install_dir/server/config.js" +chown "$app:$app" "$install_dir/server/config.js" #================================================= # GENERIC FINALISATION @@ -46,7 +46,7 @@ chown $app:$app "$install_dir/server/config.js" ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index f830ed4..aedf981 100644 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Installing dependencies..." --weight=20 -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version" #================================================= # CREATE A REDIS DATABASE @@ -34,7 +34,7 @@ ynh_script_progression --message="Setting up source files..." --weight=2 ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" chmod +x "$install_dir/server/bin/prod.js" #================================================= @@ -49,7 +49,7 @@ env_path="$PATH" # Create a dedicated systemd config ynh_add_systemd_config -yunohost service add $app --description="Simple, private file sharing" --log="/var/log/$app/$app.log" +yunohost service add "$app" --description="Simple, private file sharing" --log="/var/log/$app/$app.log" #================================================= # ADD A CONFIGURATION @@ -59,7 +59,7 @@ ynh_script_progression --message="Adding a configuration file..." --weight=2 ynh_add_config --template="config.js" --destination="$install_dir/server/config.js" chmod 400 "$install_dir/server/config.js" -chown $app: "$install_dir/server/config.js" +chown "$app:" "$install_dir/server/config.js" #================================================= # SPECIFIC SETUP @@ -70,8 +70,8 @@ ynh_script_progression --message="Building app... (this will take some time and pushd "$install_dir" ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build + ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" install + ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run build popd #================================================= @@ -80,7 +80,7 @@ popd ynh_script_progression --message="Starting a systemd service..." --weight=2 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 9846aba..c5feb91 100644 --- a/scripts/remove +++ b/scripts/remove @@ -16,10 +16,10 @@ source /usr/share/yunohost/helpers #================================================= # 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=1 - yunohost service remove $app + yunohost service remove "$app" fi # Remove the dedicated systemd config diff --git a/scripts/restore b/scripts/restore index 49895c4..7f0a5b5 100644 --- 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" chmod +x "$install_dir/server/bin/prod.js" #================================================= @@ -28,21 +28,21 @@ chmod +x "$install_dir/server/bin/prod.js" #================================================= ynh_script_progression --message="Reinstalling dependencies..." --weight=7 -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet +systemctl enable "$app.service" --quiet -yunohost service add $app --description="Simple, private file sharing" --log="/var/log/$app/$app.log" +yunohost service add "$app" --description="Simple, private file sharing" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index b667c3d..dce977e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,7 +22,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -40,11 +40,11 @@ then ynh_script_progression --message="Upgrading source files..." --weight=10 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir=$install_dir --keep="server/config.js" + ynh_setup_source --dest_dir="$install_dir" --keep="server/config.js" fi chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" chmod +x "$install_dir/server/bin/prod.js" #================================================= @@ -52,7 +52,7 @@ chmod +x "$install_dir/server/bin/prod.js" #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=18 -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version" #================================================= # NGINX CONFIGURATION @@ -66,7 +66,7 @@ env_path="$PATH" # Create a dedicated systemd config ynh_add_systemd_config -yunohost service add $app --description="Simple, private file sharing" --log="/var/log/$app/$app.log" +yunohost service add "$app" --description="Simple, private file sharing" --log="/var/log/$app/$app.log" #================================================= # UPDATE A CONFIG FILE @@ -76,7 +76,7 @@ ynh_script_progression --message="Updating a configuration file..." ynh_add_config --template="config.js" --destination="$install_dir/server/config.js" chmod 400 "$install_dir/server/config.js" -chown $app: "$install_dir/server/config.js" +chown "$app:" "$install_dir/server/config.js" #================================================= # SPECIFIC UPGRADE @@ -90,8 +90,8 @@ then pushd "$install_dir" ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build + ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" install + ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run build popd fi @@ -100,7 +100,7 @@ fi #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" #================================================= # END OF SCRIPT