#!/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 ynh_restore_file --origin_path="/etc/mosquitto/conf.d/default.conf" ynh_restore_file --origin_path="/etc/mosquitto/passwd" ynh_restore_file --origin_path="/var/log/$app/" # Hard coded username because deb package creates the user chown -R "mosquitto" "/etc/mosquitto" chown -R "mosquitto" "/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