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

115 lines
3.7 KiB
Text
Raw Normal View History

2017-04-21 12:54:39 +02:00
#!/bin/bash
#=================================================
2019-02-03 00:20:19 +01:00
# GENERIC START
2017-04-21 12:54:39 +02:00
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2018-04-10 00:12:30 +02:00
source _common.sh
2017-04-21 12:54:39 +02:00
source /usr/share/yunohost/helpers
#=================================================
2020-04-19 05:16:46 +02:00
# CHECK VERSION
2017-04-21 12:54:39 +02:00
#=================================================
2020-04-19 05:16:46 +02:00
upgrade_type=$(ynh_check_app_version_changed)
2022-06-16 01:28:41 +02:00
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
2020-04-19 05:16:46 +02:00
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
2020-05-30 15:28:48 +02:00
ynh_script_progression --message="Ensuring downward compatibility..."
2020-04-19 05:16:46 +02:00
2019-02-14 23:39:36 +01:00
if [ -z "$theme" ]; then
theme="milligram"
2020-04-19 21:54:21 +02:00
ynh_app_setting_set --app=$app --key=theme --value=$theme
2019-02-14 23:39:36 +01:00
fi
2019-02-03 00:20:19 +01:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2020-04-19 05:16:46 +02:00
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
2020-05-30 15:28:48 +02:00
ynh_script_progression --message="Upgrading source files..."
2019-02-03 00:20:19 +01:00
2020-04-19 05:16:46 +02:00
# Download, check integrity, uncompress and patch the source from app.src
2023-05-31 21:08:32 +02:00
ynh_setup_source --dest_dir="$install_dir" --keep="lstu.conf"
2020-04-19 05:16:46 +02:00
fi
2017-04-21 12:54:39 +02:00
2023-05-31 20:58:29 +02:00
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
2021-06-20 23:23:08 +02:00
2020-04-19 05:16:46 +02:00
#=================================================
2022-06-16 01:28:41 +02:00
# NGINX CONFIGURATION
2020-04-19 05:16:46 +02:00
#=================================================
2022-06-16 01:28:41 +02:00
ynh_script_progression --message="Upgrading NGINX web server configuration..."
2020-04-19 05:16:46 +02:00
2022-06-16 01:28:41 +02:00
# Create a dedicated NGINX config
ynh_add_nginx_config
2020-04-19 05:16:46 +02:00
2021-06-21 18:15:01 +02:00
#=================================================
2022-06-16 01:28:41 +02:00
# SPECIFIC UPGRADE
2021-06-21 18:15:01 +02:00
#=================================================
2022-06-16 01:28:41 +02:00
# UPDATE A CONFIG FILE
#=================================================
2023-05-31 21:08:32 +02:00
#ynh_script_progression --message="Updating a configuration file..."
2021-06-21 18:15:01 +02:00
2023-05-31 21:08:32 +02:00
#ynh_add_config --template="../conf/lstu.conf.ldap" --destination="$install_dir/lstu.conf"
2021-06-21 18:15:01 +02:00
2021-06-21 18:15:41 +02:00
#=================================================
# BUILD LSU
#=================================================
ynh_script_progression --message="Building lstu..."
2023-05-31 20:58:29 +02:00
pushd $install_dir
2021-06-21 18:15:41 +02:00
carton install --deployment --without=sqlite --without=mysql
popd
2022-06-16 01:28:41 +02:00
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..."
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
2017-04-21 12:54:39 +02:00
#=================================================
2019-02-03 00:20:19 +01:00
# SETUP LOGROTATE
#=================================================
2020-05-30 15:28:48 +02:00
ynh_script_progression --message="Upgrading logrotate configuration..."
2019-02-03 00:20:19 +01:00
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
2019-02-03 00:20:19 +01:00
#=================================================
2022-06-16 01:28:41 +02:00
# INTEGRATE SERVICE IN YUNOHOST
2017-04-21 12:54:39 +02:00
#=================================================
2022-06-16 01:28:41 +02:00
ynh_script_progression --message="Integrating service in YunoHost..."
2017-04-21 12:54:39 +02:00
2022-06-16 01:28:41 +02:00
yunohost service add $app --log="/var/log/$app.log" --log="/var/www/$app/log/production.log"
2017-04-21 12:54:39 +02:00
2020-11-26 18:32:46 +01:00
#=================================================
2022-06-16 01:28:41 +02:00
# START SYSTEMD SERVICE
2020-11-26 18:32:46 +01:00
#=================================================
2022-06-16 01:28:41 +02:00
ynh_script_progression --message="Starting a systemd service..."
2020-11-26 18:32:46 +01:00
2022-06-16 01:28:41 +02:00
ynh_systemd_action --service_name=$app --action=reload --line_match="Reloaded Shortened URLs service." --log_path="systemd"
2020-12-08 17:24:16 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2020-05-30 15:30:23 +02:00
ynh_script_progression --message="Upgrade of $app completed"