1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/linkstack_ynh.git synced 2024-09-03 19:36:14 +02:00
linkstack_ynh/scripts/upgrade
Tagada 55da7c3473
Initial release (#1)
* Initial release

* Auto-update README

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>
2023-05-07 00:38:50 +02:00

74 lines
2.5 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
#ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Nothing to do yet...
#=================================================
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
# Enable maintenance mode while upgrading
ynh_write_var_in_file --file="$install_dir/.env" --key="MAINTENANCE_MODE" --value="true"
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
# Keep .env and database.sqlite !
ynh_setup_source --dest_dir="$install_dir" --keep=".env database/database.sqlite"
# Remove this file as the app is already installed
ynh_secure_remove $install_dir/INSTALLING
fi
# $install_dir will automatically be initialized with some decent
# permission by default ... however, you may need to recursively reapply
# ownership to all files such as after the ynh_setup_source step
chown -R $app:www-data "$install_dir"
chmod o-rwx "$install_dir" -R
# Disable maintenance mode
ynh_write_var_in_file --file="$install_dir/.env" --key="MAINTENANCE_MODE" --value="false"
#=================================================
# 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_fpm_config --usage=medium --footprint=low
ynh_add_nginx_config
#=================================================
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
#=================================================
# Nothing to do yet...
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last