#!/bin/bash # Source YunoHost helpers source /usr/share/yunohost/helpers # Stop script if errors ynh_abort_if_errors # Import common cmd source ./_common.sh # Retrieve arguments domain=$YNH_APP_ARG_DOMAIN path=$(ynh_normalize_url_path $YNH_APP_ARG_PATH) # Check domain/path availability test $(ynh_webpath_available $domain $path) == 'True' || ynh_die "$domain$path is not available, please use an other domain or path." ynh_webpath_register $app $domain $path # Install package install_dependances # Download package and install it get_install_source # # Generate MySQL user dbuser=$app dbpass=$(ynh_string_random 12) ynh_app_setting_set "$app" mysqlpwd "$dbpass" ynh_mysql_create_user $dbuser $dbpass # Find a port for built-in monitorix HTTP server http_port=$(ynh_find_port 8080) nginx_status_port=$(ynh_find_port $(($http_port +1))) ynh_app_setting_set $app http_port $http_port ynh_app_setting_set $app nginx_status_port $nginx_status_port # Config nginx config_nginx # Update monitorix configuration config_monitorix # register yunohost service yunohost service add monitorix # Reload services systemctl restart monitorix.service