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

41 lines
1.5 KiB
Bash
Executable file

#!/bin/bash
# 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 "Restoring system configurations related to $app..."
ynh_restore "/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 "Restoring various files..."
ynh_restore "/etc/mosquitto/conf.d/default.conf"
ynh_restore "/etc/mosquitto/passwd"
ynh_restore "/var/log/$app/"
# Hard coded username because deb package creates the user
chown -R "mosquitto" "/etc/mosquitto"
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "mosquitto" "/var/log/$app/"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service="$app" --action="restart"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Restoration completed for $app"