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
2024-03-10 22:05:42 +01:00

70 lines
2.3 KiB
Bash
Executable file

#!/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
ynh_systemd_action --service_name="$app" --action="stop"
#=================================================
# 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
ynh_add_config --template="default.env" --destination="$install_dir/default.env"
chmod 400 "$install_dir/default.env"
chown "$app:$app" "$install_dir/default.env"
ynh_add_config --template="custom.env" --destination="$data_dir/custom.env"
chmod 600 "$data_dir/custom.env"
chown "$app:$app" "$data_dir/custom.env"
#=================================================
# SET PERMISSION FOR THE USER
#=================================================
ynh_permission_update --permission="main" --add="$admin"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
ynh_add_nginx_config
ynh_add_systemd_config
yunohost service add "$app" --description="The hacker's notebook"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
ynh_systemd_action --service_name="$app" --action="start"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last