From fc8639d23d7ce662f3f15bc88cd3247ee57074cf Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Mon, 4 Dec 2017 23:37:56 +0100 Subject: [PATCH] Add multi-install, remove port (sent by email), add helper --- check_process | 14 +++++--------- manifest.json | 13 ++----------- scripts/_common.sh | 31 +++++++++++++++++++++++++++++++ scripts/install | 31 ++++++++++++++++++++++--------- 4 files changed, 60 insertions(+), 29 deletions(-) diff --git a/check_process b/check_process index 31b9cf2..eb07c79 100644 --- a/check_process +++ b/check_process @@ -4,7 +4,6 @@ server_login_password="super_secret_password" (PASSWORD) password="super_secret_password" welcometext="Welcome to my mumble server" - port=64738 (PORT) registername="Root" ; Checks pkg_linter=1 @@ -13,16 +12,13 @@ setup_nourl=1 setup_private=0 setup_public=0 - upgrade=1 - backup_restore=1 - multi_instance=0 + upgrade=0 + backup_restore=0 + multi_instance=1 wrong_user=0 wrong_path=0 - incorrect_path=0 - corrupt_source=0 - fail_download_source=0 - port_already_use=1 - final_path_already_use=0 + incorrect_path=1 + port_already_use=0 ;;; Levels Level 1=auto Level 2=auto diff --git a/manifest.json b/manifest.json index 41cd762..142e335 100644 --- a/manifest.json +++ b/manifest.json @@ -13,10 +13,10 @@ "email": "moul@moul.re" }, "requirements": { - "yunohost": ">> 2.4.0" + "yunohost": ">> 2.7.0" }, "version": "1.2.8-1", - "multi_instance": false, + "multi_instance": true, "services": [ ], "arguments": { @@ -47,15 +47,6 @@ }, "example": "Welcome to my mumble server" }, - { - "name": "port", - "ask": { - "en": "Choose a port for your server. Let as default if you don't want to change it", - "fr": "Entrez un port pour votre serveur. Laissez par défaut si vous ne voulez pas en changer" - }, - "example": "64738", - "default": "64738" - }, { "name": "registername", "ask": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 7a693aa..b938388 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,3 +1,34 @@ #!/bin/bash +send_readme_to_admin() { + app_message=$1 + if [[ -z $app_message ]]; then + ynh_die "Package shoud send basic info to the administrator" + fi + + # list domains, select second line and extract the domain + # ynh_domain=$(yunohost domain list | sed -e '1d' -e '2q' | cut -d' ' -f4) + # ynh_admin="admin@$ynh_domain" + + # list host, kernel, packages and system information + ynh_info=$(yunohost tools diagnosis | grep -B 100 "services:" | sed 's/services://') + + mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!" + mail_message=" + This is an automated message from your beloved YunoHost server. + + ----- + Specific information for this application ($app) + ----- + $app_message + + ----- + Automatic diagnosis data from YunoHost + ----- + $ynh_info + " + + # Email server admin - for ACTION + echo "$mail_message" | mail -s "$mail_subject" root -u root +} diff --git a/scripts/install b/scripts/install index 4ffe185..321e5e9 100644 --- a/scripts/install +++ b/scripts/install @@ -1,5 +1,7 @@ #!/bin/bash +# doc: https://wiki.mumble.info/wiki/Running_Murmur + #================================================= # GENERIC START #================================================= @@ -25,7 +27,6 @@ app=$YNH_APP_INSTANCE_NAME server_password=$YNH_APP_ARG_SERVER_LOGIN_PASSWORD su_passwd=$YNH_APP_ARG_PASSWORD welcometext=$YNH_APP_ARG_WELCOMETEXT -port=$YNH_APP_ARG_PORT registerName=$YNH_APP_ARG_REGISTERNAME #================================================= @@ -35,13 +36,6 @@ registerName=$YNH_APP_ARG_REGISTERNAME final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" -# Check port availability - -yunohost app checkport "$port" -if [[ ! $? -eq 0 ]]; then - ynh_die "Port is not available" -fi - # Check if su_password is not empty if [[ -z "$su_passwd" ]]; then ynh_die "Password is not set" @@ -52,7 +46,6 @@ fi #================================================= # Save app settings -ynh_app_setting_set "$app" port "$port" ynh_app_setting_set "$app" server_password "$server_password" ynh_app_setting_set "$app" su_passwd "$su_passwd" ynh_app_setting_set "$app" welcometext "$welcometext" @@ -64,6 +57,9 @@ ynh_app_setting_set "$app" registerName "$registerName" # FIND AND OPEN A PORT #================================================= +port=$(ynh_find_port 64738) +ynh_app_setting_set "$app" port "$port" + # Open port in firewall yunohost firewall allow Both "$port" @@ -115,6 +111,23 @@ ynh_store_file_checksum "$mumble_conf" mkdir -p /var/run/mumble-server/ murmurd -ini "$mumble_conf" -supw "$su_passwd" +#================================================= +# Start services +#================================================= +message=" +Port : $port +Password to join server: $server_password +SuperUser Password : $su_passwd +Welcome text : $welcometext +Root channel (your mumble server name): $registerName +Final path (where to find your files) : $final_path +mumble configuration file : $mumble_conf + +Are you facing an issue, want to improve this app or say thank you? +Please open a new issue in this project: https://github.com/YunoHost-Apps/mumbleserver_ynh +" +send_readme_to_admin $message + #================================================= # GENERIC FINALIZATION #=================================================