mirror of
https://github.com/YunoHost-Apps/silverbullet_ynh.git
synced 2024-09-03 20:26:18 +02:00
68 lines
2.2 KiB
Bash
Executable file
68 lines
2.2 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"
|
|
|
|
# Create notes subdir
|
|
install -d -m 700 -o $app -g $app $data_dir/notes
|
|
|
|
#=================================================
|
|
# 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
|