1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/libreto_ynh.git synced 2024-09-03 19:36:14 +02:00
libreto_ynh/scripts/upgrade

66 lines
2.3 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=5
chown -R $app:www-data "$install_dir"
# Download, check integrity, uncompress and patch the source from app.src
ynh_exec_as "$app" git -C "$install_dir/libreto" checkout master
ynh_exec_as "$app" git -C "$install_dir/libreto" pull --quiet
ynh_exec_as "$app" git -C "$install_dir/libreto" checkout $COMMIT --quiet
ynh_exec_as "$app" git -C "$install_dir/libreto" submodule update --init --recursive --quiet
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# SPECIFIC UPGRADE
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
ynh_backup_if_checksum_is_different --file="$install_dir/config.php"
provider="__PROVIDER__"
default_provider="framapad"
commented_provider="// CUSTOM_PROVIDER"
if [ "$etherpad_instance" != "https://annuel2.framapad.org" ]; then
provider="${domain%%.*}"
default_provider="$provider"
commented_provider=""
fi
ynh_add_config --template="config.dist.php" --destination="$install_dir/libreto/config.php"
chown "$app:www-data" "$install_dir/libreto/config.php"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last