mirror of
https://github.com/YunoHost-Apps/monitorix_ynh.git
synced 2024-09-03 19:46:06 +02:00
70 lines
2.3 KiB
Bash
Executable file
70 lines
2.3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# CHECK EXISTING DIRECTORIES
|
|
#=================================================
|
|
|
|
if [ -e "/var/lib/monitorix" ]; then
|
|
old_data_dir_path="/var/lib/monitorix$(date '+%Y%m%d.%H%M%S')"
|
|
ynh_print_warn "A data directory already exist. Data was renamed to $old_data_dir_path"
|
|
mv "/var/lib/monitorix" "$old_data_dir_path"
|
|
fi
|
|
|
|
#=================================================
|
|
# STANDARD MODIFICATIONS
|
|
#=================================================
|
|
ynh_script_progression --message="Installing packages..." --weight=1
|
|
|
|
# Download package and install it
|
|
install_monitorix_package
|
|
|
|
ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" --timeout=15
|
|
|
|
#=================================================
|
|
# SYSTEM CONFIGURATION
|
|
#=================================================ç
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
|
|
|
ynh_add_systemd_config
|
|
yunohost service add "$app" --description="Monitorix" --log=systemd
|
|
|
|
ynh_add_config --template "nginx_status.conf" --destination "$nginx_status_conf"
|
|
ynh_add_nginx_config
|
|
|
|
#=================================================
|
|
# SPECIFIC SETUP
|
|
#=================================================
|
|
# ADD A CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
|
|
|
config_monitorix
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
ynh_script_progression --message="Protecting directory..."
|
|
|
|
set_permission
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
_ynh_systemd_restart_monitorix
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|