From 0364348fd4b2e08eeae48105a84ad0870ea21deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 18 Oct 2023 15:32:45 +0200 Subject: [PATCH] cleaning --- scripts/backup | 2 -- scripts/change_url | 4 ++-- scripts/install | 6 +++--- scripts/restore | 4 ++-- scripts/upgrade | 43 ++----------------------------------------- 5 files changed, 9 insertions(+), 50 deletions(-) diff --git a/scripts/backup b/scripts/backup index 7189d8c..f8e82aa 100755 --- a/scripts/backup +++ b/scripts/backup @@ -27,8 +27,6 @@ ynh_backup --src_path="$install_dir" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# SPECIFIC BACKUP #================================================= # BACKUP SYSTEMD #================================================= diff --git a/scripts/change_url b/scripts/change_url index 099c15d..98c62ca 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -31,7 +31,7 @@ fi #================================================= 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="systemd" #================================================= # MODIFY URL IN NGINX CONF @@ -59,7 +59,7 @@ chown -R $app: "$install_dir/data/settings.js" ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 80e23f1..1828be5 100755 --- a/scripts/install +++ b/scripts/install @@ -55,6 +55,8 @@ ynh_script_progression --message="Adding a configuration file..." # Set up the settings file mkdir -p $install_dir/data ynh_add_config --template="../conf/settings.js" --destination="$install_dir/data/settings.js" +chmod a-w "$install_dir/data/settings.js" + ynh_add_config --template="../conf/settings.user.js" --destination="$install_dir/data/settings.user.js" # Small hack to have the "/" path answer with a 200 code to satisfy the CI @@ -69,8 +71,6 @@ fi chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app: "$install_dir" -# make settings.js readonly -chmod a-w "$install_dir/data/settings.js" #================================================= # SETUP SYSTEMD @@ -88,7 +88,7 @@ yunohost service add $app --description="Low-code programming for event-driven a ynh_script_progression --message="Starting a systemd service..." --weight=3 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index dae1e69..4834f9c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -29,7 +29,7 @@ chown -R $app: /var/log/$app #================================================= # REINSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." +ynh_script_progression --message="Reinstalling dependencies..." ynh_install_nodejs --nodejs_version=$nodejs_version @@ -45,7 +45,7 @@ yunohost service add $app --description="Low-code programming for event-driven a #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=3 -ynh_systemd_action --service_name=$app --action="start" +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 3ab8469..af585ef 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,52 +22,13 @@ 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" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# If install_dir doesn't exist, create it -if [ -z "$install_dir" ]; then -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir -fi - -# Cleaning legacy permissions -#REMOVEME? if ynh_legacy_permissions_exists; then -#REMOVEME? ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -# After 1.3.5~ynh2, permissions have been reworked -#REMOVEME? if ynh_permission_exists --permission="admin"; then - # Delete the admin permission - ynh_permission_delete --permission="admin" - # We use main as admin permission - ynh_permission_url --permission="main" --url="/admin" -fi - -#REMOVEME? if ! ynh_permission_exists --permission="ui"; then - # Create ui permission, for the dashboard -#REMOVEME? ynh_permission_create --permission="ui" --url="/ui" --show_tile=true -fi - -#REMOVEME? if ! ynh_permission_exists --permission="endpoints"; then - # Create endpoints permission -#REMOVEME? ynh_permission_create --permission="endpoints" --url="/" --show_tile=false -fi - -# Transfer the publicness of the app to ui and endpoints -if ynh_permission_has_user --permission=main --user=visitors; then -#REMOVEME? ynh_permission_update --permission="ui" --add="visitors" -#REMOVEME? ynh_permission_update --permission="endpoints" --add="visitors" - # Remove visitor access to the admin panel -#REMOVEME? ynh_permission_update --permission="main" --remove="visitors" -fi - # Flows were stored in file named after the hostname. # Not very portable. Let's fix that. if [[ ! -f "$install_dir/data/flows.json" && -f "$install_dir/data/flows_$(hostname).json" ]]; then @@ -157,7 +118,7 @@ chmod a-w "$install_dir/data/settings.js" #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=3 -ynh_systemd_action --service_name=$app --action="start" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # END OF SCRIPT