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/install
2023-12-13 11:08:16 +01:00

54 lines
1.9 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# SPECIFIC SETUP
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="mosquitto.conf" --destination="/etc/mosquitto/conf.d/default.conf"
ynh_add_config --template="passwd" --destination="/etc/mosquitto/passwd"
mosquitto_passwd -U "/etc/mosquitto/passwd"
ynh_store_file_checksum --file="/etc/mosquitto/passwd"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
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 --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="restart"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last