From 30b897d58055416beeebc9ad546bc76cbdfa42a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:24:39 +0200 Subject: [PATCH] v2 --- doc/POST_INSTALL.md | 10 +++++++++ manifest.toml | 25 ++++++++++++--------- scripts/_common.sh | 3 --- scripts/backup | 16 -------------- scripts/install | 53 ++------------------------------------------- scripts/restore | 38 -------------------------------- scripts/upgrade | 46 --------------------------------------- 7 files changed, 27 insertions(+), 164 deletions(-) create mode 100644 doc/POST_INSTALL.md diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md new file mode 100644 index 0000000..2463654 --- /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 : __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 __INSTALL_DIR__. diff --git a/manifest.toml b/manifest.toml index c504a14..0462186 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,22 +14,19 @@ license = "BSD-3-Clause" website = "https://mumble.info" admindoc = "https://wiki.mumble.info/wiki/Main_Page" code = "https://github.com/mumble-voip/mumble" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] -yunohost = ">= 11.0.9" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +yunohost = ">= 11.1.17" +architectures = "all" multi_instance = true -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = "not_relevant" +sso = "not_relevant" +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" full_domain = true @@ -48,8 +45,16 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen 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 85d6e25..90e0dd3 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -#REMOVEME? pkg_dependencies="mumble-server mailutils" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index d7f8488..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 -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/install b/scripts/install index 9d45558..39c7498 100644 --- a/scripts/install +++ b/scripts/install @@ -11,74 +11,25 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -#REMOVEME? welcometext=$YNH_APP_ARG_WELCOMETEXT -#REMOVEME? registername=$YNH_APP_ARG_REGISTERNAME -instance_id=$YNH_APP_INSTANCE_NUMBER - -#REMOVEME? 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 -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 - -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2 +ynh_script_progression --message="Storing installation settings..." --weight=2 -# Save app settings -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value="$domain" ynh_app_setting_set --app=$app --key=no_sso --value="true" -#REMOVEME? ynh_app_setting_set --app=$app --key=server_password --value="$server_password" +REMOVEME? 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 -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1 - -# Find an available port -#REMOVEME? port=$(ynh_find_port --port=64738) -#REMOVEME? 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 -#================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=4 - -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - #================================================= # SPECIFIC SETUP #================================================= diff --git a/scripts/restore b/scripts/restore index b558222..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 -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 - -#REMOVEME? test ! -d $install_dir \ - || ynh_die --message="There is already a directory: $install_dir " - #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -47,16 +19,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=4 - -# Define and install dependencies -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - #================================================= # RESTORE USER RIGHTS #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1966d3c..dc535b0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,45 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? no_sso=$(ynh_app_setting_get --app=$app --key=no_sso) -#REMOVEME? server_password=$(ynh_app_setting_get --app=$app --key=server_password) -#REMOVEME? su_passwd=$(ynh_app_setting_get --app=$app --key=su_passwd) -#REMOVEME? welcometext=$(ynh_app_setting_get --app=$app --key=welcometext) -#REMOVEME? registername=$(ynh_app_setting_get --app=$app --key=registername) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? 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 -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -62,12 +29,6 @@ ynh_systemd_action --service_name=$app --action="stop" #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# If install_dir doesn't exist, create it -if [ -z "$install_dir" ]; then -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? ynh_app_setting_set "$app" install_dir "$install_dir" -fi - # test old time if [ -z "$server_password" ]; then old_mumble_conf="/etc/mumble-server.ini" @@ -130,13 +91,6 @@ if [ -z "$registername" ]; then ynh_app_setting_delete "$app" registerName fi -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=6 - -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - #================================================= # SPECIFIC UPGRADE #=================================================