2022-02-22 13:59:54 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2023-08-13 12:38:51 +02:00
|
|
|
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
|
2022-02-22 13:59:54 +01:00
|
|
|
|
2023-08-13 12:38:51 +02:00
|
|
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
2022-02-22 13:59:54 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CHECK VERSION
|
|
|
|
#=================================================
|
2022-07-14 02:33:15 +02:00
|
|
|
ynh_script_progression --message="Checking version..."
|
2022-02-22 13:59:54 +01:00
|
|
|
|
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
|
|
#=================================================
|
2023-08-13 12:38:51 +02:00
|
|
|
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
2022-02-22 13:59:54 +01:00
|
|
|
|
|
|
|
# Backup the current version of the app
|
2023-08-13 12:38:51 +02:00
|
|
|
#REMOVEME? ynh_backup_before_upgrade
|
|
|
|
#REMOVEME? ynh_clean_setup () {
|
2022-07-14 02:33:15 +02:00
|
|
|
ynh_clean_check_starting
|
2022-02-22 13:59:54 +01:00
|
|
|
# Restore it if the upgrade fails
|
2023-08-13 12:38:51 +02:00
|
|
|
#REMOVEME? ynh_restore_upgradebackup
|
2022-02-22 13:59:54 +01:00
|
|
|
}
|
|
|
|
# Exit if an error occurs during the execution of the script
|
2023-08-13 12:38:51 +02:00
|
|
|
#REMOVEME? ynh_abort_if_errors
|
2022-02-22 13:59:54 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD UPGRADE STEPS
|
|
|
|
#=================================================
|
|
|
|
# STOP SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2022-05-07 18:24:57 +02:00
|
|
|
ynh_script_progression --message="Stopping a systemd service..." --weight=4
|
2022-02-22 13:59:54 +01:00
|
|
|
|
|
|
|
ynh_systemd_action --service_name=smbd --action="stop"
|
|
|
|
|
2022-07-14 02:33:15 +02:00
|
|
|
#=================================================
|
|
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Ensuring downward compatibility..."
|
|
|
|
|
2022-02-22 13:59:54 +01:00
|
|
|
#=================================================
|
|
|
|
# UPGRADE DEPENDENCIES
|
|
|
|
#=================================================
|
2023-08-13 12:38:51 +02:00
|
|
|
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=12
|
2022-02-22 13:59:54 +01:00
|
|
|
|
2023-08-13 12:38:51 +02:00
|
|
|
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
2022-02-22 13:59:54 +01:00
|
|
|
|
2022-07-14 02:33:15 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
2022-05-07 18:28:07 +02:00
|
|
|
# INTEGRATE SERVICE IN YUNOHOST
|
2022-07-14 02:33:15 +02:00
|
|
|
#=================================================
|
2022-05-07 18:28:07 +02:00
|
|
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
|
|
|
|
2022-07-19 09:58:14 +02:00
|
|
|
# Don't add --needs_exposed_ports 445 , we don't want a remote diagnosis here
|
2022-07-19 15:19:59 +02:00
|
|
|
yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smbd.log" --needs_exposed_ports 445
|
2022-05-07 18:28:07 +02:00
|
|
|
|
2022-02-22 13:59:54 +01:00
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2022-05-07 18:24:57 +02:00
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
2022-02-22 13:59:54 +01:00
|
|
|
|
|
|
|
ynh_systemd_action --service_name=smbd --action="start"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2022-05-07 18:24:57 +02:00
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|