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 #40 from YunoHost-Apps/testing

Testing
This commit is contained in:
Éric Gaspar 2021-01-06 08:42:27 +01:00 committed by GitHub
commit d9ece341d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 321 additions and 149 deletions

View file

@ -1,41 +1,69 @@
# Mumble server package for YunoHost # Mumble server for YunoHost
[![Integration level](https://dash.yunohost.org/integration/mumbleserver.svg)](https://dash.yunohost.org/appci/app/mumbleserver) [![Integration level](https://dash.yunohost.org/integration/mumbleserver.svg)](https://dash.yunohost.org/appci/app/mumbleserver) ![](https://ci-apps.yunohost.org/ci/badges/mumbleserver.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/mumbleserver.maintain.svg)
[![Install with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=mumbleserver) [![Install with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mumbleserver)
It installs the Debian package and configures it with given settings. *[Lire ce readme en français.](./README_fr.md)*
Password and other usefull information will be sent to you after installation. > *This package allows you to install Mumble server quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
Mumble is a free, open source, low latency, high quality voice chat application. Mumble was the first VoIP application to establish true low latency voice communication over a decade ago. But low latency and gaming are not the only use cases it shines in.
**Shipped version:** 1.3.0 (source package provided by Debian)
## Screenshots
![](https://www.mumble.info/client-screenshots/connected.png)
#### Setup #### Setup
This package installs the Debian package and configures it with given settings. Password and other usefull information will be sent to you after installation.
- [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 ## Documentation
----------------
* 2014: Package creation was maid by [matlink]](https://github.com/Matlink) * Official documentation: https://wiki.mumble.info/wiki/Main_Page
* 2016: improved and maintained by [Moul](https://github.com/M5oul) * YunoHost documentation: If specific documentation is needed, feel free to contribute.
* 2018: full rewrite and now maintained by [Jibec](https://github.com/Jibec)
**Shipped version:** 1.2.8 (source package provided by Debian) ## YunoHost specific features
# State of this package #### Multi-user support
* works fine: * Are LDAP and HTTP auth supported? **No**
* Can the app be used by multiple users?
* [x] install/remove/backup/remove/upgrade/multi-instance with x86_64 #### Supported architectures
* to be confirmed * x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mumbleserver%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/mumbleserver/)
* [x] ARM support * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mumbleserver%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mumbleserver/)
* [x] Improve systemd protection
* to be added: ## Limitations
* [ ] Improve log file and add logrotate
* Any known limitations.
## Additional information
* Other info you would like to add about this app.
## Links ## Links
* Report a bug about this package: https://github.com/YunoHost-Apps/mumbleserver_ynh * Report a bug about this package: https://github.com/YunoHost-Apps/mumbleserver_ynh
* Report a bug about Mumble itself: https://github.com/mumble-voip/mumble
* Mumble website: https://mumble.info * Mumble website: https://mumble.info
* Report a bug about Mumble itself: https://github.com/mumble-voip/mumble
* YunoHost website: https://yunohost.org * YunoHost website: https://yunohost.org
---
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/mumbleserver_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
sudo yunohost app install https://github.com/YunoHost-Apps/mumbleserver_ynh/tree/testing --debug
or
sudo yunohost app upgrade mumbleserver -u https://github.com/YunoHost-Apps/mumbleserver_ynh/tree/testing --debug
```

69
README_fr.md Normal file
View file

@ -0,0 +1,69 @@
# Mumble server pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/mumbleserver.svg)](https://dash.yunohost.org/appci/app/mumbleserver) ![](https://ci-apps.yunohost.org/ci/badges/mumbleserver.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/mumbleserver.maintain.svg)
[![Installer avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mumbleserver)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Mumble server rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
## Vue d'ensemble
Mumble est une application de chat vocal gratuite, open source, à faible latence et de haute qualité. Mumble a été la première application VoIP à établir une véritable communication vocale à faible latence il y a plus de dix ans. Mais la faible latence et le jeu ne sont pas les seuls cas d'utilisation dans lesquels il brille.
**Version incluse :** 1.3.0 (paquet source fourni par Debian)
## Captures d'écran
![](https://www.mumble.info/client-screenshots/connected.png)
## Configuration
mumbleserver_ynh installe le paquet Debian et le configure avec les paramètres donnés. Le mot de passe et d'autres informations utiles sont envoyés après l'installation.
- [Ajouter l'administrateur](http://wiki.mumble.info/wiki/Murmurguide#Connecting_to_Murmur_Server)
## Documentation
* Documentation officielle : https://wiki.mumble.info/wiki/Main_Page
* Documentation YunoHost : Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer.
## Caractéristiques spécifiques YunoHost
#### Support multi-utilisateur
* L'authentification LDAP et HTTP est-elle prise en charge ? **Non**
* L'application peut-elle être utilisée par plusieurs utilisateurs ?
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mumbleserver%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/mumbleserver/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mumbleserver%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mumbleserver/)
## Limitations
* Limitations connues.
## Informations additionnelles
* Autres informations que vous souhaitez ajouter sur cette application.
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/mumbleserver_ynh
* Site de l'application : https://mumble.info
* Dépôt de l'application principale : https://github.com/mumble-voip/mumble
* Site web YunoHost : https://yunohost.org
---
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/mumbleserver_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/mumbleserver_ynh/tree/testing --debug
ou
sudo yunohost app upgrade mumbleserver -u https://github.com/YunoHost-Apps/mumbleserver_ynh/tree/testing --debug
```

View file

@ -2,7 +2,7 @@
auto_remove=1 auto_remove=1
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld" (DOMAIN)
welcometext="Welcome to my mumble server" welcometext="Welcome to my Mumble server"
registername="Root" registername="Root"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
@ -12,25 +12,14 @@
setup_private=0 setup_private=0
setup_public=0 setup_public=0
upgrade=1 upgrade=1
# latest published in community.json
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
wrong_user=0 wrong_user=0
wrong_path=0 wrong_path=0
incorrect_path=0
port_already_use=0 port_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
;;; Options ;;; Options
Email=jean-baptiste@holcroft.fr Email=
Notification=all Notification=none
;;; Upgrade options
; commit=CommitHash
name=Name and date of the commit.

View file

@ -1,5 +1,5 @@
[Unit] [Unit]
Description=Mumble Server (Murmur, app __APP__) Description=Mumble Server: voice chat application
Requires=network-online.target Requires=network-online.target
After=network.target After=network.target

View file

@ -3,19 +3,23 @@
"id": "mumbleserver", "id": "mumbleserver",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Mumble is a libre, low-latency, high quality voice chat software primarily intended for use while gaming.", "en": "Low-latency, high quality voice chat software (VoIP).",
"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": "Logiciel libre de voix sur IP (VoIP)."
}, },
"version": "1.3.0~ynh1",
"url": "https://mumble.info", "url": "https://mumble.info",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"maintainer": { "maintainer": {
"name": "",
"email": ""
},
"previous_maintainers": [{
"name": "Jean-Baptiste Holcroft", "name": "Jean-Baptiste Holcroft",
"email": "jean-baptiste@holcroft.fr" "email": "jean-baptiste@holcroft.fr"
}, }],
"requirements": { "requirements": {
"yunohost": ">= 3.4.0" "yunohost": ">= 3.8.1"
}, },
"version": "1.2.8~ynh7",
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
], ],
@ -25,24 +29,27 @@
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"ask": { "ask": {
"en": "Choose a domain (used to select the correct certificate)" "en": "Choose a domain (used to select the correct certificate)",
"fr": "Choisissez un domaine (utilisé pour sélectionner le bon certificat)"
}, },
"example": "domain.org" "example": "domain.org"
}, },
{ {
"name": "welcometext", "name": "welcometext",
"type": "string",
"ask": { "ask": {
"en": "Choose a welcome text for your server", "en": "Choose a welcome text for your server",
"fr": "Choisissez un message de bienvenue pour le serveur" "fr": "Choisissez un message de bienvenue pour le serveur"
}, },
"example": "Welcome to my mumble server", "example": "Welcome to my Mumble server",
"default": "Welcome" "default": "Welcome"
}, },
{ {
"name": "registername", "name": "registername",
"type": "string",
"ask": { "ask": {
"en": "Choose a name for the root channel (your mumble server name)", "en": "Choose a name for the root channel (your Mumble server name)",
"fr": "Entrez un nom pour le channel racine (le nom de votre serveur mumble)" "fr": "Entrez un nom pour le channel racine (le nom de votre serveur Mumble)"
}, },
"example": "Root", "example": "Root",
"default": "Root" "default": "Root"

View file

@ -1,5 +1,25 @@
#!/bin/bash #!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
# dependencies used by the app
pkg_dependencies="mumble-server mailutils"
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
# Send an email to inform the administrator # Send an email to inform the administrator
# #
# usage: ynh_send_readme_to_admin app_message [recipients] # usage: ynh_send_readme_to_admin app_message [recipients]
@ -60,4 +80,3 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
# Send the email to the recipients # Send the email to the recipients
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients" echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
} }

View file

@ -6,29 +6,28 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
if [ ! -e _common.sh ]; then source ../settings/scripts/_common.sh
# 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 source /usr/share/yunohost/helpers
#================================================= #=================================================
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
@ -43,3 +42,9 @@ ynh_backup "$final_path"
#================================================= #=================================================
ynh_backup "/etc/systemd/system/$app.service" ynh_backup "/etc/systemd/system/$app.service"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -35,6 +35,7 @@ su_passwd=$(ynh_string_random)
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
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"
@ -42,24 +43,26 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder"
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --weight=2
# Save app settings # Save app settings
ynh_app_setting_set "$app" domain "$domain" ynh_app_setting_set --app=$app --key=domain --value="$domain"
ynh_app_setting_set "$app" no_sso "true" ynh_app_setting_set --app=$app --key=no_sso --value="true"
ynh_app_setting_set "$app" server_password "$server_password" ynh_app_setting_set --app=$app --key=server_password --value="$server_password"
ynh_app_setting_set "$app" su_passwd "$su_passwd" ynh_app_setting_set --app=$app --key=su_passwd --value="$su_passwd"
ynh_app_setting_set "$app" welcometext "$welcometext" ynh_app_setting_set --app=$app --key=welcometext --value="$welcometext"
ynh_app_setting_set "$app" registerName "$registerName" ynh_app_setting_set --app=$app --key=registerName --value="$registerName"
ynh_app_setting_set "$app" instance_id "$instance_id" ynh_app_setting_set --app=$app --key=instance_id --value="$instance_id"
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_script_progression --message="Configuring firewall..." --weight=1
port=$(ynh_find_port 64738) port=$(ynh_find_port 64738)
ynh_app_setting_set "$app" port "$port" ynh_app_setting_set --app=$app --key=port --value=$port
# Open port in firewall # Open port in firewall
yunohost firewall allow Both "$port" yunohost firewall allow Both "$port"
@ -67,9 +70,10 @@ yunohost firewall allow Both "$port"
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=4
# Install Mumble Debian package via apt # Install Mumble Debian package via apt
ynh_install_app_dependencies mumble-server mailutils ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
@ -78,20 +82,20 @@ ynh_install_app_dependencies mumble-server mailutils
#================================================= #=================================================
mkdir -p "$final_path" mkdir -p "$final_path"
ynh_app_setting_set "$app" final_path "$final_path" ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Configuring with given settings # Configuring with given settings
mumble_conf="$final_path/mumble-server.ini" mumble_conf="$final_path/mumble-server.ini"
cp ../conf/mumble-server.ini "$mumble_conf" cp ../conf/mumble-server.ini "$mumble_conf"
ynh_replace_string "__FINALPATH__" "$final_path" "$mumble_conf" ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$mumble_conf"
ynh_replace_string "__APP__" "$app" "$mumble_conf" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$mumble_conf"
ynh_replace_string "__WELCOME__" "$welcometext" "$mumble_conf" ynh_replace_string --match_string="__WELCOME__" --replace_string="$welcometext" --target_file="$mumble_conf"
ynh_replace_string "__PORT__" "$port" "$mumble_conf" ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$mumble_conf"
ynh_replace_string "__SRV_PWD__" "$server_password" "$mumble_conf" ynh_replace_string --match_string="__SRV_PWD__" --replace_string="$server_password" --target_file="$mumble_conf"
ynh_replace_string "__REGISTER__" "$registerName" "$mumble_conf" ynh_replace_string --match_string="__REGISTER__" --replace_string="$registerName" --target_file="$mumble_conf"
ynh_replace_string "__DOMAIN__" "$domain" "$mumble_conf" ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$mumble_conf"
ynh_store_file_checksum "$mumble_conf" ynh_store_file_checksum "$mumble_conf"
@ -130,16 +134,22 @@ murmurd -ini "$mumble_conf" -supw "$su_passwd" "$instance_id" || true
#================================================= #=================================================
systemctl stop mumble-server systemctl stop mumble-server
systemctl disable mumble-server systemctl disable mumble-server --quiet
#================================================= #=================================================
# ADVERTISE SERVICE IN ADMIN PANEL # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
# Add Mumble as a YunoHost service # Add Mumble as a YunoHost service
yunohost service add "$app" -l "/var/log/mumble-server/$app.log" yunohost service add $app --description="Mumble server" --log="/var/log/$app/$app.log" --needs_exposed_ports $port
systemctl restart "$app" #=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=3
ynh_systemd_action --service_name=$app --action=restart #--log_path="/var/log/$app/$app.log"
#================================================= #=================================================
# SEND README TO ADMIN # SEND README TO ADMIN
@ -161,3 +171,9 @@ 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 Please open a new issue in this project: https://github.com/YunoHost-Apps/mumbleserver_ynh
" "
ynh_send_readme_to_admin "$message" ynh_send_readme_to_admin "$message"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -12,12 +12,13 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get "$app" domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get "$app" port) port=$(ynh_app_setting_get --app=$app --key=port)
final_path=$(ynh_app_setting_get "$app" final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -25,15 +26,17 @@ final_path=$(ynh_app_setting_get "$app" final_path)
# REMOVE SERVICE FROM ADMIN PANEL # REMOVE SERVICE FROM ADMIN PANEL
#================================================= #=================================================
if yunohost service status | grep -q "$app" # Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then then
echo "Remove $app service" ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove "$app" yunohost service remove $app
fi fi
#================================================= #=================================================
# STOP AND REMOVE SERVICE # STOP AND REMOVE SERVICE
#================================================= #=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=2
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
@ -41,6 +44,7 @@ ynh_remove_systemd_config
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies ynh_remove_app_dependencies
@ -48,9 +52,10 @@ ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing app main directory..." --weight=2
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove "$final_path" ynh_secure_remove --file="$final_path"
#================================================= #=================================================
# CLOSE A PORT # CLOSE A PORT
@ -58,8 +63,8 @@ ynh_secure_remove "$final_path"
if yunohost firewall list | grep -q "\- $port$" if yunohost firewall list | grep -q "\- $port$"
then then
echo "Close port $port" ynh_script_progression --message="Close port $port" --weight=1
yunohost firewall disallow Both "$port" > /dev/null 2>&1 ynh_exec_warn_less yunohost firewall disallow Both $port
fi fi
#================================================= #=================================================
@ -69,3 +74,9 @@ fi
#================================================= #=================================================
ynh_secure_remove "/var/log/mumble-server/$app.log" ynh_secure_remove "/var/log/mumble-server/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -6,32 +6,29 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
if [ ! -e _common.sh ]; then source ../settings/scripts/_common.sh
# 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 source /usr/share/yunohost/helpers
#================================================= #=================================================
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get "$app" final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d "$final_path" \ test ! -d "$final_path" \
|| ynh_die "There is already a directory: $final_path " || ynh_die "There is already a directory: $final_path "
@ -41,17 +38,19 @@ test ! -d "$final_path" \
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=2
ynh_restore_file "$final_path" ynh_restore_file --origin_path="$final_path"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=4
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies mumble-server mailutils ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE USER RIGHTS
@ -72,20 +71,33 @@ usermod --append --groups ssl-cert mumble-server
#================================================= #=================================================
systemctl stop mumble-server systemctl stop mumble-server
systemctl disable mumble-server systemctl disable mumble-server --quiet
#================================================= #=================================================
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
# Add Mumble as a YunoHost service # Add Mumble as a YunoHost service
yunohost service add "$app" -l "/var/log/mumble-server/$app.log" yunohost service add $app --description="Mumble server" --log="/var/log/$app/$app.log" --needs_exposed_ports $port
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
ynh_restore_file "/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable "$app.service" systemctl enable $app.service --quiet
systemctl restart "$app" #=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=3
ynh_systemd_action --service_name=$app --action=restart #--log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -5,28 +5,37 @@
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get "$app" domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
no_sso=$(ynh_app_setting_get "$app" no_sso) no_sso=$(ynh_app_setting_get --app=$app --key=no_sso)
server_password=$(ynh_app_setting_get "$app" server_password) server_password=$(ynh_app_setting_get --app=$app --key=server_password)
su_passwd=$(ynh_app_setting_get "$app" su_passwd) su_passwd=$(ynh_app_setting_get --app=$app --key=su_passwd)
welcometext=$(ynh_app_setting_get "$app" welcometext) welcometext=$(ynh_app_setting_get --app=$app --key=welcometext)
registerName=$(ynh_app_setting_get "$app" registerName) registerName=$(ynh_app_setting_get --app=$app --key=registerName)
port=$(ynh_app_setting_get "$app" port) port=$(ynh_app_setting_get --app=$app --key=port)
final_path=$(ynh_app_setting_get "$app" final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
instance_id=$(ynh_app_setting_get "$app" instance_id) instance_id=$(ynh_app_setting_get --app=$app --key=instance_id)
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If final_path doesn't exist, create it # If final_path doesn't exist, create it
if [ -z "$final_path" ]; then if [ -z "$final_path" ]; then
@ -58,16 +67,16 @@ if [ -z "$server_password" ]; then
| head -1 \ | head -1 \
| sed -r "s/.* (([a-z])*\.([a-z])*).*/\1/g") | sed -r "s/.* (([a-z])*\.([a-z])*).*/\1/g")
ynh_app_setting_set "$app" server_password "$server_password" ynh_app_setting_set --app=$app --key=server_password --value=$server_password
ynh_app_setting_set "$app" welcometext "$welcometext" ynh_app_setting_set --app=$app --key=welcometext --value=$welcometext
ynh_app_setting_set "$app" registerName "$registerName" ynh_app_setting_set --app=$app --key=registerName --value=$registerName
ynh_app_setting_set "$app" su_passwd "$su_passwd" ynh_app_setting_set --app=$app --key=su_passwd --value=$su_passwd
ynh_app_setting_set "$app" domain "$domain" ynh_app_setting_set --app=$app --key=domain --value=$domain
systemctl stop mumble-server systemctl stop mumble-server
dpkg-reconfigure mumble-server --frontend=Noninteractive dpkg-reconfigure mumble-server --frontend=Noninteractive
systemctl stop mumble-server systemctl stop mumble-server
systemctl disable mumble-server systemctl disable mumble-server --quiet
fi fi
# Fix SSO issue # Fix SSO issue
@ -90,10 +99,10 @@ if [ -z "$instance_id" ]; then
ynh_app_setting_set "$app" instance_id "$instance_id" ynh_app_setting_set "$app" instance_id "$instance_id"
fi fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -105,18 +114,13 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# source and user are provided by debian's package, no web interface
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=6
# Install Mumble Debian package via apt # Install Mumble Debian package via apt
ynh_install_app_dependencies mumble-server mailutils ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
@ -133,19 +137,20 @@ ynh_backup_if_checksum_is_different "$mumble_conf"
cp ../conf/mumble-server.ini "$mumble_conf" cp ../conf/mumble-server.ini "$mumble_conf"
ynh_replace_string "__FINALPATH__" "$final_path" "$mumble_conf" ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$mumble_conf"
ynh_replace_string "__APP__" "$app" "$mumble_conf" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$mumble_conf"
ynh_replace_string "__WELCOME__" "$welcometext" "$mumble_conf" ynh_replace_string --match_string="__WELCOME__" --replace_string="$welcometext" --target_file="$mumble_conf"
ynh_replace_string "__PORT__" "$port" "$mumble_conf" ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$mumble_conf"
ynh_replace_string "__SRV_PWD__" "$server_password" "$mumble_conf" ynh_replace_string --match_string="__SRV_PWD__" --replace_string="$server_password" --target_file="$mumble_conf"
ynh_replace_string "__REGISTER__" "$registerName" "$mumble_conf" ynh_replace_string --match_string="__REGISTER__" --replace_string="$registerName" --target_file="$mumble_conf"
ynh_replace_string "__DOMAIN__" "$domain" "$mumble_conf" ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$mumble_conf"
ynh_store_file_checksum "$mumble_conf" ynh_store_file_checksum "$mumble_conf"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
@ -178,16 +183,21 @@ murmurd -ini "$mumble_conf" -supw "$su_passwd" "$instance_id" || true
#================================================= #=================================================
systemctl stop mumble-server systemctl stop mumble-server
systemctl disable mumble-server systemctl disable mumble-server --quiet
#================================================= #=================================================
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
# Add Mumble as a YunoHost service # Add Mumble as a YunoHost service
yunohost service add "$app" -l "/var/log/mumble-server/$app.log" yunohost service add $app --description="Mumble server" --log="/var/log/$app/$app.log" --needs_exposed_ports $port
systemctl restart "$app" #=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=3
ynh_systemd_action --service_name=$app --action=restart #--log_path="/var/log/$app/$app.log"
#================================================= #=================================================
# SEND README TO ADMIN # SEND README TO ADMIN
@ -211,3 +221,9 @@ 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 Please open a new issue in this project: https://github.com/YunoHost-Apps/mumbleserver_ynh
" "
ynh_send_readme_to_admin "$message" ynh_send_readme_to_admin "$message"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last