From 26203f7b9a332457b4d10d5e8d5db679e358c396 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 30 May 2020 18:55:27 +0200 Subject: [PATCH 1/4] remove logrotate --- scripts/backup | 6 ------ scripts/install | 8 -------- scripts/remove | 8 -------- scripts/restore | 6 ------ scripts/upgrade | 8 -------- 5 files changed, 36 deletions(-) diff --git a/scripts/backup b/scripts/backup index 14f0869..334b8eb 100644 --- a/scripts/backup +++ b/scripts/backup @@ -39,12 +39,6 @@ ynh_backup --src_path=$final_path ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP LOGROTATE -#================================================= - -ynh_backup --src_path="/etc/logrotate.d/$app" - #================================================= # BACKUP SYSTEMD #================================================= diff --git a/scripts/install b/scripts/install index 96e9cc6..e08c710 100644 --- a/scripts/install +++ b/scripts/install @@ -154,14 +154,6 @@ yunohost service add $app --description "Self-hosted web IRC client" --log "/var chown -R $app: $final_path chown -R $app: $config_path -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/remove b/scripts/remove index 1b25793..b5870e0 100644 --- a/scripts/remove +++ b/scripts/remove @@ -68,14 +68,6 @@ ynh_script_progression --message="Removing nginx web server configuration..." # Remove the dedicated nginx config ynh_remove_nginx_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." - -# Remove the app-specific logrotate config -ynh_remove_logrotate - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 720a610..28b0aa5 100644 --- a/scripts/restore +++ b/scripts/restore @@ -115,12 +115,6 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Available at http" -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index abaf462..2babab0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -176,14 +176,6 @@ ynh_store_file_checksum --file="$config_path/config.js" cp -a ../conf/config.js "$config_path" -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append - #================================================= # GENERIC FINALIZATION #================================================= From d3d8210422a915fc53bc2d1abd58238703817b11 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 30 May 2020 18:56:38 +0200 Subject: [PATCH 2/4] cleaning up --- scripts/change_url | 2 +- scripts/install | 2 +- scripts/remove | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index d92c78a..85f3330 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -104,4 +104,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression --message="Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index e08c710..56f704f 100644 --- a/scripts/install +++ b/scripts/install @@ -181,4 +181,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression --message="Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index b5870e0..2ac341f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -82,4 +82,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression --message="Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 28b0aa5..e4b8c4e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -128,4 +128,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression --message="Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 2babab0..294f38c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -204,4 +204,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression --message="Upgrade of $app completed" From 6c7d05b7f6dc0c35ea5118f384ce890d368161c5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 30 May 2020 19:00:39 +0200 Subject: [PATCH 3/4] add ynh_use_nodejs --- scripts/install | 5 +++-- scripts/upgrade | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 56f704f..1a2c929 100644 --- a/scripts/install +++ b/scripts/install @@ -110,8 +110,9 @@ ynh_script_progression --message="Installing The Lounge..." pushd $final_path -yarn install && ynh_exec_warn_less NODE_ENV=production yarn build - + ynh_use_nodejs + yarn install && ynh_exec_warn_less NODE_ENV=production yarn build + popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 294f38c..abca621 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -127,7 +127,8 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st if [ "$upgrade_type" == "UPGRADE_APP" ] then pushd $final_path - + + ynh_use_nodejs yarn install && ynh_exec_warn_less NODE_ENV=production yarn build popd From f8779f0f4db2fd0e34329fb0756fbe3250f11565 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 30 May 2020 19:15:17 +0200 Subject: [PATCH 4/4] fix checksum and SSOWAT --- scripts/upgrade | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index abca621..dd76818 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -100,6 +100,17 @@ then ynh_setup_source --dest_dir=$final_path fi +#================================================= +# STORE THE CONFIG FILE CHECKSUM +#================================================= + +### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. +### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. +ynh_backup_if_checksum_is_different --file="$config_path/config.js" + +# Recalculate and store the checksum of the file for the next upgrade. +ynh_store_file_checksum --file="$config_path/config.js" + #================================================= # COPY A CONFIG FILE #================================================= @@ -187,6 +198,18 @@ cp -a ../conf/config.js "$config_path" chown -R $app: $final_path chown -R $app: $config_path +#================================================= +# SETUP SSOWAT +#================================================= +ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1 + +# Make app public if necessary +if [ $is_public -eq 1 ] +then + # unprotected_uris allows SSO credentials to be passed anyway + ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" +fi + #================================================= # START SYSTEMD SERVICE #=================================================