#!/bin/bash source _common.sh source /usr/share/yunohost/helpers #================================================= # INITIALIZE AND STORE SETTINGS #================================================= # Passwords aren't saved by default ynh_app_setting_set --key=userpass --value="$userpass" #================================================= # SPECIFIC SETUP #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression "Adding $app's configuration..." ynh_config_add --template="mosquitto.conf" --destination="/etc/mosquitto/conf.d/default.conf" ynh_config_add --template="passwd" --destination="/etc/mosquitto/passwd" mosquitto_passwd -U "/etc/mosquitto/passwd" ynh_store_file_checksum "/etc/mosquitto/passwd" # Hard coded username because deb package creates the user chown -R "mosquitto" "/etc/mosquitto" #================================================= # SYSTEM CONFIGURATION #================================================= ynh_script_progression "Adding system configurations related to $app..." # Use logrotate to manage application logfile(s) ynh_config_add_logrotate yunohost service add "$app" --description="Allows MQTT clients to send/receive data" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression "Starting $app's systemd service..." # Start a systemd service ynh_systemctl --service="$app" --action="restart" #================================================= # END OF SCRIPT #================================================= ynh_script_progression "Installation of $app completed"