1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hedgedoc_ynh.git synced 2024-09-03 19:25:52 +02:00
hedgedoc_ynh/scripts/upgrade
YunoHost Bot 49da5bc2c2
[autopatch] Automatic patch attempt for helpers 2.1 (#77)
* [autopatch] Automatic patch attempt for helpers 2.1

* cleaning

---------

Co-authored-by: Yunohost-Bot <>
Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
2024-09-01 12:45:48 +02:00

78 lines
2.6 KiB
Bash

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression "Ensuring downward compatibility..."
ynh_app_setting_set_default --key=allow_anonymous --value="false"
ynh_app_setting_set_default --key=allow_anonymous_edits --value="false"
ynh_app_setting_set_default --key=allow_email_registration --value="false"
ynh_app_setting_set_default --key=allow_free_url --value="false"
ynh_app_setting_set_default --key=require_free_url_authentication --value="false"
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemctl --service=$app --action=stop --log_path=systemd
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Upgrading source files..."
ynh_setup_source --dest_dir=$install_dir --keep="config.json"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression "Upgrading system configurations related to $app..."
ynh_config_add_nginx
ynh_nodejs_install
ynh_config_add_systemd
yunohost service add $app --description="Collaborative Markdown editor" --log="/var/log/$app/$app.log"
#==============================================
# INSTALL HEDGEDOC
#==============================================
ynh_script_progression "Building $app... (this will take some time and resources!)"
pushd "$install_dir"
ynh_safe_rm /usr/local/share/.cache/yarn
ynh_hide_warnings ynh_exec_as_app yarn workspaces focus --production
ynh_hide_warnings ynh_exec_as_app yarn cache clean
popd
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression "Updating configuration..."
url_path=${path#/}
ynh_config_add --template="config.json.example" --destination="$install_dir/config.json"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service=$app --action=start --log_path=systemd --wait_until="HTTP Server listening"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"