1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/silverbullet_ynh.git synced 2024-09-03 20:26:18 +02:00
silverbullet_ynh/scripts/upgrade

71 lines
2.3 KiB
Text
Raw Permalink Normal View History

2024-03-09 23:40:16 +01:00
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping $app's systemd service..." --weight=1
2024-03-10 20:38:30 +01:00
ynh_systemd_action --service_name="$app" --action="stop"
2024-03-09 23:40:16 +01:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from manifest.toml
ynh_setup_source --dest_dir="$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating $app's configuration files..." --weight=1
2024-03-10 20:38:30 +01:00
ynh_add_config --template="default.env" --destination="$install_dir/default.env"
chmod 400 "$install_dir/default.env"
chown "$app:$app" "$install_dir/default.env"
2024-03-09 23:40:16 +01:00
2024-03-10 20:38:30 +01:00
ynh_add_config --template="custom.env" --destination="$data_dir/custom.env"
2024-03-09 23:40:16 +01:00
2024-03-10 20:38:30 +01:00
chmod 600 "$data_dir/custom.env"
chown "$app:$app" "$data_dir/custom.env"
2024-03-09 23:40:16 +01:00
2024-03-10 22:05:42 +01:00
#=================================================
# SET PERMISSION FOR THE USER
#=================================================
ynh_permission_update --permission="main" --add="$admin"
2024-03-09 23:40:16 +01:00
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
ynh_add_nginx_config
ynh_add_systemd_config
2024-03-10 20:38:30 +01:00
yunohost service add "$app" --description="The hacker's notebook"
2024-03-09 23:40:16 +01:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
2024-03-10 20:38:30 +01:00
ynh_systemd_action --service_name="$app" --action="start"
2024-03-09 23:40:16 +01:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last