diff --git a/README.md b/README.md index 96b4386..b0a556b 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,10 @@ 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.3.0~git20190125.440b173+dfsg-2 (source package provided by Debian) +**Shipped version:** 1.3.0 # 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/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/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/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", 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..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,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" @@ -109,13 +113,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,15 +133,16 @@ 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 +# 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" @@ -161,3 +166,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/restore b/scripts/restore index 414c8c6..4059be9 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,19 +6,13 @@ # 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 #================================================= @@ -51,7 +45,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 @@ -89,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 a257cd2..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" @@ -211,3 +219,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