1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yunomonitor_ynh.git synced 2024-09-03 17:46:11 +02:00
yunomonitor_ynh/scripts/upgrade

77 lines
2.5 KiB
Text
Raw Normal View History

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
2022-01-27 02:21:23 +01:00
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
2024-01-19 16:41:23 +01:00
if ! [ -f "$install_dir/conf/ignore_alert.csv" ]; then
echo "method level server message target" > "$install_dir/conf/ignore_alert.csv"
2022-01-27 02:21:23 +01:00
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2024-01-19 16:41:23 +01:00
ynh_script_progression --message="Upgrading source files..." --weight=1
2024-01-19 16:41:23 +01:00
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
2023-12-11 12:37:28 +01:00
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
2024-01-19 16:41:23 +01:00
chown -R "$app:www-data" "$install_dir"
2023-12-11 12:37:28 +01:00
chmod u+x "$install_dir/yunomonitor.py"
chmod u+w "$install_dir/conf"
chmod u+w "$install_dir/well-known"
2022-02-08 00:24:18 +01:00
#=================================================
# BUILD YUNOMONITOR
#=================================================
ynh_script_progression --message="Building Yunomonitor..."
2023-12-11 12:37:28 +01:00
pushd "$install_dir"
2024-01-19 16:41:23 +01:00
python3 -m pip install pycryptodome pyyaml
2022-02-08 00:24:18 +01:00
popd
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
2023-12-11 12:37:28 +01:00
ynh_backup_if_checksum_is_different --file="$install_dir/conf/$app.yml"
# Recalculate and store the checksum of the file for the next upgrade.
2023-12-11 12:37:28 +01:00
ynh_store_file_checksum --file="$install_dir/conf/$app.yml"
#=================================================
2023-12-11 12:37:28 +01:00
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
2023-12-11 12:37:28 +01:00
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
_yunomonitor_add_nginx_config
2022-01-27 02:21:23 +01:00
ynh_add_systemd_config
#=================================================
# START SYSTEMD SERVICE
#=================================================
2020-10-04 22:11:03 +02:00
ynh_script_progression --message="Reloading a systemd service..." --weight=1
2023-12-11 12:37:28 +01:00
ynh_systemd_action --service_name="$app" --action="reload" --log_path="/var/log/$app/$app.log"
2022-01-27 02:21:23 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2020-10-04 22:11:03 +02:00
ynh_script_progression --message="Upgrade of $app completed" --last