diff --git a/README.md b/README.md index 02c676a..6816cf8 100644 --- a/README.md +++ b/README.md @@ -19,26 +19,12 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in 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.4~ynh1 +**Shipped version:** 1.3.4~ynh2 ## Screenshots ![Screenshot of Mumble Server](./doc/screenshots/Mumble.png) -## Disclaimers / important information - -## Setup - -This package installs the Debian package and configures it with given settings. Password and other usefull information will be sent by email after installation. - -- [Add the admin](http://wiki.mumble.info/wiki/Murmurguide#Connecting_to_Murmur_Server) - -## Config -If you need to change password of the server/superuser -1- edit `/var/www/mumbleserver/mumble-server.ini` -2- remove (or change) the password for serverpassword= -3- restart mumbleserver - ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index f658f71..2020494 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,26 +18,12 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po 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.4~ynh1 +**Version incluse :** 1.3.4~ynh2 ## Captures d’écran ![Capture d’écran de Mumble Server](./doc/screenshots/Mumble.png) -## Avertissements / informations importantes - -## 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 par email après l'installation. - -- [Ajouter l'administrateur](http://wiki.mumble.info/wiki/Murmurguide#Connecting_to_Murmur_Server) - -## Configuration -Si vous devez changer le mot de passe du serveur/superutilisateur -1- éditez `/var/www/mumbleserver/mumble-server.ini` -2- supprimer (ou changer) le mot de passe pour serverpassword= -3- redémarrer mumbleserver - ## Documentations et ressources * Site officiel de l’app : diff --git a/conf/mumble-server.ini b/conf/mumble-server.ini index 921fd80..9929e2f 100644 --- a/conf/mumble-server.ini +++ b/conf/mumble-server.ini @@ -13,7 +13,7 @@ ; Path to database. If blank, will search for ; murmur.sqlite in default locations or create it if not found. -database=__FINALPATH__/mumble-server.sqlite +database=__INSTALL_DIR__/mumble-server.sqlite ; Murmur defaults to using SQLite with its default rollback journal. ; In some situations, using SQLite's write-ahead log (WAL) can be diff --git a/conf/systemd.service b/conf/systemd.service index 8079600..32d9edf 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ User=mumble-server Group=mumble-server Type=forking RuntimeDirectory=mumble-server -ExecStart=/usr/sbin/murmurd -ini __FINALPATH__/mumble-server.ini +ExecStart=/usr/sbin/murmurd -ini __INSTALL_DIR__/mumble-server.ini PIDFile=/var/run/mumble-server/__APP__.pid ExecReload=/bin/kill -s HUP $MAINPID PrivateDevices=true @@ -17,7 +17,7 @@ ProtectHome=true ProtectSystem=strict ProtectControlGroups=yes ProtectKernelModules=yes -ReadWritePaths=__FINALPATH__ /var/log/mumble-server /var/run/mumble-server +ReadWritePaths=__INSTALL_DIR__ /var/log/mumble-server /var/run/mumble-server [Install] WantedBy=multi-user.target diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 89% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md index 5372115..c80f615 100644 --- a/doc/DISCLAIMER.md +++ b/doc/ADMIN.md @@ -6,6 +6,6 @@ This package installs the Debian package and configures it with given settings. ## Config If you need to change password of the server/superuser -1- edit `/var/www/mumbleserver/mumble-server.ini` +1- edit `__INSTALL_DIR__/mumble-server.ini` 2- remove (or change) the password for serverpassword= 3- restart mumbleserver diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md similarity index 90% rename from doc/DISCLAIMER_fr.md rename to doc/ADMIN_fr.md index d8612db..aef7804 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/ADMIN_fr.md @@ -6,6 +6,6 @@ mumbleserver_ynh installe le paquet Debian et le configure avec les paramètres ## Configuration Si vous devez changer le mot de passe du serveur/superutilisateur -1- éditez `/var/www/mumbleserver/mumble-server.ini` +1- éditez `__INSTALL_DIR__/mumble-server.ini` 2- supprimer (ou changer) le mot de passe pour serverpassword= 3- redémarrer mumbleserver diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md new file mode 100644 index 0000000..948debe --- /dev/null +++ b/doc/POST_INSTALL.md @@ -0,0 +1,10 @@ +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) : __INSTALL_DIR__ +Mumble configuration file : __INSTALL_DIR__/mumble-server.ini + +Note about config file: this package will regenerate the config file on upgrade. +If you changed it manually and upgrade mumble, you'll find a backup in __INSTALL_DIR__. diff --git a/doc/POST_INSTALL_fr.md b/doc/POST_INSTALL_fr.md new file mode 100644 index 0000000..7c3e8d4 --- /dev/null +++ b/doc/POST_INSTALL_fr.md @@ -0,0 +1,10 @@ +Port : __PORT__ +Mot de passe pour rejoindre le serveur : __SERVER_PASSWORD__ +Mot de passe superutilisateur : __SU_PASSWD__ +Texte de bienvenue : __WELCOMETEXT__ +Canal racine (nom de votre serveur Mumble) : __REGISTERNAME__ +Chemin final (où trouver vos fichiers) : __INSTALL_DIR__ +Fichier de configuration Mumble : __INSTALL_DIR__/mumble-server.ini + +Remarque sur le fichier de configuration : ce package régénérera le fichier de configuration lors de la mise à niveau. +Si vous l'avez modifié manuellement et mis à niveau Mumble, vous trouverez une sauvegarde dans __INSTALL_DIR__. \ No newline at end of file diff --git a/manifest.json b/manifest.json deleted file mode 100644 index aed4e25..0000000 --- a/manifest.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "Mumble Server", - "id": "mumbleserver", - "packaging_format": 1, - "description": { - "en": "Low-latency, high quality voice chat software (VoIP)", - "fr": "Logiciel libre de voix sur IP (VoIP)" - }, - "version": "1.3.4~ynh1", - "url": "https://mumble.info", - "upstream": { - "license": "BSD-3-Clause", - "website": "https://mumble.info", - "admindoc": "https://wiki.mumble.info/wiki/Main_Page", - "code": "https://github.com/mumble-voip/mumble" - }, - "license": "BSD-3-Clause", - "maintainer": { - "name": "", - "email": "" - }, - "previous_maintainers": [{ - "name": "Jean-Baptiste Holcroft", - "email": "jean-baptiste@holcroft.fr" - }], - "requirements": { - "yunohost": ">= 11.0.9" - }, - "multi_instance": true, - "services": [ - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "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", - "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/manifest.toml b/manifest.toml new file mode 100644 index 0000000..fa51621 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,62 @@ +packaging_format = 2 + +id = "mumbleserver" +name = "Mumble Server" +description.en = "Low-latency, high quality voice chat software (VoIP)" +description.fr = "Logiciel libre de voix sur IP (VoIP)" + +version = "1.3.4~ynh2" + +maintainers = [] + +[upstream] +license = "BSD-3-Clause" +website = "https://mumble.info" +admindoc = "https://wiki.mumble.info/wiki/Main_Page" +code = "https://github.com/mumble-voip/mumble" + +[integration] +yunohost = ">= 11.2" +architectures = "all" +multi_instance = true + +ldap = "not_relevant" + +sso = "not_relevant" + +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" + +[install] + [install.domain] + type = "domain" + + [install.welcometext] + ask.en = "Choose a welcome text for your server" + ask.fr = "Choisissez un message de bienvenue pour le serveur" + type = "string" + example = "Welcome to my Mumble server" + default = "Welcome" + + [install.registername] + ask.en = "Choose a name for the root channel (your Mumble server name)" + ask.fr = "Entrez un nom pour le channel racine (le nom de votre serveur Mumble)" + type = "string" + example = "Root" + default = "Root" + +[resources] + + [resources.ports] + main.default = 64738 + main.exposed = "Both" + + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + + [resources.apt] + packages = "mumble-server, mailutils" diff --git a/scripts/_common.sh b/scripts/_common.sh index f37c864..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -pkg_dependencies="mumble-server mailutils" - #================================================= # PERSONAL HELPERS #================================================= @@ -18,65 +15,3 @@ pkg_dependencies="mumble-server mailutils" #================================================= # FUTURE OFFICIAL HELPERS #================================================= - - -# 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')" - - # Define binary to use for mail command - if [ -e /usr/bin/bsd-mailx ] - then - local mail_bin=/usr/bin/bsd-mailx - else - local mail_bin=/usr/bin/mail.mailutils - fi - - # 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 2850990..ac5b947 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,22 +10,6 @@ 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=$app --key=final_path) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= @@ -35,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP SYSTEMD diff --git a/scripts/install b/scripts/install index 6fb3fda..982910f 100644 --- a/scripts/install +++ b/scripts/install @@ -11,91 +11,37 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -domain=$YNH_APP_ARG_DOMAIN -welcometext=$YNH_APP_ARG_WELCOMETEXT -registername=$YNH_APP_ARG_REGISTERNAME -instance_id=$YNH_APP_INSTANCE_NUMBER - -app=$YNH_APP_INSTANCE_NAME - server_password=$(ynh_string_random) 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 --message="This path already contains a folder" +instance_id=$YNH_APP_INSTANCE_NUMBER #================================================= # STORE SETTINGS FROM MANIFEST #================================================= ynh_script_progression --message="Storing installation settings..." --weight=2 -# Save app settings -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="Finding an available port..." --weight=1 - -# Find an available port -port=$(ynh_find_port --port=64738) -ynh_app_setting_set --app=$app --key=port --value=$port - -# Open the port -ynh_script_progression --message="Configuring firewall..." --weight=1 -ynh_exec_warn_less yunohost firewall allow Both $port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=4 - -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - #================================================= # SPECIFIC SETUP #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." +ynh_script_progression --message="Adding a configuration file..." --weight=2 -mkdir -p "$final_path" -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +mkdir -p "$install_dir" -# Configuring with given settings -mumble_conf="$final_path/mumble-server.ini" +ynh_add_config --template="mumble-server.ini" --destination="$install_dir/mumble-server.ini" -ynh_add_config --template="../conf/mumble-server.ini" --destination="$mumble_conf" - -chmod -R 770 "$final_path" -chown -R :mumble-server "$final_path" +chmod -R 770 "$install_dir" +chown -R :mumble-server "$install_dir" #================================================= # ADD USER TO SSL-CERT @@ -110,7 +56,7 @@ usermod --append --groups ssl-cert mumble-server # || true temporarily to ignore a bug in murmurd 1.3.0 # https://github.com/mumble-voip/mumble/issues/3911 -ynh_exec_warn_less murmurd -ini "$mumble_conf" -supw "$su_passwd" "$instance_id" || true +#ynh_exec_warn_less murmurd -ini "$install_dir/mumble-server.ini" -supw "$su_passwd" "$instance_id" || true #================================================= # Disable default server installed by Debian's package @@ -119,21 +65,9 @@ ynh_exec_warn_less murmurd -ini "$mumble_conf" -supw "$su_passwd" "$instance_id" systemctl stop mumble-server systemctl disable mumble-server --quiet -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." - # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - yunohost service add $app --description="Mumble server" --log="/var/log/mumble-server/$app.log" --needs_exposed_ports="$port" #================================================= @@ -143,27 +77,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=3 ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/mumble-server/$app.log" -#================================================= -# SEND README TO ADMIN -#================================================= - -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 - -Note about config file: this package will regenerate the config file on upgrade. -If you changed it manually and upgrade mumble, you'll find a backup in $final_path. - -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 #================================================= diff --git a/scripts/remove b/scripts/remove index b62bf3d..4f1a654 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,17 +9,6 @@ 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=$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 #================================================= @@ -33,47 +22,9 @@ then 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 -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing app main directory..." --weight=2 - -# Remove the app directory securely -ynh_secure_remove --file="$final_path" - -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." --weight=1 - ynh_exec_warn_less yunohost firewall disallow Both $port -fi - -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." - ynh_secure_remove --file="/var/log/mumble-server/$app.log" #================================================= diff --git a/scripts/restore b/scripts/restore index 15ada36..cceb9fb 100644 --- a/scripts/restore +++ b/scripts/restore @@ -10,34 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ynh_clean_check_starting -} -# 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=$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 --message="There is already a directory: $final_path " - #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -45,25 +17,15 @@ test ! -d $final_path \ #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=2 -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 $pkg_dependencies +ynh_restore_file --origin_path="$install_dir" #================================================= # RESTORE USER RIGHTS #================================================= # Restore permissions on app files -chmod -R 770 "$final_path" -chown -R :mumble-server "$final_path" +chmod -R 770 "$install_dir" +chown -R :mumble-server "$install_dir" #================================================= # Add user to ssl-cert so it can read certificates diff --git a/scripts/upgrade b/scripts/upgrade index 557f6cd..0ece539 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,45 +9,12 @@ 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=$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 #================================================= -ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# 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 -ynh_clean_setup () { - ynh_clean_check_starting - # 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 #================================================= @@ -55,21 +22,15 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" +ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/mumble-server/$app.log" #================================================= # 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 - final_path=/var/www/$app - ynh_app_setting_set "$app" final_path "$final_path" -fi - # test old time -if [ -z "$server_password" ]; then +if [ -z "${server_password:-}" ]; then old_mumble_conf="/etc/mumble-server.ini" server_password=$(cat "$old_mumble_conf" \ @@ -96,7 +57,6 @@ if [ -z "$server_password" ]; then 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 @@ -106,37 +66,22 @@ fi # Fix SSO issue # https://github.com/YunoHost-Apps/mumbleserver_ynh/issues/19 -if [ -z "$domain" ]; then - domain=$(ynh_app_setting_get "$app" domain_mumble) - ynh_app_setting_set "$app" domain "$domain" - ynh_app_setting_delete "$app" domain_mumble -fi - -# Fix SSO issue -# https://github.com/YunoHost-Apps/mumbleserver_ynh/issues/19 -if [ -z "$no_sso" ]; then - ynh_app_setting_set "$app" no_sso "true" +if [ -z "${no_sso:-}" ]; then + ynh_app_setting_set --app="$app" --key=no_sso --value="true" fi # Fix multi installation -if [ -z "$instance_id" ]; then +if [ -z "${instance_id:-}" ]; then instance_id=$YNH_APP_INSTANCE_NUMBER - ynh_app_setting_set "$app" instance_id "$instance_id" + ynh_app_setting_set --app="$app" instance_id --value="$instance_id" fi -if [ -z "$registername" ]; then - registername=$(ynh_app_setting_get "$app" registerName) - ynh_app_setting_set "$app" registername "$registername" +if [ -z "${registername:-}" ]; then + registername=$(ynh_app_setting_get "$app" registerName) + ynh_app_setting_set --app="$app" --key=registername --value="$registername" ynh_app_setting_delete "$app" registerName fi -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=6 - -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - #================================================= # SPECIFIC UPGRADE #================================================= @@ -144,15 +89,12 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 -mkdir -p $final_path +mkdir -p $install_dir -# Configuring with given settings -mumble_conf="$final_path/mumble-server.ini" +ynh_add_config --template="mumble-server.ini" --destination="$install_dir/mumble-server.ini" -ynh_add_config --template="../conf/mumble-server.ini" --destination="$mumble_conf" - -chmod -R 770 "$final_path" -chown -R :mumble-server "$final_path" +chmod -R 770 "$install_dir" +chown -R :mumble-server "$install_dir" #================================================= # Add user to ssl-cert so it can read certificates @@ -166,7 +108,7 @@ usermod --append --groups ssl-cert mumble-server # || true temporarily to ignore a bug in murmurd 1.3.0 # https://github.com/mumble-voip/mumble/issues/3911 -murmurd -ini "$mumble_conf" -supw "$su_passwd" "$instance_id" || true +#murmurd -ini "$install_dir/mumble-server.ini" -supw "$su_passwd" "$instance_id" || true #================================================= # Disable default server installed by Debian's package @@ -183,13 +125,6 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - # Add Mumble as a YunoHost service yunohost service add $app --description="Mumble server" --log="/var/log/mumble-server/$app.log" --needs_exposed_ports="$port" @@ -200,29 +135,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=3 ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/mumble-server/$app.log" -#================================================= -# SEND README TO ADMIN -#================================================= - -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 - -Note about config file: this package will regenerate the config file on upgrade. -If you changed it manually and upgrade mumble, you'll find a backup in /home/yunohost.conf/backup/var/www/mumbleserver/. - -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 #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..5386c8a --- /dev/null +++ b/tests.toml @@ -0,0 +1,16 @@ +test_format = 1.0 + +[default] + + # ------------ + # Tests to run + # ------------ + + exclude = ["install.subdir", "change_url"] # The test IDs to be used in only/exclude statements are: install.root, install.subdir, install.nourl, install.multi, backup_restore, upgrade, upgrade.someCommitId change_url + + # ------------------------------- + # Default args to use for install + # ------------------------------- + + args.welcometext="Welcome to my Mumble server" + args.registername="Root" \ No newline at end of file