#!/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"