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

79 lines
2.6 KiB
Text
Raw Permalink 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
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"
2019-02-03 00:20:19 +01:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2024-04-13 22:20:47 +02:00
ynh_script_progression --message="Upgrading source files..."
2019-02-03 00:20:19 +01:00
2024-04-13 22:20:47 +02:00
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --keep="lstu.conf"
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
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
2024-04-13 22:20:47 +02:00
#ynh_add_config --template="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
#=================================================
2024-04-13 22:20:47 +02:00
ynh_script_progression --message="Building $app..."
2021-06-21 18:15:41 +02:00
2023-05-31 20:58:29 +02:00
pushd $install_dir
2024-04-13 22:20:47 +02:00
ynh_secure_remove --file="$install_dir/local"
2024-04-29 20:26:31 +02:00
carton install --without=sqlite --without=mysql
2021-06-21 18:15:41 +02:00
popd
2022-06-16 01:28:41 +02:00
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..."
2023-06-01 08:37:45 +02:00
# Create a dedicated NGINX config
ynh_add_nginx_config
2022-06-16 01:28:41 +02:00
# Create a dedicated systemd config
ynh_add_systemd_config
# 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
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
2023-06-01 08:37:45 +02:00
ynh_systemd_action --service_name=$app --action=reload --log_path="systemd" --line_match="Reloaded Shortened URLs service."
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"