diff --git a/check_process b/check_process index 74ecf86..bf315e4 100644 --- a/check_process +++ b/check_process @@ -12,12 +12,14 @@ setup_private=0 setup_public=0 upgrade=1 + # 1.3.0~ynh1 upgrade=1 from_commit=d9ece341d532bd5eac9af9ce191da7b62d1e8bb1 + # 1.3.0~ynh2 + upgrade=1 from_commit=fc6ca3fa6abe234314089fd58ef884759ebe4fd9 backup_restore=1 multi_instance=1 + port_already_use=0 + change_url=0 ;;; Options Email= Notification=none -;;; Upgrade options - ; commit=d9ece341d532bd5eac9af9ce191da7b62d1e8bb1 - name=Merge pull request #40 from YunoHost-Apps/testing diff --git a/manifest.json b/manifest.json index 8551e18..2871dd0 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Low-latency, high quality voice chat software (VoIP)", "fr": "Logiciel libre de voix sur IP (VoIP)" }, - "version": "1.3.0~ynh2", + "version": "1.3.0~ynh3", "url": "https://mumble.info", "upstream": { "license": "BSD-3-Clause", @@ -30,30 +30,30 @@ "services": [ ], "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain" - }, + "install": [ { - "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": "domain", + "type": "domain" }, { - "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)" + "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" }, - "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/backup b/scripts/backup index 2590473..2850990 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -13,6 +14,7 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= @@ -29,8 +31,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= ynh_print_info --message="Declaring files to be backed up..." -#================================================= -# STANDARD BACKUP STEPS #================================================= # BACKUP THE APP MAIN DIR #================================================= diff --git a/scripts/install b/scripts/install index 96f85d8..6fb3fda 100644 --- a/scripts/install +++ b/scripts/install @@ -15,6 +15,9 @@ 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 @@ -22,13 +25,13 @@ ynh_abort_if_errors # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -# Retrieve arguments domain=$YNH_APP_ARG_DOMAIN -app=$YNH_APP_INSTANCE_NAME 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) @@ -38,7 +41,7 @@ su_passwd=$(ynh_string_random) 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" +test ! -e "$final_path" || ynh_die --message="This path already contains a folder" #================================================= # STORE SETTINGS FROM MANIFEST @@ -46,13 +49,13 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder" 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=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" +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 @@ -61,6 +64,7 @@ ynh_app_setting_set --app=$app --key=instance_id --value="$instance_id" #================================================= 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 @@ -73,14 +77,14 @@ ynh_exec_warn_less yunohost firewall allow Both $port #================================================= ynh_script_progression --message="Installing dependencies..." --weight=4 -# Install Mumble Debian package via apt ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # SPECIFIC SETUP #================================================= -# mumble server conf.ini +# ADD A CONFIGURATION #================================================= +ynh_script_progression --message="Adding a configuration file..." mkdir -p "$final_path" ynh_app_setting_set --app=$app --key=final_path --value=$final_path @@ -90,19 +94,6 @@ mumble_conf="$final_path/mumble-server.ini" ynh_add_config --template="../conf/mumble-server.ini" --destination="$mumble_conf" -#================================================= -# SETUP SYSTEMD -#================================================= - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - chmod -R 770 "$final_path" chown -R :mumble-server "$final_path" @@ -128,12 +119,21 @@ 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..." -# Add Mumble as a YunoHost service yunohost service add $app --description="Mumble server" --log="/var/log/mumble-server/$app.log" --needs_exposed_ports="$port" #================================================= diff --git a/scripts/remove b/scripts/remove index f150822..b62bf3d 100644 --- a/scripts/remove +++ b/scripts/remove @@ -23,7 +23,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE #================================================= -# REMOVE SERVICE FROM ADMIN PANEL +# REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) @@ -41,14 +41,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= @@ -57,21 +49,30 @@ 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="Close port $port" --weight=1 + ynh_script_progression --message="Closing port $port..." --weight=1 ynh_exec_warn_less yunohost firewall disallow Both $port fi #================================================= # SPECIFIC REMOVE #================================================= -# REMOVE OTHER FILES +# 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 f199a4f..15ada36 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -13,6 +14,10 @@ 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 #================================================= @@ -30,7 +35,8 @@ port=$(ynh_app_setting_get --app=$app --key=port) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -d "$final_path" || ynh_die "There is already a directory: $final_path " +test ! -d $final_path \ + || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS @@ -72,14 +78,6 @@ usermod --append --groups ssl-cert mumble-server systemctl stop 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 --description="Mumble server" --log="/var/log/mumble-server/$app.log" --needs_exposed_ports="$port" - #================================================= # RESTORE SYSTEMD #================================================= @@ -88,6 +86,13 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + +yunohost service add $app --description="Mumble server" --log="/var/log/mumble-server/$app.log" --needs_exposed_ports="$port" + #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index ab975cc..0329c2a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,9 +29,34 @@ 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 +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." + +ynh_systemd_action --service_name=$app --action="stop" + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -106,32 +131,16 @@ if [ -z "$registername" ]; then 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 -ynh_clean_setup () { - # restore it if the upgrade fails - ynh_restore_upgradebackup -} - -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# INSTALL DEPENDENCIES +# UPGRADE DEPENDENCIES #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=6 -# Install Mumble Debian package via apt ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # SPECIFIC UPGRADE #================================================= -# mumble server conf.ini +# UPDATE A CONFIG FILE #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 @@ -142,20 +151,6 @@ mumble_conf="$final_path/mumble-server.ini" ynh_add_config --template="../conf/mumble-server.ini" --destination="$mumble_conf" -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - chmod -R 770 "$final_path" chown -R :mumble-server "$final_path" @@ -181,7 +176,17 @@ systemctl stop mumble-server systemctl disable mumble-server --quiet #================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# SETUP SYSTEMD +#================================================= +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