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/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 96e9cc6..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 #================================================= @@ -154,14 +155,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 #================================================= @@ -189,4 +182,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 1b25793..2ac341f 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 #================================================= @@ -90,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 720a610..e4b8c4e 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 #================================================= @@ -134,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 abaf462..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 #================================================= @@ -127,7 +138,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 @@ -176,14 +188,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 #================================================= @@ -194,6 +198,18 @@ ynh_use_logrotate --non-append 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 #================================================= @@ -212,4 +228,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"