From 6ab9c0a2ecfa01c73b796e5da43d4ce518b84206 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 1 Aug 2020 23:53:10 +0200 Subject: [PATCH 1/6] clean up --- README.md | 1 - scripts/_common.sh | 20 ++++++++++++++++++++ scripts/install | 13 +++++++------ scripts/upgrade | 6 ++++++ 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2b7f31a..da8e852 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ 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 ----------------- * 2014: Package creation was maid by [matlink]](https://github.com/Matlink) * 2016: improved and maintained by [Moul](https://github.com/M5oul) diff --git a/scripts/_common.sh b/scripts/_common.sh index fba63ec..7eda170 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] diff --git a/scripts/install b/scripts/install index b202953..3424aa5 100644 --- a/scripts/install +++ b/scripts/install @@ -59,7 +59,7 @@ ynh_app_setting_set "$app" instance_id "$instance_id" #================================================= 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" @@ -69,7 +69,8 @@ yunohost firewall allow Both "$port" #================================================= # Install Mumble Debian package via apt -ynh_install_app_dependencies mumble-server mailutils + +ynh_install_app_dependencies $pkg_dependencies #================================================= # SPECIFIC SETUP @@ -109,13 +110,13 @@ ynh_add_systemd_config #================================================= chmod -R 770 "$final_path" -chown -R :mumble-server "$final_path" +chown -R :$app "$final_path" #================================================= # Add user to ssl-cert so it can read certificates #================================================= -usermod --append --groups ssl-cert mumble-server +usermod --append --groups ssl-cert $app #================================================= # Set SuperUser password @@ -129,8 +130,8 @@ murmurd -ini "$mumble_conf" -supw "$su_passwd" "$instance_id" || true # Disable default server installed by Debian's package #================================================= -systemctl stop mumble-server -systemctl disable mumble-server +systemctl stop $app +systemctl disable $app #================================================= # ADVERTISE SERVICE IN ADMIN PANEL diff --git a/scripts/upgrade b/scripts/upgrade index a257cd2..d269e51 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -211,3 +211,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 From edbfa2b313dc603c524479e6b4f0a9fbfc439047 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 2 Aug 2020 00:00:11 +0200 Subject: [PATCH 2/6] clean up --- README.md | 2 +- conf/systemd.service | 4 ++-- scripts/backup | 22 ++++++++++++++-------- scripts/install | 27 +++++++++++++++++---------- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index da8e852..ecf128a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 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) diff --git a/conf/systemd.service b/conf/systemd.service index c2bb296..31275cd 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -4,8 +4,8 @@ Requires=network-online.target After=network.target [Service] -User=mumble-server -Group=mumble-server +User=__APP__ +Group=__APP__ Type=forking # https://www.freedesktop.org/software/systemd/man/systemd.exec.html#RuntimeDirectory= RuntimeDirectory=mumble-server diff --git a/scripts/backup b/scripts/backup index bf8bc99..1f89b94 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,12 +6,7 @@ # 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 #================================================= @@ -21,14 +16,19 @@ source /usr/share/yunohost/helpers # 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 +43,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 3424aa5..b54b615 100644 --- a/scripts/install +++ b/scripts/install @@ -44,13 +44,13 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder" #================================================= # 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 @@ -79,7 +79,7 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= 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" @@ -134,11 +134,12 @@ systemctl stop $app systemctl disable $app #================================================= -# 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" systemctl restart "$app" @@ -162,3 +163,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 From a6807a7e80f97e266e8a35fed9cf57d428bfa52f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 4 Nov 2020 22:35:27 +0100 Subject: [PATCH 3/6] Update manifest.json --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 4b587f6..cd2c274 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "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)." }, "url": "https://mumble.info", "license": "BSD-3-Clause", From d9385b38a78c3dff26bf440c4f5e8caa2f9c0f60 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 9 Nov 2020 19:31:21 +0100 Subject: [PATCH 4/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ecf128a..eb438dd 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Password and other usefull information will be sent to you after installation. * 2016: improved and maintained by [Moul](https://github.com/M5oul) * 2018: full rewrite and now maintained by [Jibec](https://github.com/Jibec) -**Shipped version:** 1.2.8 (source package provided by Debian) +**Shipped version:** 1.3.0 # State of this package From 7ba6701e8775ef6dbbb8b5733e108b2d23bc46e7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 9 Nov 2020 19:37:07 +0100 Subject: [PATCH 5/6] Fix --- README.md | 4 ---- scripts/restore | 9 ++------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index eb438dd..0dda1be 100644 --- a/README.md +++ b/README.md @@ -21,10 +21,6 @@ Password and other usefull information will be sent to you after installation. # State of this package -* works fine: - - * [x] install/remove/backup/remove/upgrade/multi-instance with x86_64 - * to be confirmed * [x] ARM support * [x] Improve systemd protection diff --git a/scripts/restore b/scripts/restore index 414c8c6..cadf1d0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,12 +6,7 @@ # 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 #================================================= @@ -51,7 +46,7 @@ ynh_restore_file "$final_path" #================================================= # Define and install dependencies -ynh_install_app_dependencies mumble-server mailutils +ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE USER RIGHTS From 84ff5383b21829909b9af6904a42e65f9ff0cb3e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 19 Nov 2020 19:30:35 +0100 Subject: [PATCH 6/6] fix --- check_process | 10 ---------- scripts/_common.sh | 1 - scripts/backup | 1 - scripts/install | 19 +++++++++++-------- scripts/restore | 8 +++++++- scripts/upgrade | 28 ++++++++++++++++++---------- 6 files changed, 36 insertions(+), 31 deletions(-) diff --git a/check_process b/check_process index d0c50d7..efd1980 100644 --- a/check_process +++ b/check_process @@ -20,17 +20,7 @@ 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 diff --git a/scripts/_common.sh b/scripts/_common.sh index 7eda170..f37c864 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -80,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 1f89b94..68b7974 100644 --- a/scripts/backup +++ b/scripts/backup @@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= diff --git a/scripts/install b/scripts/install index b54b615..8bcb77e 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,6 +43,7 @@ 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=$app --key=domain --value="$domain" @@ -57,6 +59,7 @@ ynh_app_setting_set --app=$app --key=instance_id --value="$instance_id" #================================================= # FIND AND OPEN A PORT #================================================= +ynh_script_progression --message="Configuring firewall..." --weight=1 port=$(ynh_find_port 64738) ynh_app_setting_set --app=$app --key=port --value=$port @@ -67,9 +70,9 @@ 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 $pkg_dependencies #================================================= @@ -86,13 +89,13 @@ 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" diff --git a/scripts/restore b/scripts/restore index cadf1d0..4059be9 100644 --- a/scripts/restore +++ b/scripts/restore @@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= @@ -84,3 +83,10 @@ ynh_restore_file "/etc/systemd/system/$app.service" systemctl enable "$app.service" systemctl restart "$app" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Restoration completed for $app" --last + diff --git a/scripts/upgrade b/scripts/upgrade index d269e51..07489dc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -5,13 +5,14 @@ #================================================= # 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) @@ -24,6 +25,12 @@ 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) +#================================================= +# CHECK VERSION +#================================================= + +upgrade_type=$(ynh_check_app_version_changed) + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -90,10 +97,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 @@ -114,9 +121,10 @@ ynh_abort_if_errors #================================================= # 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,13 +141,13 @@ 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"