diff --git a/README.md b/README.md
index c209948..4ad74d3 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,18 @@
# Mumble server package for YunoHost
-It install the Debian package and configures it with given settings.
+It installs the Debian package and configures it with given settings.
+
+Password and other usefull information will be sent to you after installation.
#### Setup
- [Add the admin](http://wiki.mumble.info/wiki/Murmurguide#Connecting_to_Murmur_Server)
+
+#### Maintainers & history
+----------------
+
+2014: Package creation was maid by [matlink]](https://github.com/Matlink)
+
+2016: improved and maintained by [Moul](https://github.com/M5oul)
+
+2018: full rewrote and now maintained by [Jibec](https://github.com/Jibec)
diff --git a/check_process b/check_process
index bb4a25d..f19ea2e 100644
--- a/check_process
+++ b/check_process
@@ -1,10 +1,8 @@
;; Test complet
auto_remove=1
; Manifest
- server_login_password="super_secret_password" (PASSWORD)
- password="super_secret_password"
+ domain="domain.tld" (DOMAIN)
welcometext="Welcome to my mumble server"
- port="64738" (PORT)
registername="Root"
; Checks
pkg_linter=1
@@ -14,15 +12,14 @@
setup_private=0
setup_public=0
upgrade=1
+ # latest published in community.json
+ upgrade=1 from_commit=c3f4863564b17be1cb8193f6962668bcc0d92072
backup_restore=1
- multi_instance=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
+ port_already_use=0
;;; Levels
Level 1=auto
Level 2=auto
diff --git a/conf/mumble-server.ini b/conf/mumble-server.ini
index 6d6836f..7111565 100644
--- a/conf/mumble-server.ini
+++ b/conf/mumble-server.ini
@@ -13,7 +13,7 @@
# Path to database. If blank, will search for
# murmur.sqlite in default locations or create it if not found.
-database=/var/lib/mumble-server/mumble-server.sqlite
+database=__FINALPATH__/mumble-server.sqlite
# If you wish to use something other than SQLite, you'll need to set the name
# of the database above, and also uncomment the below.
@@ -72,30 +72,30 @@ icesecretwrite=
# logs to the file 'murmur.log'. If you leave this field blank
# on Unix-like systems, Murmur will force itself into foreground
# mode which logs to the console.
-logfile=/var/log/mumble-server/mumble-server.log
+logfile=/var/log/mumble-server/__APP__.log
# If set, Murmur will write its process ID to this file
# when running in daemon mode (when the -fg flag is not
# specified on the command line). Only available on
# Unix-like systems.
-pidfile=/var/run/mumble-server/mumble-server.pid
+pidfile=/var/run/mumble-server/__APP__.pid
# The below will be used as defaults for new configured servers.
# If you're just running one server (the default), it's easier to
# configure it here than through D-Bus or Ice.
#
# Welcome message sent to clients when they connect.
-welcometext="
Welcome to this server running Murmur.
Enjoy your stay!
"
+welcometext="__WELCOME__"
# Port to bind TCP and UDP sockets to.
-port=64738
+port=__PORT__
# Specific IP or hostname to bind to.
# If this is left blank (default), Murmur will bind to all available addresses.
#host=
# Password to join server.
-serverpassword=
+serverpassword=__SRV_PWD__
# Maximum bandwidth (in bits per second) clients are allowed
# to send speech at.
@@ -143,7 +143,7 @@ users=100
# addresses.
# Only uncomment the 'registerName' parameter if you wish to give your "Root" channel a custom name.
#
-#registerName=Mumble Server
+registerName=__REGISTER__
#registerPassword=secret
#registerUrl=http://mumble.sourceforge.net/
#registerHostname=
@@ -157,8 +157,8 @@ users=100
# If you have a proper SSL certificate, you can provide the filenames here.
# Otherwise, Murmur will create it's own certificate automatically.
-#sslCert=
-#sslKey=
+sslCert=/etc/yunohost/certs/__DOMAIN__/crt.pem
+sslKey=/etc/yunohost/certs/__DOMAIN__/key.pem
# If Murmur is started as root, which user should it switch to?
# This option is ignored if Murmur isn't started with root privileges.
diff --git a/conf/systemd.service b/conf/systemd.service
new file mode 100644
index 0000000..7f0e148
--- /dev/null
+++ b/conf/systemd.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Mumble Server (Murmur, app __APP__)
+Requires=network-online.target
+After=network.target
+
+[Service]
+User=mumble-server
+Group=mumble-server
+Type=forking
+ExecStart=/usr/sbin/murmurd -ini __FINALPATH__/mumble-server.ini
+PIDFile=/var/run/mumble-server/__APP__.pid
+ExecReload=/bin/kill -s HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
diff --git a/manifest.json b/manifest.json
index fd6a149..44c9e28 100644
--- a/manifest.json
+++ b/manifest.json
@@ -7,37 +7,28 @@
"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": "https://mumble.info",
- "license": "free",
+ "license": "BSD-3-Clause",
"maintainer": {
- "name": "Moul",
- "email": "moul@moul.re"
+ "name": "jibec",
+ "email": "jean-baptiste@holcroft.fr"
},
"requirements": {
- "yunohost": ">> 2.4.0"
+ "yunohost": ">= 2.7.10"
},
- "multi_instance": false,
+ "version": "1.2.8-2",
+ "multi_instance": true,
"services": [
],
"arguments": {
"install" : [
- {
- "name": "server_login_password",
- "type": "password",
- "ask": {
- "en": "Choose a password for your mumble server. This password is given to persons who want to join",
- "fr": "Choisissez un mot de passe pour votre serveur Mumble. Ce mot de passe sera donné aux personnes qui veulent rejoindre le serveur"
- },
- "example": "super_secret_password"
- },
- {
- "name": "password",
- "type": "password",
- "ask": {
- "en": "Choose a password for the SuperUser. This is different from the server password and allows you to create the first admin.",
- "fr": "Choisissez un mot de passe pour le SuperUser. Il est différent du mot de passe du serveur et permet de créer le premier Administrateur."
- },
- "example": "super_secret_password"
- },
+ {
+ "name": "domain",
+ "type": "domain",
+ "ask": {
+ "en": "Choose a domain (used to select the correct certificate)"
+ },
+ "example": "domain.org"
+ },
{
"name": "welcometext",
"ask": {
@@ -46,15 +37,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
new file mode 100644
index 0000000..12587b9
--- /dev/null
+++ b/scripts/_common.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+# Send an email to inform the administrator
+#
+# usage: ynh_send_readme_to_admin app_message [recipients]
+# | arg: app_message - The message to send to the administrator.
+# | arg: recipients - The recipients of this email. Use spaces to separate multiples recipients. - default: root
+# example: "root admin@domain"
+# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
+# example: "root admin@domain user1 user2"
+ynh_send_readme_to_admin() {
+ local app_message="${1:-...No specific information...}"
+ local recipients="${2:-root}"
+
+ # Retrieve the email of users
+ find_mails () {
+ local list_mails="$1"
+ local mail
+ local recipients=" "
+ # Read each mail in argument
+ for mail in $list_mails
+ do
+ # Keep root or a real email address as it is
+ if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
+ then
+ recipients="$recipients $mail"
+ else
+ # But replace an user name without a domain after by its email
+ if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
+ then
+ recipients="$recipients $mail"
+ fi
+ fi
+ done
+ echo "$recipients"
+ }
+ recipients=$(find_mails "$recipients")
+
+ local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!"
+
+ local mail_message="This is an automated message from your beloved YunoHost server.
+Specific information for the application $app.
+$app_message
+---
+Automatic diagnosis data from YunoHost
+$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
+
+ # Send the email to the recipients
+ echo "$mail_message" | mail -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
+}
diff --git a/scripts/backup b/scripts/backup
new file mode 100644
index 0000000..bf8bc99
--- /dev/null
+++ b/scripts/backup
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+#=================================================
+# GENERIC START
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
+if [ ! -e _common.sh ]; then
+ # Get the _common.sh file if it's not in the current directory
+ cp ../settings/scripts/_common.sh ./_common.sh
+ chmod a+rx _common.sh
+fi
+source _common.sh
+source /usr/share/yunohost/helpers
+
+#=================================================
+# MANAGE SCRIPT FAILURE
+#=================================================
+
+# Exit if an error occurs during the execution of the script
+ynh_abort_if_errors
+
+
+#=================================================
+# LOAD SETTINGS
+#=================================================
+
+app=$YNH_APP_INSTANCE_NAME
+
+final_path=$(ynh_app_setting_get $app final_path)
+
+#=================================================
+# STANDARD BACKUP STEPS
+#=================================================
+# BACKUP THE APP MAIN DIR
+#=================================================
+
+ynh_backup "$final_path"
+
+#=================================================
+# BACKUP SYSTEMD
+#=================================================
+
+ynh_backup "/etc/systemd/system/$app.service"
diff --git a/scripts/install b/scripts/install
index 4b67ab7..b9d0d28 100644
--- a/scripts/install
+++ b/scripts/install
@@ -1,64 +1,155 @@
#!/bin/bash
-#debug commands
-#exec > >(tee /tmp/mumble-install.log)
-#exec 2>&1
-# Exit on command errors and treat unset variables as an error
-set -eu
+# doc: https://wiki.mumble.info/wiki/Running_Murmur
-# Retrieve arguments
-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
+#=================================================
+# GENERIC START
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
-# Source YunoHost helpers
+source _common.sh
source /usr/share/yunohost/helpers
-# Check port availability
-sudo yunohost app checkport $port
-if [[ ! $? -eq 0 ]]; then
- ynh_die
-fi
+#=================================================
+# MANAGE SCRIPT FAILURE
+#=================================================
-# Check if su_password is not empty
-if [[ -z "$su_passwd" ]]; then
- ynh_die
-fi
+# Exit if an error occurs during the execution of the script
+ynh_abort_if_errors
+
+#=================================================
+# RETRIEVE ARGUMENTS FROM THE MANIFEST
+#=================================================
+
+# Retrieve arguments
+domain=$YNH_APP_ARG_DOMAIN
+app=$YNH_APP_INSTANCE_NAME
+welcometext=$YNH_APP_ARG_WELCOMETEXT
+registerName=$YNH_APP_ARG_REGISTERNAME
+
+server_password=$(ynh_string_random)
+su_passwd=$(ynh_string_random)
+
+#=================================================
+# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
+#=================================================
+
+final_path=/var/www/$app
+test ! -e "$final_path" || ynh_die "This path already contains a folder"
+
+#=================================================
+# STORE SETTINGS FROM MANIFEST
+#=================================================
# Save app settings
-ynh_app_setting_set $app port "$port"
+ynh_app_setting_set "$app" domain "$domain"
+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"
+ynh_app_setting_set "$app" registerName "$registerName"
-# Install Mumble Debian package via apt
-sudo apt update > /dev/null 2>&1
-sudo apt install -y mumble-server > /dev/null 2>&1
+#=================================================
+# STANDARD MODIFICATIONS
+#=================================================
+# FIND AND OPEN A PORT
+#=================================================
-# Configuring with given settings
-mumble_conf="../conf/mumble-server.ini"
-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"
-sudo cp ../conf/mumble-server.ini $mumble_conf
-sudo chmod 660 $mumble_conf
-sudo chown :mumble-server $mumble_conf
+port=$(ynh_find_port 64738)
+ynh_app_setting_set "$app" port "$port"
# Open port in firewall
-sudo yunohost firewall allow Both $port > /dev/null 2>&1
+yunohost firewall allow Both "$port"
-# Start Mumble server
-sudo /etc/init.d/mumble-server start
+#=================================================
+# INSTALL DEPENDENCIES
+#=================================================
-# Set super-user password
-sudo murmurd -supw $su_passwd
+# Install Mumble Debian package via apt
+ynh_install_app_dependencies mumble-server mailutils
-# Restart Mumble server
-sudo /etc/init.d/mumble-server restart
+#=================================================
+# SPECIFIC SETUP
+#=================================================
+# mumble server conf.ini
+#=================================================
+
+mkdir -p "$final_path"
+ynh_app_setting_set "$app" final_path "$final_path"
+
+# Configuring with given settings
+mumble_conf="$final_path/mumble-server.ini"
+
+cp ../conf/mumble-server.ini "$mumble_conf"
+
+ynh_replace_string "__FINALPATH__" "$final_path" "$mumble_conf"
+ynh_replace_string "__APP__" "$app" "$mumble_conf"
+ynh_replace_string "__WELCOME__" "$welcometext" "$mumble_conf"
+ynh_replace_string "__PORT__" "$port" "$mumble_conf"
+ynh_replace_string "__SRV_PWD__" "$server_password" "$mumble_conf"
+ynh_replace_string "__REGISTER__" "$registerName" "$mumble_conf"
+ynh_replace_string "__DOMAIN__" "$domain" "$mumble_conf"
+
+ynh_store_file_checksum "$mumble_conf"
+
+#=================================================
+# SETUP SYSTEMD
+#=================================================
+
+# Create a dedicated systemd config
+ynh_add_systemd_config
+
+#=================================================
+# Start services
+#=================================================
+
+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
+"
+ynh_send_readme_to_admin "$message"
+
+#=================================================
+# GENERIC FINALIZATION
+#=================================================
+# SECURE FILES AND DIRECTORIES
+#=================================================
+
+chmod -R 770 "$final_path"
+chown -R :mumble-server "$final_path"
+
+#=================================================
+# Add user to ssl-cert so it can read certificates
+#=================================================
+
+usermod --append --groups ssl-cert mumble-server
+
+#=================================================
+# Disable default server installed by Debian's package
+#=================================================
+
+systemctl stop mumble-server
+systemctl disable mumble-server
+
+#=================================================
+# ADVERTISE SERVICE IN ADMIN PANEL
+#=================================================
# Add Mumble as a YunoHost service
-sudo yunohost service add mumble-server -l /var/log/mumble-server/mumble-server.log
+yunohost service add "$app" -l "/var/log/mumble-server/$app.log"
+
+systemctl restart "$app"
diff --git a/scripts/remove b/scripts/remove
index 53bd38f..32ef767 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -1,24 +1,71 @@
#!/bin/bash
-# Exit and treat unset variables as an error
-set -u
+#=================================================
+# GENERIC START
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
-# Source YunoHost helpers
+source _common.sh
source /usr/share/yunohost/helpers
-app=mumbleserver
+#=================================================
+# LOAD SETTINGS
+#=================================================
-# Getting port used by mumble to close it
-port=$(ynh_app_setting_get $app port)
+app=$YNH_APP_INSTANCE_NAME
-# Uninstall Mumble and its dependencies
-sudo apt autoremove -y mumble-server > /dev/null 2>&1
+domain=$(ynh_app_setting_get "$app" domain)
+port=$(ynh_app_setting_get "$app" port)
+final_path=$(ynh_app_setting_get "$app" final_path)
-# Close ports
-sudo yunohost firewall disallow Both $port > /dev/null 2>&1
+#=================================================
+# STANDARD REMOVE
+#=================================================
+# STOP AND REMOVE SERVICE
+#=================================================
-# Removing config file
-sudo rm -f /etc/mumble-server.ini
+# Remove the dedicated systemd config
+ynh_remove_systemd_config
-# Remove mumble-server service
-sudo yunohost service remove mumble-server
+#=================================================
+# REMOVE SERVICE FROM ADMIN PANEL
+#=================================================
+
+if yunohost service status | grep -q "$app"
+then
+ echo "Remove $app service"
+ yunohost service remove "$app"
+fi
+
+#=================================================
+# REMOVE DEPENDENCIES
+#=================================================
+
+# Remove metapackage and its dependencies
+ynh_remove_app_dependencies
+
+#=================================================
+# REMOVE APP MAIN DIR
+#=================================================
+
+# Remove the app directory securely
+ynh_secure_remove "$final_path"
+
+#=================================================
+# CLOSE A PORT
+#=================================================
+
+if yunohost firewall list | grep -q "\- $port$"
+then
+ echo "Close port $port"
+ yunohost firewall disallow Both "$port" > /dev/null 2>&1
+fi
+
+#=================================================
+# SPECIFIC REMOVE
+#=================================================
+# REMOVE OTHER FILES
+#=================================================
+
+ynh_secure_remove "/var/log/mumble-server/$app.log"
diff --git a/scripts/restore b/scripts/restore
new file mode 100644
index 0000000..414c8c6
--- /dev/null
+++ b/scripts/restore
@@ -0,0 +1,91 @@
+#!/bin/bash
+
+#=================================================
+# GENERIC START
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
+if [ ! -e _common.sh ]; then
+ # Get the _common.sh file if it's not in the current directory
+ cp ../settings/scripts/_common.sh ./_common.sh
+ chmod a+rx _common.sh
+fi
+source _common.sh
+source /usr/share/yunohost/helpers
+
+#=================================================
+# MANAGE SCRIPT FAILURE
+#=================================================
+
+# Exit if an error occurs during the execution of the script
+ynh_abort_if_errors
+
+#=================================================
+# LOAD SETTINGS
+#=================================================
+
+app=$YNH_APP_INSTANCE_NAME
+
+final_path=$(ynh_app_setting_get "$app" final_path)
+
+#=================================================
+# CHECK IF THE APP CAN BE RESTORED
+#=================================================
+
+test ! -d "$final_path" \
+ || ynh_die "There is already a directory: $final_path "
+
+#=================================================
+# STANDARD RESTORATION STEPS
+#=================================================
+# RESTORE THE APP MAIN DIR
+#=================================================
+
+ynh_restore_file "$final_path"
+
+#=================================================
+# SPECIFIC RESTORATION
+#=================================================
+# REINSTALL DEPENDENCIES
+#=================================================
+
+# Define and install dependencies
+ynh_install_app_dependencies mumble-server mailutils
+
+#=================================================
+# RESTORE USER RIGHTS
+#=================================================
+
+# Restore permissions on app files
+chmod -R 770 "$final_path"
+chown -R :mumble-server "$final_path"
+
+#=================================================
+# Add user to ssl-cert so it can read certificates
+#=================================================
+
+usermod --append --groups ssl-cert mumble-server
+
+#=================================================
+# Disable default server installed by Debian's package
+#=================================================
+
+systemctl stop mumble-server
+systemctl disable mumble-server
+
+#=================================================
+# ADVERTISE SERVICE IN ADMIN PANEL
+#=================================================
+
+# Add Mumble as a YunoHost service
+yunohost service add "$app" -l "/var/log/mumble-server/$app.log"
+
+#=================================================
+# RESTORE SYSTEMD
+#=================================================
+
+ynh_restore_file "/etc/systemd/system/$app.service"
+systemctl enable "$app.service"
+
+systemctl restart "$app"
diff --git a/scripts/upgrade b/scripts/upgrade
index a1a1178..016b4ad 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -1,4 +1,184 @@
#!/bin/bash
-# Exit on command errors and treat unset variables as an error
-set -eu
+#=================================================
+# GENERIC START
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+source _common.sh
+source /usr/share/yunohost/helpers
+
+#=================================================
+# LOAD SETTINGS
+#=================================================
+
+app=$YNH_APP_INSTANCE_NAME
+
+domain=$(ynh_app_setting_get "$app" domain)
+server_password=$(ynh_app_setting_get "$app" server_password)
+su_passwd=$(ynh_app_setting_get "$app" su_passwd)
+welcometext=$(ynh_app_setting_get "$app" welcometext)
+registerName=$(ynh_app_setting_get "$app" registerName)
+port=$(ynh_app_setting_get "$app" port)
+final_path=$(ynh_app_setting_get "$app" final_path)
+
+#=================================================
+# ENSURE DOWNWARD COMPATIBILITY
+#=================================================
+
+# If final_path doesn't exist, create it
+if [ -z "$final_path" ]; then
+ final_path=/var/www/$app
+ ynh_app_setting_set "$app" final_path "$final_path"
+fi
+
+# test old time
+if [ -z "$server_password" ]; then
+ old_mumble_conf="/etc/mumble-server.ini"
+
+ server_password=$(cat "$old_mumble_conf" \
+ | grep "serverpassword=" \
+ | sed "s/serverpassword=//")
+
+ welcometext=$(cat "$old_mumble_conf" \
+ | grep "welcometext=" \
+ | sed "s/welcometext=//")
+
+ registerName=$(cat "$old_mumble_conf" \
+ | grep "registerName=" \
+ | sed "s/registerName=//")
+
+ # we don't know what the previous password was, let's regenerate it
+ su_passwd=$(ynh_string_random)
+
+ domain=$(yunohost domain list \
+ | grep "\- " \
+ | head -1 \
+ | sed -r "s/.* (([a-z])*\.([a-z])*).*/\1/g")
+
+ ynh_app_setting_set "$app" server_password "$server_password"
+ ynh_app_setting_set "$app" welcometext "$welcometext"
+ ynh_app_setting_set "$app" registerName "$registerName"
+ ynh_app_setting_set "$app" su_passwd "$su_passwd"
+ ynh_app_setting_set "$app" domain "$domain"
+
+ systemctl stop mumble-server
+ dpkg-reconfigure mumble-server --frontend=Noninteractive
+ systemctl stop mumble-server
+ systemctl disable mumble-server
+fi
+
+#=================================================
+# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
+#=================================================
+
+# Backup the current version of the app
+# ynh_backup_before_upgrade
+# ynh_clean_setup () {
+ # restore it if the upgrade fails
+# ynh_restore_upgradebackup
+# }
+
+# Exit if an error occurs during the execution of the script
+ynh_abort_if_errors
+
+#=================================================
+# STANDARD UPGRADE STEPS
+#=================================================
+
+# source and user are provided by debian's package, no web interface
+
+#=================================================
+# INSTALL DEPENDENCIES
+#=================================================
+
+# Install Mumble Debian package via apt
+ynh_install_app_dependencies mumble-server mailutils
+
+#=================================================
+# SPECIFIC UPGRADE
+#=================================================
+# mumble server conf.ini
+#=================================================
+
+mkdir -p $final_path
+
+# Configuring with given settings
+mumble_conf="$final_path/mumble-server.ini"
+
+cp ../conf/mumble-server.ini "$mumble_conf"
+
+ynh_replace_string "__FINALPATH__" "$final_path" "$mumble_conf"
+ynh_replace_string "__APP__" "$app" "$mumble_conf"
+ynh_replace_string "__WELCOME__" "$welcometext" "$mumble_conf"
+ynh_replace_string "__PORT__" "$port" "$mumble_conf"
+ynh_replace_string "__SRV_PWD__" "$server_password" "$mumble_conf"
+ynh_replace_string "__REGISTER__" "$registerName" "$mumble_conf"
+ynh_replace_string "__DOMAIN__" "$domain" "$mumble_conf"
+
+ynh_store_file_checksum "$mumble_conf"
+
+#=================================================
+# SETUP SYSTEMD
+#=================================================
+
+# Create a dedicated systemd config
+ynh_add_systemd_config
+
+#=================================================
+# Start services
+#=================================================
+
+mkdir -p /var/run/mumble-server/
+murmurd -ini "$mumble_conf" -supw "$su_passwd"
+
+#=================================================
+# Start services
+#=================================================
+
+message="
+Mumbleserver was updated!
+
+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
+"
+ynh_send_readme_to_admin "$message"
+
+#=================================================
+# GENERIC FINALIZATION
+#=================================================
+# SECURE FILES AND DIRECTORIES
+#=================================================
+
+chmod -R 770 "$final_path"
+chown -R :mumble-server "$final_path"
+
+#=================================================
+# Add user to ssl-cert so it can read certificates
+#=================================================
+
+usermod --append --groups ssl-cert mumble-server
+
+#=================================================
+# Disable default server installed by Debian's package
+#=================================================
+
+systemctl stop mumble-server
+systemctl disable mumble-server
+
+#=================================================
+# ADVERTISE SERVICE IN ADMIN PANEL
+#=================================================
+
+# Add Mumble as a YunoHost service
+yunohost service add "$app" -l "/var/log/mumble-server/$app.log"
+
+systemctl restart "$app"