2017-10-26 13:01:33 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2021-02-13 18:14:54 +01:00
|
|
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
|
|
|
source ../settings/scripts/_common.sh
|
2017-10-26 13:01:33 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2021-02-13 18:14:54 +01:00
|
|
|
# RESTORE VARIOUS FILES
|
2017-10-26 13:01:33 +02:00
|
|
|
#=================================================
|
2022-06-20 01:41:47 +02:00
|
|
|
ynh_script_progression --message="Restoring various files..." --weight=1
|
2017-10-26 13:01:33 +02:00
|
|
|
|
2021-02-13 18:14:54 +01:00
|
|
|
# Restore the passwd file
|
2022-06-20 01:41:47 +02:00
|
|
|
ynh_restore_file --origin_path="/etc/mosquitto/passwd"
|
2021-02-13 18:14:54 +01:00
|
|
|
|
|
|
|
# Restore the config file
|
2022-06-20 01:41:47 +02:00
|
|
|
ynh_restore_file --origin_path="/etc/mosquitto/conf.d/default.conf"
|
2017-10-26 13:01:33 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-06-20 01:41:47 +02:00
|
|
|
# RESTORE THE LOGROTATE CONFIGURATION
|
2017-10-26 13:01:33 +02:00
|
|
|
#=================================================
|
2022-06-20 01:41:47 +02:00
|
|
|
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
2017-10-26 13:01:33 +02:00
|
|
|
|
2022-06-20 01:41:47 +02:00
|
|
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
2017-10-26 13:01:33 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-06-20 01:41:47 +02:00
|
|
|
# INTEGRATE SERVICE IN YUNOHOST
|
2017-10-26 13:01:33 +02:00
|
|
|
#=================================================
|
2022-06-20 01:41:47 +02:00
|
|
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
2017-10-26 13:01:33 +02:00
|
|
|
|
2022-06-20 01:41:47 +02:00
|
|
|
yunohost service add $app --description="Allows MQTT clients to send/receive data" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"
|
2017-10-26 13:01:33 +02:00
|
|
|
|
2022-06-20 01:41:47 +02:00
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
|
|
|
|
ynh_systemd_action --service_name=$app --action="restart"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
2017-10-26 13:01:33 +02:00
|
|
|
#=================================================
|
2021-02-13 18:14:54 +01:00
|
|
|
# END OF SCRIPT
|
2017-10-26 13:01:33 +02:00
|
|
|
#=================================================
|
|
|
|
|
2021-02-13 18:14:54 +01:00
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|