1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/webtrees_ynh.git synced 2024-09-03 18:26:37 +02:00
webtrees_ynh/scripts/upgrade
2024-07-01 21:43:25 +02:00

63 lines
1.9 KiB
Bash

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression "Ensuring downward compatibility..."
# Migrate manifest questions
if [ -z "${admin_username:-}" ]; then
admin_username="$username"
ynh_app_setting_set --app="$app" --key="admin_username" --value="$admin_username"
fi
if [ -n "${username:-}" ]; then
ynh_app_setting_delete --app="$app" --key="username"
fi
if [ -z "${admin_name:-}" ]; then
admin_name="$name"
ynh_app_setting_set --app="$app" --key="admin_name" --value="$admin_name"
fi
if [ -n "${name:-}" ]; then
ynh_app_setting_delete --app="$app" --key="name"
fi
if [ -z "${admin_email:-}" ]; then
admin_email="$email"
ynh_app_setting_set --app="$app" --key="admin_email" --value="$admin_email"
fi
if [ -n "${email:-}" ]; then
ynh_app_setting_delete --app="$app" --key="email"
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="data modules_v4"
chmod -R 700 "$install_dir/data"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression "Upgrading system configurations related to $app..."
# Create a dedicated NGINX config
ynh_config_add_nginx
# Create a dedicated PHP-FPM config
ynh_config_add_phpfpm
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"