mirror of
https://github.com/YunoHost-Apps/mosquitto_ynh.git
synced 2024-09-03 19:45:54 +02:00
48 lines
1.7 KiB
Bash
Executable file
48 lines
1.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
|
source ../settings/scripts/_common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# RESTORE SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
|
|
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
|
|
|
yunohost service add "$app" --description="Allows MQTT clients to send/receive data" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"
|
|
|
|
#=================================================
|
|
# RESTORE VARIOUS FILES
|
|
#=================================================
|
|
ynh_script_progression --message="Restoring various files..." --weight=1
|
|
|
|
# Restore the passwd file
|
|
ynh_restore_file --origin_path="/etc/mosquitto/passwd"
|
|
|
|
# Restore the config file
|
|
ynh_restore_file --origin_path="/etc/mosquitto/conf.d/default.conf"
|
|
|
|
ynh_restore_file --origin_path="/var/log/$app/"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
ynh_systemd_action --service_name="$app" --action="restart"
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|