mirror of
https://github.com/YunoHost-Apps/gancio_ynh.git
synced 2024-09-03 20:36:19 +02:00
84 lines
3 KiB
Bash
84 lines
3 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# STOP SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
|
|
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
ynh_setup_source --dest_dir="$install_dir" --keep="config.json"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
#=================================================
|
|
# UPGRADE DEPENDENCIES
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading dependencies..." --weight=10
|
|
|
|
# Install Nodejs
|
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
|
|
|
#=================================================
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
|
|
|
# This should be a literal copypasta of what happened in the install's "System configuration" section
|
|
ynh_add_nginx_config
|
|
|
|
ynh_add_systemd_config
|
|
|
|
ynh_use_logrotate --non-append
|
|
|
|
yunohost service add $app --description="Federated shared agenda for local communities" --log="/var/log/$app/$app.log"
|
|
|
|
#=================================================
|
|
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
|
|
#=================================================
|
|
# UPDATE A CONFIG FILE
|
|
#=================================================
|
|
#ynh_script_progression --message="Updating a configuration file..." --weight=1
|
|
|
|
#ynh_add_config --template="config.json" --destination="$install_dir/config.json"
|
|
|
|
#chmod 400 "$install_dir/config.json"
|
|
#chown $app:$app "$install_dir/config.json"
|
|
|
|
#=================================================
|
|
# CONFIGURE THE APP
|
|
#=================================================
|
|
ynh_script_progression --message="Updating app dependencies..." --weight=15
|
|
|
|
pushd $install_dir
|
|
ynh_use_nodejs
|
|
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install # Install/upgrade dependencies
|
|
popd
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="START TASK MANAGER" --timeout=30
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|