diff --git a/README.md b/README.md index 2b7f31a..3c6f3ec 100644 --- a/README.md +++ b/README.md @@ -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) -[![Install with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?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.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 +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) -#### Maintainers & history ----------------- +## Documentation -* 2014: Package creation was maid by [matlink]](https://github.com/Matlink) -* 2016: improved and maintained by [Moul](https://github.com/M5oul) -* 2018: full rewrite and now maintained by [Jibec](https://github.com/Jibec) + * Official documentation: https://wiki.mumble.info/wiki/Main_Page + * YunoHost documentation: If specific documentation is needed, feel free to contribute. -**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 - * [x] ARM support - * [x] Improve systemd protection +* 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/) -* to be added: - * [ ] Improve log file and add logrotate +## Limitations + +* Any known limitations. + +## Additional information + +* Other info you would like to add about this app. ## Links * 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 + * Report a bug about Mumble itself: https://github.com/mumble-voip/mumble * 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 +``` diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..cfe8323 --- /dev/null +++ b/README_fr.md @@ -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 +``` diff --git a/check_process b/check_process index d0c50d7..c9ec543 100644 --- a/check_process +++ b/check_process @@ -2,7 +2,7 @@ auto_remove=1 ; Manifest domain="domain.tld" (DOMAIN) - welcometext="Welcome to my mumble server" + welcometext="Welcome to my Mumble server" registername="Root" ; Checks pkg_linter=1 @@ -12,25 +12,14 @@ setup_private=0 setup_public=0 upgrade=1 - # latest published in community.json backup_restore=1 multi_instance=1 wrong_user=0 wrong_path=0 - incorrect_path=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 -Email=jean-baptiste@holcroft.fr -Notification=all \ No newline at end of file +Email= +Notification=none +;;; Upgrade options + ; commit=CommitHash + name=Name and date of the commit. diff --git a/conf/systemd.service b/conf/systemd.service index c2bb296..ecce853 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=Mumble Server (Murmur, app __APP__) +Description=Mumble Server: voice chat application Requires=network-online.target After=network.target diff --git a/manifest.json b/manifest.json index 4b587f6..bc23f41 100644 --- a/manifest.json +++ b/manifest.json @@ -3,49 +3,56 @@ "id": "mumbleserver", "packaging_format": 1, "description": { - "en": "Mumble is a libre, low-latency, high quality voice chat software primarily intended for use while gaming.", - "fr": "Mumble est un logiciel libre de voix sur IP (VoIP), son principal usage étant la communication pendant les parties de jeux en réseau." + "en": "Low-latency, high quality voice chat software (VoIP).", + "fr": "Logiciel libre de voix sur IP (VoIP)." }, + "version": "1.3.0~ynh1", "url": "https://mumble.info", "license": "BSD-3-Clause", "maintainer": { + "name": "", + "email": "" + }, + "previous_maintainers": [{ "name": "Jean-Baptiste Holcroft", "email": "jean-baptiste@holcroft.fr" - }, + }], "requirements": { - "yunohost": ">= 3.4.0" + "yunohost": ">= 3.8.1" }, - "version": "1.2.8~ynh7", "multi_instance": true, "services": [ ], "arguments": { "install" : [ { - "name": "domain", - "type": "domain", - "ask": { - "en": "Choose a domain (used to select the correct certificate)" + "name": "domain", + "type": "domain", + "ask": { + "en": "Choose a domain (used to select the correct certificate)", + "fr": "Choisissez un domaine (utilisé pour sélectionner le bon certificat)" }, "example": "domain.org" }, { - "name": "welcometext", - "ask": { - "en": "Choose a welcome text for your server", - "fr": "Choisissez un message de bienvenue pour le serveur" - }, - "example": "Welcome to my mumble server", - "default": "Welcome" + "name": "welcometext", + "type": "string", + "ask": { + "en": "Choose a welcome text for your server", + "fr": "Choisissez un message de bienvenue pour le serveur" + }, + "example": "Welcome to my Mumble server", + "default": "Welcome" }, { - "name": "registername", - "ask": { - "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)" - }, - "example": "Root", - "default": "Root" + "name": "registername", + "type": "string", + "ask": { + "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)" + }, + "example": "Root", + "default": "Root" } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index fba63ec..f37c864 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,5 +1,25 @@ #!/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 # # 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 echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients" } - diff --git a/scripts/backup b/scripts/backup index bf8bc99..68b7974 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,29 +6,28 @@ # 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 ../settings/scripts/_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 #================================================= +ynh_print_info --message="Loading installation settings..." 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 @@ -43,3 +42,9 @@ ynh_backup "$final_path" #================================================= 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)." diff --git a/scripts/install b/scripts/install index b202953..6201b00 100644 --- a/scripts/install +++ b/scripts/install @@ -35,6 +35,7 @@ su_passwd=$(ynh_string_random) #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= +ynh_script_progression --message="Validating installation parameters..." --weight=1 final_path=/var/www/$app 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 #================================================= +ynh_script_progression --message="Storing installation settings..." --weight=2 # Save app settings -ynh_app_setting_set "$app" domain "$domain" -ynh_app_setting_set "$app" no_sso "true" -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" -ynh_app_setting_set "$app" instance_id "$instance_id" +ynh_app_setting_set --app=$app --key=domain --value="$domain" +ynh_app_setting_set --app=$app --key=no_sso --value="true" +ynh_app_setting_set --app=$app --key=server_password --value="$server_password" +ynh_app_setting_set --app=$app --key=su_passwd --value="$su_passwd" +ynh_app_setting_set --app=$app --key=welcometext --value="$welcometext" +ynh_app_setting_set --app=$app --key=registerName --value="$registerName" +ynh_app_setting_set --app=$app --key=instance_id --value="$instance_id" #================================================= # STANDARD MODIFICATIONS #================================================= # FIND AND OPEN A PORT #================================================= +ynh_script_progression --message="Configuring firewall..." --weight=1 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 yunohost firewall allow Both "$port" @@ -67,9 +70,10 @@ yunohost firewall allow Both "$port" #================================================= # INSTALL DEPENDENCIES #================================================= +ynh_script_progression --message="Installing dependencies..." --weight=4 # Install Mumble Debian package via apt -ynh_install_app_dependencies mumble-server mailutils +ynh_install_app_dependencies $pkg_dependencies #================================================= # SPECIFIC SETUP @@ -78,20 +82,20 @@ ynh_install_app_dependencies mumble-server mailutils #================================================= 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 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_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$mumble_conf" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$mumble_conf" +ynh_replace_string --match_string="__WELCOME__" --replace_string="$welcometext" --target_file="$mumble_conf" +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$mumble_conf" +ynh_replace_string --match_string="__SRV_PWD__" --replace_string="$server_password" --target_file="$mumble_conf" +ynh_replace_string --match_string="__REGISTER__" --replace_string="$registerName" --target_file="$mumble_conf" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$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 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 -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 @@ -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 " ynh_send_readme_to_admin "$message" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index 30e8f7c..1a65607 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,12 +12,13 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get "$app" domain) -port=$(ynh_app_setting_get "$app" port) -final_path=$(ynh_app_setting_get "$app" final_path) +domain=$(ynh_app_setting_get --app=$app --key=domain) +port=$(ynh_app_setting_get --app=$app --key=port) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE @@ -25,15 +26,17 @@ final_path=$(ynh_app_setting_get "$app" final_path) # 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 - echo "Remove $app service" - yunohost service remove "$app" + ynh_script_progression --message="Removing $app service integration..." --weight=1 + yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= +ynh_script_progression --message="Stopping and removing the systemd service..." --weight=2 # Remove the dedicated systemd config ynh_remove_systemd_config @@ -41,6 +44,7 @@ ynh_remove_systemd_config #================================================= # REMOVE DEPENDENCIES #================================================= +ynh_script_progression --message="Removing dependencies..." --weight=1 # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -48,9 +52,10 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= +ynh_script_progression --message="Removing app main directory..." --weight=2 # Remove the app directory securely -ynh_secure_remove "$final_path" +ynh_secure_remove --file="$final_path" #================================================= # CLOSE A PORT @@ -58,8 +63,8 @@ ynh_secure_remove "$final_path" if yunohost firewall list | grep -q "\- $port$" then - echo "Close port $port" - yunohost firewall disallow Both "$port" > /dev/null 2>&1 + ynh_script_progression --message="Close port $port" --weight=1 + ynh_exec_warn_less yunohost firewall disallow Both $port fi #================================================= @@ -69,3 +74,9 @@ fi #================================================= ynh_secure_remove "/var/log/mumble-server/$app.log" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 414c8c6..6aeb760 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,32 +6,29 @@ # 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 ../settings/scripts/_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 #================================================= +ynh_script_progression --message="Loading installation settings..." --weight=1 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 #================================================= +ynh_script_progression --message="Validating restoration parameters..." --weight=1 test ! -d "$final_path" \ || ynh_die "There is already a directory: $final_path " @@ -41,17 +38,19 @@ test ! -d "$final_path" \ #================================================= # 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 #================================================= # REINSTALL DEPENDENCIES #================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=4 # Define and install dependencies -ynh_install_app_dependencies mumble-server mailutils +ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE USER RIGHTS @@ -72,20 +71,33 @@ usermod --append --groups ssl-cert mumble-server #================================================= systemctl stop mumble-server -systemctl disable mumble-server +systemctl disable mumble-server --quiet #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 # 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 #================================================= +ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 -ynh_restore_file "/etc/systemd/system/$app.service" -systemctl enable "$app.service" +ynh_restore_file --origin_path="/etc/systemd/system/$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 diff --git a/scripts/upgrade b/scripts/upgrade index a257cd2..a045d9c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -5,28 +5,37 @@ #================================================= # IMPORT GENERIC HELPERS #================================================= + source _common.sh source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get "$app" domain) -no_sso=$(ynh_app_setting_get "$app" no_sso) -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) -instance_id=$(ynh_app_setting_get "$app" instance_id) +domain=$(ynh_app_setting_get --app=$app --key=domain) +no_sso=$(ynh_app_setting_get --app=$app --key=no_sso) +server_password=$(ynh_app_setting_get --app=$app --key=server_password) +su_passwd=$(ynh_app_setting_get --app=$app --key=su_passwd) +welcometext=$(ynh_app_setting_get --app=$app --key=welcometext) +registerName=$(ynh_app_setting_get --app=$app --key=registerName) +port=$(ynh_app_setting_get --app=$app --key=port) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +instance_id=$(ynh_app_setting_get --app=$app --key=instance_id) + +#================================================= +# CHECK VERSION +#================================================= + +upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # If final_path doesn't exist, create it if [ -z "$final_path" ]; then @@ -58,16 +67,16 @@ if [ -z "$server_password" ]; then | 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" + ynh_app_setting_set --app=$app --key=server_password --value=$server_password + ynh_app_setting_set --app=$app --key=welcometext --value=$welcometext + ynh_app_setting_set --app=$app --key=registerName --value=$registerName + ynh_app_setting_set --app=$app --key=su_passwd --value=$su_passwd + ynh_app_setting_set --app=$app --key=domain --value=$domain systemctl stop mumble-server dpkg-reconfigure mumble-server --frontend=Noninteractive systemctl stop mumble-server - systemctl disable mumble-server + systemctl disable mumble-server --quiet fi # Fix SSO issue @@ -90,10 +99,10 @@ if [ -z "$instance_id" ]; then ynh_app_setting_set "$app" instance_id "$instance_id" fi - #================================================= # 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 ynh_backup_before_upgrade @@ -105,18 +114,13 @@ ynh_clean_setup () { # 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 #================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=6 # Install Mumble Debian package via apt -ynh_install_app_dependencies mumble-server mailutils +ynh_install_app_dependencies $pkg_dependencies #================================================= # SPECIFIC UPGRADE @@ -133,19 +137,20 @@ ynh_backup_if_checksum_is_different "$mumble_conf" 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_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$mumble_conf" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$mumble_conf" +ynh_replace_string --match_string="__WELCOME__" --replace_string="$welcometext" --target_file="$mumble_conf" +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$mumble_conf" +ynh_replace_string --match_string="__SRV_PWD__" --replace_string="$server_password" --target_file="$mumble_conf" +ynh_replace_string --match_string="__REGISTER__" --replace_string="$registerName" --target_file="$mumble_conf" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$mumble_conf" ynh_store_file_checksum "$mumble_conf" #================================================= # SETUP SYSTEMD #================================================= +ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 # Create a dedicated 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 disable mumble-server +systemctl disable mumble-server --quiet #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= # 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 @@ -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 " ynh_send_readme_to_admin "$message" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Upgrade of $app completed" --last