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

Merge pull request #14 from Jibec/master

Rework
This commit is contained in:
Jean-Baptiste 2018-05-23 20:18:13 +02:00 committed by GitHub
commit 265d8f95d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 621 additions and 112 deletions

View file

@ -1,7 +1,18 @@
# Mumble server package for YunoHost # 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 #### Setup
- [Add the admin](http://wiki.mumble.info/wiki/Murmurguide#Connecting_to_Murmur_Server) - [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)

View file

@ -1,10 +1,8 @@
;; Test complet ;; Test complet
auto_remove=1 auto_remove=1
; Manifest ; Manifest
server_login_password="super_secret_password" (PASSWORD) domain="domain.tld" (DOMAIN)
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
@ -14,15 +12,14 @@
setup_private=0 setup_private=0
setup_public=0 setup_public=0
upgrade=1 upgrade=1
# latest published in community.json
upgrade=1 from_commit=c3f4863564b17be1cb8193f6962668bcc0d92072
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=1
wrong_user=0 wrong_user=0
wrong_path=0 wrong_path=0
incorrect_path=0 incorrect_path=0
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,7 +13,7 @@
# Path to database. If blank, will search for # Path to database. If blank, will search for
# murmur.sqlite in default locations or create it if not found. # 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 # 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. # 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 # logs to the file 'murmur.log'. If you leave this field blank
# on Unix-like systems, Murmur will force itself into foreground # on Unix-like systems, Murmur will force itself into foreground
# mode which logs to the console. # 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 # If set, Murmur will write its process ID to this file
# when running in daemon mode (when the -fg flag is not # when running in daemon mode (when the -fg flag is not
# specified on the command line). Only available on # specified on the command line). Only available on
# Unix-like systems. # 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. # The below will be used as defaults for new configured servers.
# If you're just running one server (the default), it's easier to # If you're just running one server (the default), it's easier to
# configure it here than through D-Bus or Ice. # configure it here than through D-Bus or Ice.
# #
# Welcome message sent to clients when they connect. # Welcome message sent to clients when they connect.
welcometext="<br />Welcome to this server running <b>Murmur</b>.<br />Enjoy your stay!<br />" welcometext="__WELCOME__"
# Port to bind TCP and UDP sockets to. # Port to bind TCP and UDP sockets to.
port=64738 port=__PORT__
# Specific IP or hostname to bind to. # Specific IP or hostname to bind to.
# If this is left blank (default), Murmur will bind to all available addresses. # If this is left blank (default), Murmur will bind to all available addresses.
#host= #host=
# Password to join server. # Password to join server.
serverpassword= serverpassword=__SRV_PWD__
# Maximum bandwidth (in bits per second) clients are allowed # Maximum bandwidth (in bits per second) clients are allowed
# to send speech at. # to send speech at.
@ -143,7 +143,7 @@ users=100
# addresses. # addresses.
# Only uncomment the 'registerName' parameter if you wish to give your "Root" channel a custom name. # Only uncomment the 'registerName' parameter if you wish to give your "Root" channel a custom name.
# #
#registerName=Mumble Server registerName=__REGISTER__
#registerPassword=secret #registerPassword=secret
#registerUrl=http://mumble.sourceforge.net/ #registerUrl=http://mumble.sourceforge.net/
#registerHostname= #registerHostname=
@ -157,8 +157,8 @@ users=100
# If you have a proper SSL certificate, you can provide the filenames here. # If you have a proper SSL certificate, you can provide the filenames here.
# Otherwise, Murmur will create it's own certificate automatically. # Otherwise, Murmur will create it's own certificate automatically.
#sslCert= sslCert=/etc/yunohost/certs/__DOMAIN__/crt.pem
#sslKey= sslKey=/etc/yunohost/certs/__DOMAIN__/key.pem
# If Murmur is started as root, which user should it switch to? # If Murmur is started as root, which user should it switch to?
# This option is ignored if Murmur isn't started with root privileges. # This option is ignored if Murmur isn't started with root privileges.

15
conf/systemd.service Normal file
View file

@ -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

View file

@ -7,36 +7,27 @@
"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." "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", "url": "https://mumble.info",
"license": "free", "license": "BSD-3-Clause",
"maintainer": { "maintainer": {
"name": "Moul", "name": "jibec",
"email": "moul@moul.re" "email": "jean-baptiste@holcroft.fr"
}, },
"requirements": { "requirements": {
"yunohost": ">> 2.4.0" "yunohost": ">= 2.7.10"
}, },
"multi_instance": false, "version": "1.2.8-2",
"multi_instance": true,
"services": [ "services": [
], ],
"arguments": { "arguments": {
"install" : [ "install" : [
{ {
"name": "server_login_password", "name": "domain",
"type": "password", "type": "domain",
"ask": { "ask": {
"en": "Choose a password for your mumble server. This password is given to persons who want to join", "en": "Choose a domain (used to select the correct certificate)"
"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" "example": "domain.org"
},
{
"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": "welcometext", "name": "welcometext",
@ -46,15 +37,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": {

50
scripts/_common.sh Normal file
View file

@ -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"
}

45
scripts/backup Normal file
View file

@ -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"

View file

@ -1,64 +1,155 @@
#!/bin/bash #!/bin/bash
#debug commands
#exec > >(tee /tmp/mumble-install.log)
#exec 2>&1
# Exit on command errors and treat unset variables as an error # doc: https://wiki.mumble.info/wiki/Running_Murmur
set -eu
# Retrieve arguments #=================================================
app="mumbleserver" # GENERIC START
server_password=$YNH_APP_ARG_SERVER_LOGIN_PASSWORD #=================================================
su_passwd=$YNH_APP_ARG_PASSWORD # IMPORT GENERIC HELPERS
welcometext=$YNH_APP_ARG_WELCOMETEXT #=================================================
port=$YNH_APP_ARG_PORT
registerName=$YNH_APP_ARG_REGISTERNAME
# Source YunoHost helpers source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
# Check port availability #=================================================
sudo yunohost app checkport $port # MANAGE SCRIPT FAILURE
if [[ ! $? -eq 0 ]]; then #=================================================
ynh_die
fi
# Check if su_password is not empty # Exit if an error occurs during the execution of the script
if [[ -z "$su_passwd" ]]; then ynh_abort_if_errors
ynh_die
fi #=================================================
# 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 # 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 # STANDARD MODIFICATIONS
sudo apt install -y mumble-server > /dev/null 2>&1 #=================================================
# FIND AND OPEN A PORT
#=================================================
# Configuring with given settings port=$(ynh_find_port 64738)
mumble_conf="../conf/mumble-server.ini" ynh_app_setting_set "$app" port "$port"
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
# Open port in firewall # 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 # Install Mumble Debian package via apt
sudo murmurd -supw $su_passwd 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 # 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"

View file

@ -1,24 +1,71 @@
#!/bin/bash #!/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 source /usr/share/yunohost/helpers
app=mumbleserver #=================================================
# LOAD SETTINGS
#=================================================
# Getting port used by mumble to close it app=$YNH_APP_INSTANCE_NAME
port=$(ynh_app_setting_get $app port)
# Uninstall Mumble and its dependencies domain=$(ynh_app_setting_get "$app" domain)
sudo apt autoremove -y mumble-server > /dev/null 2>&1 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 # Remove the dedicated systemd config
sudo rm -f /etc/mumble-server.ini 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"

91
scripts/restore Normal file
View file

@ -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"

View file

@ -1,4 +1,184 @@
#!/bin/bash #!/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"