1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mumbleserver_ynh.git synced 2024-09-03 19:46:03 +02:00

Add multi-install, remove port (sent by email), add helper

This commit is contained in:
Jean-Baptiste Holcroft 2017-12-04 23:37:56 +01:00
parent 969facc313
commit fc8639d23d
4 changed files with 60 additions and 29 deletions

View file

@ -4,7 +4,6 @@
server_login_password="super_secret_password" (PASSWORD) server_login_password="super_secret_password" (PASSWORD)
password="super_secret_password" password="super_secret_password"
welcometext="Welcome to my mumble server" welcometext="Welcome to my mumble server"
port=64738 (PORT)
registername="Root" registername="Root"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
@ -13,16 +12,13 @@
setup_nourl=1 setup_nourl=1
setup_private=0 setup_private=0
setup_public=0 setup_public=0
upgrade=1 upgrade=0
backup_restore=1 backup_restore=0
multi_instance=0 multi_instance=1
wrong_user=0 wrong_user=0
wrong_path=0 wrong_path=0
incorrect_path=0 incorrect_path=1
corrupt_source=0 port_already_use=0
fail_download_source=0
port_already_use=1
final_path_already_use=0
;;; Levels ;;; Levels
Level 1=auto Level 1=auto
Level 2=auto Level 2=auto

View file

@ -13,10 +13,10 @@
"email": "moul@moul.re" "email": "moul@moul.re"
}, },
"requirements": { "requirements": {
"yunohost": ">> 2.4.0" "yunohost": ">> 2.7.0"
}, },
"version": "1.2.8-1", "version": "1.2.8-1",
"multi_instance": false, "multi_instance": true,
"services": [ "services": [
], ],
"arguments": { "arguments": {
@ -47,15 +47,6 @@
}, },
"example": "Welcome to my mumble server" "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", "name": "registername",
"ask": { "ask": {

View file

@ -1,3 +1,34 @@
#!/bin/bash #!/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
}

View file

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
# doc: https://wiki.mumble.info/wiki/Running_Murmur
#================================================= #=================================================
# GENERIC START # GENERIC START
#================================================= #=================================================
@ -25,7 +27,6 @@ app=$YNH_APP_INSTANCE_NAME
server_password=$YNH_APP_ARG_SERVER_LOGIN_PASSWORD server_password=$YNH_APP_ARG_SERVER_LOGIN_PASSWORD
su_passwd=$YNH_APP_ARG_PASSWORD su_passwd=$YNH_APP_ARG_PASSWORD
welcometext=$YNH_APP_ARG_WELCOMETEXT welcometext=$YNH_APP_ARG_WELCOMETEXT
port=$YNH_APP_ARG_PORT
registerName=$YNH_APP_ARG_REGISTERNAME registerName=$YNH_APP_ARG_REGISTERNAME
#================================================= #=================================================
@ -35,13 +36,6 @@ registerName=$YNH_APP_ARG_REGISTERNAME
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder" 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 # Check if su_password is not empty
if [[ -z "$su_passwd" ]]; then if [[ -z "$su_passwd" ]]; then
ynh_die "Password is not set" ynh_die "Password is not set"
@ -52,7 +46,6 @@ fi
#================================================= #=================================================
# Save app settings # Save app settings
ynh_app_setting_set "$app" port "$port"
ynh_app_setting_set "$app" server_password "$server_password" ynh_app_setting_set "$app" server_password "$server_password"
ynh_app_setting_set "$app" su_passwd "$su_passwd" ynh_app_setting_set "$app" su_passwd "$su_passwd"
ynh_app_setting_set "$app" welcometext "$welcometext" ynh_app_setting_set "$app" welcometext "$welcometext"
@ -64,6 +57,9 @@ ynh_app_setting_set "$app" registerName "$registerName"
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
port=$(ynh_find_port 64738)
ynh_app_setting_set "$app" port "$port"
# Open port in firewall # Open port in firewall
yunohost firewall allow Both "$port" yunohost firewall allow Both "$port"
@ -115,6 +111,23 @@ ynh_store_file_checksum "$mumble_conf"
mkdir -p /var/run/mumble-server/ mkdir -p /var/run/mumble-server/
murmurd -ini "$mumble_conf" -supw "$su_passwd" 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 # GENERIC FINALIZATION
#================================================= #=================================================