quoting vars

This commit is contained in:
OniriCorpe 2024-01-17 01:43:15 +01:00
parent b11796f663
commit 9549a8d542
5 changed files with 26 additions and 26 deletions

View File

@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 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 # 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" ynh_add_config --template="../conf/config.js" --destination="$install_dir/server/config.js"
chmod 400 "$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 # GENERIC FINALISATION
@ -46,7 +46,7 @@ chown $app:$app "$install_dir/server/config.js"
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service # 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 # END OF SCRIPT

View File

@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=20 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 # 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" ynh_setup_source --dest_dir="$install_dir"
chmod -R o-rwx "$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" chmod +x "$install_dir/server/bin/prod.js"
#================================================= #=================================================
@ -49,7 +49,7 @@ env_path="$PATH"
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_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 # 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" ynh_add_config --template="config.js" --destination="$install_dir/server/config.js"
chmod 400 "$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 # SPECIFIC SETUP
@ -70,8 +70,8 @@ ynh_script_progression --message="Building app... (this will take some time and
pushd "$install_dir" pushd "$install_dir"
ynh_use_nodejs 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" 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" run build
popd popd
#================================================= #=================================================
@ -80,7 +80,7 @@ popd
ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service # 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 # END OF SCRIPT

View File

@ -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`) # 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 then
ynh_script_progression --message="Removing $app service integration..." --weight=1 ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app yunohost service remove "$app"
fi fi
# Remove the dedicated systemd config # Remove the dedicated systemd config

View File

@ -18,7 +18,7 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir" ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$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" 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_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/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" 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 # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 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 ynh_systemd_action --service_name=nginx --action=reload

View File

@ -22,7 +22,7 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 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 # ENSURE DOWNWARD COMPATIBILITY
@ -40,11 +40,11 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=10 ynh_script_progression --message="Upgrading source files..." --weight=10
# Download, check integrity, uncompress and patch the source from app.src # 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 fi
chmod -R o-rwx "$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" 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_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 # NGINX CONFIGURATION
@ -66,7 +66,7 @@ env_path="$PATH"
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_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 # 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" ynh_add_config --template="config.js" --destination="$install_dir/server/config.js"
chmod 400 "$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 # SPECIFIC UPGRADE
@ -90,8 +90,8 @@ then
pushd "$install_dir" pushd "$install_dir"
ynh_use_nodejs 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" 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" run build
popd popd
fi fi
@ -100,7 +100,7 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 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 # END OF SCRIPT