1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mosquitto_ynh.git synced 2024-09-03 19:45:54 +02:00
mosquitto_ynh/scripts/restore

50 lines
1.8 KiB
Text
Raw Normal View History

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
2024-01-19 17:14:28 +01:00
#=================================================
# 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"
2017-10-26 13:01:33 +02:00
#=================================================
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
2022-06-20 01:41:47 +02:00
ynh_restore_file --origin_path="/etc/mosquitto/conf.d/default.conf"
ynh_restore_file --origin_path="/etc/mosquitto/passwd"
2017-10-26 13:01:33 +02:00
2024-01-19 17:14:28 +01:00
ynh_restore_file --origin_path="/var/log/$app/"
2017-10-26 13:01:33 +02:00
# Hard coded username because deb package creates the user
chown -R "mosquitto" "/etc/mosquitto"
chown -R "mosquitto" "/var/log/$app/"
2022-06-20 01:41:47 +02:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
2024-01-19 17:14:28 +01:00
ynh_systemd_action --service_name="$app" --action="restart"
2022-06-20 01:41:47 +02:00
#=================================================
# 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