From 6646cfcdafe15b95cdafd0061334ddf0d139fd57 Mon Sep 17 00:00:00 2001 From: Moul Date: Tue, 23 May 2017 11:12:38 +0200 Subject: [PATCH 01/11] [mod] set myself as maintainer. Add requirement key. --- README.md | 2 -- manifest.json | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 562bc0a..c209948 100644 --- a/README.md +++ b/README.md @@ -5,5 +5,3 @@ It install the Debian package and configures it with given settings. #### Setup - [Add the admin](http://wiki.mumble.info/wiki/Murmurguide#Connecting_to_Murmur_Server) - -email me at matlink@matlink.fr if you need something or to give me feedback about this app. diff --git a/manifest.json b/manifest.json index 99ffb32..fd6a149 100644 --- a/manifest.json +++ b/manifest.json @@ -6,11 +6,14 @@ "en": "Mumble is a libre, low-latency, high quality voice chat software primarily intended for use while gaming.", "fr": "Mumble est un logiciel libre de voix sur IP (VoIP), son principal usage étant la communication pendant les parties de jeux en réseau." }, - "url": "http://mumble.info", + "url": "https://mumble.info", "license": "free", "maintainer": { - "name": "Matlink", - "email": "matlink@matlink.fr" + "name": "Moul", + "email": "moul@moul.re" + }, + "requirements": { + "yunohost": ">> 2.4.0" }, "multi_instance": false, "services": [ From b2e16316c00cab1b7f49f477ad406efde229df3a Mon Sep 17 00:00:00 2001 From: Moul Date: Tue, 23 May 2017 11:15:40 +0200 Subject: [PATCH 02/11] [mod] install: retrive helpers, use setting helper, move conf file definition. --- scripts/install | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index aae19da..8ada8c5 100644 --- a/scripts/install +++ b/scripts/install @@ -13,26 +13,29 @@ welcometext=$3 port=$4 registerName=$5 -mumble_conf=/etc/mumble-server.ini +# Source YunoHost helpers +source /usr/share/yunohost/helpers + # Check port availability sudo yunohost app checkport $port if [[ ! $? -eq 0 ]]; then exit 1 fi -#check if su_password is not empty +# Check if su_password is not empty if [[ -z "$su_passwd" ]]; then exit 1 fi # Save app settings -sudo yunohost app setting $app port -v "$port" +ynh_app_setting_set $app port "$port" # install via apt-get sudo apt-get update > /dev/null 2>&1 sudo apt-get install -y mumble-server > /dev/null 2>&1 -#copying conf file +# Copying conf file +mumble_conf="/etc/mumble-server.ini" sudo cp ../conf/mumble-server.ini $mumble_conf sudo chmod 660 $mumble_conf sudo chown :mumble-server $mumble_conf @@ -56,4 +59,4 @@ sudo murmurd -supw $su_passwd sudo /etc/init.d/mumble-server restart #adding mumble as a service -sudo yunohost service add mumble-server -l /var/log/mumble-server/mumble-server.log \ No newline at end of file +sudo yunohost service add mumble-server -l /var/log/mumble-server/mumble-server.log From ca69b2971fb4beac27506b518bbbaa9d0440af1a Mon Sep 17 00:00:00 2001 From: Moul Date: Tue, 23 May 2017 11:23:21 +0200 Subject: [PATCH 03/11] [enh] install: add 'set -eu', retrieve args with env var. --- scripts/install | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/install b/scripts/install index 8ada8c5..b61f040 100644 --- a/scripts/install +++ b/scripts/install @@ -1,17 +1,18 @@ #!/bin/bash - #debug commands #exec > >(tee /tmp/mumble-install.log) #exec 2>&1 -app=mumbleserver +# Exit on command errors and treat unset variables as an error +set -eu # Retrieve arguments -server_password=$1 -su_passwd=$2 -welcometext=$3 -port=$4 -registerName=$5 +app="mumbleserver" +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 # Source YunoHost helpers source /usr/share/yunohost/helpers From fd570fa59fdcddfc613d5618e06e88eaafc7c31d Mon Sep 17 00:00:00 2001 From: Moul Date: Tue, 23 May 2017 11:31:00 +0200 Subject: [PATCH 04/11] [mod] install: install with 'apt', modify conf file then move it. --- scripts/install | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/install b/scripts/install index b61f040..379eda6 100644 --- a/scripts/install +++ b/scripts/install @@ -31,9 +31,16 @@ fi # Save app settings ynh_app_setting_set $app port "$port" -# install via apt-get -sudo apt-get update > /dev/null 2>&1 -sudo apt-get install -y mumble-server > /dev/null 2>&1 +# Install Mumble Debian package via apt +sudo apt update > /dev/null 2>&1 +sudo apt install -y mumble-server > /dev/null 2>&1 + +# Configuring with given settings +mumble_conf="../conf/mumble-server.ini" +sudo sed -i "s/welcometext=.*/welcometext=$welcometext/g" $mumble_conf +sudo sed -i "s/port=.*/port=$port/g" $mumble_conf +sudo sed -i "s/serverpassword=.*/serverpassword=$server_password/g" $mumble_conf +sudo sed -i "s/#registerName=.*/registerName=$registerName/g" $mumble_conf # Copying conf file mumble_conf="/etc/mumble-server.ini" @@ -41,12 +48,6 @@ sudo cp ../conf/mumble-server.ini $mumble_conf sudo chmod 660 $mumble_conf sudo chown :mumble-server $mumble_conf -#configuring with given settings -sudo sed -i "s/welcometext=.*/welcometext=$welcometext/g" $mumble_conf -sudo sed -i "s/port=.*/port=$port/g" $mumble_conf -sudo sed -i "s/serverpassword=.*/serverpassword=$server_password/g" $mumble_conf -sudo sed -i "s/#registerName=.*/registerName=$registerName/g" $mumble_conf - #open port in firewall sudo yunohost firewall allow Both $port > /dev/null 2>&1 sudo yunohost firewall allow --ipv6 Both $port > /dev/null 2>&1 From a11ed07e2829aac41c0ec209381a04dcd55cb777 Mon Sep 17 00:00:00 2001 From: Moul Date: Tue, 23 May 2017 11:33:13 +0200 Subject: [PATCH 05/11] [fix] install: sed do not needs to be done globally on conf file. --- scripts/install | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 379eda6..082e51e 100644 --- a/scripts/install +++ b/scripts/install @@ -37,10 +37,10 @@ sudo apt install -y mumble-server > /dev/null 2>&1 # Configuring with given settings mumble_conf="../conf/mumble-server.ini" -sudo sed -i "s/welcometext=.*/welcometext=$welcometext/g" $mumble_conf -sudo sed -i "s/port=.*/port=$port/g" $mumble_conf -sudo sed -i "s/serverpassword=.*/serverpassword=$server_password/g" $mumble_conf -sudo sed -i "s/#registerName=.*/registerName=$registerName/g" $mumble_conf +sudo sed -i "s/welcometext=.*/welcometext=$welcometext/" $mumble_conf +sudo sed -i "s/port=.*/port=$port/" $mumble_conf +sudo sed -i "s/serverpassword=.*/serverpassword=$server_password/" $mumble_conf +sudo sed -i "s/#registerName=.*/registerName=$registerName/" $mumble_conf # Copying conf file mumble_conf="/etc/mumble-server.ini" From b07dfbdc5681687fb8cc8945d4f1cc43f110ed4f Mon Sep 17 00:00:00 2001 From: Moul Date: Tue, 23 May 2017 11:38:15 +0200 Subject: [PATCH 06/11] [mod] install: 'firewall allow' cmd already open port for ip4 and ip6. Update comments. --- scripts/install | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 082e51e..3bb9ec1 100644 --- a/scripts/install +++ b/scripts/install @@ -48,17 +48,17 @@ sudo cp ../conf/mumble-server.ini $mumble_conf sudo chmod 660 $mumble_conf sudo chown :mumble-server $mumble_conf -#open port in firewall +# Open port in firewall sudo yunohost firewall allow Both $port > /dev/null 2>&1 -sudo yunohost firewall allow --ipv6 Both $port > /dev/null 2>&1 -#starting mumble server +# Start Mumble server sudo /etc/init.d/mumble-server start -#setting super-user password +# Set super-user password sudo murmurd -supw $su_passwd -#restart mumble server + +# Restart Mumble server sudo /etc/init.d/mumble-server restart -#adding mumble as a service +# Add Mumble as a YunoHost service sudo yunohost service add mumble-server -l /var/log/mumble-server/mumble-server.log From 81c9ccc4ee4d3da72615dbcf1bbd40bdb666ea5f Mon Sep 17 00:00:00 2001 From: Moul Date: Tue, 23 May 2017 11:48:11 +0200 Subject: [PATCH 07/11] [mod] remove: enhance reading: break lines, comments. --- scripts/remove | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/remove b/scripts/remove index 6496857..81d3f83 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,14 +1,18 @@ #!/bin/bash app=mumbleserver -#getting port used by mumble to close it + +# Getting port used by mumble to close it port=$(sudo yunohost app setting $app port) -#uninstall mumble and its dependencies + +# Uninstall mumble and its dependencies sudo apt-get autoremove -y mumble-server > /dev/null 2>&1 -#close ports + +# Close ports sudo yunohost firewall disallow Both $port > /dev/null 2>&1 sudo yunohost firewall disallow --ipv6 Both $port > /dev/null 2>&1 -#removing config file + +# Removing config file sudo rm -f /etc/mumble-server.ini # Remove mumble-server service From 244b440fc938b952516028448d721f822fdbd79c Mon Sep 17 00:00:00 2001 From: Moul Date: Tue, 23 May 2017 11:51:39 +0200 Subject: [PATCH 08/11] [enh] remove: add 'set -u', source helpers, retrieve arg with helper. --- scripts/remove | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index 81d3f83..14567a4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,9 +1,15 @@ #!/bin/bash +# Exit and treat unset variables as an error +set -u + +# Source YunoHost helpers +source /usr/share/yunohost/helpers + app=mumbleserver # Getting port used by mumble to close it -port=$(sudo yunohost app setting $app port) +port=$(ynh_app_setting_get $app port) # Uninstall mumble and its dependencies sudo apt-get autoremove -y mumble-server > /dev/null 2>&1 From 80f7ac573326f063da1ab882f13badb54427e697 Mon Sep 17 00:00:00 2001 From: Moul Date: Tue, 23 May 2017 11:56:34 +0200 Subject: [PATCH 09/11] [mod] remove: use apt, 'firewall disallow' alreay does it for IP6. --- scripts/remove | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/remove b/scripts/remove index 14567a4..53bd38f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -11,12 +11,11 @@ app=mumbleserver # Getting port used by mumble to close it port=$(ynh_app_setting_get $app port) -# Uninstall mumble and its dependencies -sudo apt-get autoremove -y mumble-server > /dev/null 2>&1 +# Uninstall Mumble and its dependencies +sudo apt autoremove -y mumble-server > /dev/null 2>&1 # Close ports sudo yunohost firewall disallow Both $port > /dev/null 2>&1 -sudo yunohost firewall disallow --ipv6 Both $port > /dev/null 2>&1 # Removing config file sudo rm -f /etc/mumble-server.ini From 7719f82c34e28c6373ad9d065640dd9775b1b9e6 Mon Sep 17 00:00:00 2001 From: Moul Date: Tue, 23 May 2017 12:03:22 +0200 Subject: [PATCH 10/11] [mod] use 'ynh_die' and 'set -eu'. --- scripts/install | 4 ++-- scripts/upgrade | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 3bb9ec1..4b67ab7 100644 --- a/scripts/install +++ b/scripts/install @@ -20,12 +20,12 @@ source /usr/share/yunohost/helpers # Check port availability sudo yunohost app checkport $port if [[ ! $? -eq 0 ]]; then - exit 1 + ynh_die fi # Check if su_password is not empty if [[ -z "$su_passwd" ]]; then - exit 1 + ynh_die fi # Save app settings diff --git a/scripts/upgrade b/scripts/upgrade index 05a7907..a1a1178 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,2 +1,4 @@ #!/bin/bash +# Exit on command errors and treat unset variables as an error +set -eu From d574f7721bc70845d24e1d50412ef9535cea2830 Mon Sep 17 00:00:00 2001 From: Moul Date: Tue, 23 May 2017 12:26:59 +0200 Subject: [PATCH 11/11] =?UTF-8?q?[mod]=20check=5Fprocess:=20add=20level=20?= =?UTF-8?q?=C2=A7=20and=20force=20level=204=20to=20yes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- check_process | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/check_process b/check_process index 8931f14..bb4a25d 100644 --- a/check_process +++ b/check_process @@ -23,3 +23,15 @@ fail_download_source=0 port_already_use=1 final_path_already_use=0 +;;; Levels + Level 1=auto + Level 2=auto + Level 3=auto + # https://github.com/YunoHost-Apps/mumbleserver_ynh/issues/11 + Level 4=1 + Level 5=auto + Level 6=auto + Level 7=auto + Level 8=0 + Level 9=0 + Level 10=0