diff --git a/README.md b/README.md index f6dea1f..d56a2dc 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,10 @@ Mattermost is a self-hosted, open source instant messaging and service software. ## YunoHost specific features +This package can install the [*Entreprise Edition*](https://docs.mattermost.com/overview/product.html#mattermost-enterprise-edition) or the [*Team Edition*](https://docs.mattermost.com/overview/product.html#mattermost-team-edition). + +Mattermost Mobile and Desktop Apps are available [here](https://mattermost.com/download/) + #### Multi-user support * Are LDAP and HTTP auth supported? **No** @@ -44,7 +48,7 @@ Mattermost is a self-hosted, open source instant messaging and service software. ## Additional information -* This package can by installed on `ARM`, `ARM64` and `x86-64` architecture. +* This package can by installed on `ARM`, `ARM64` and `x86-64` architecture (only `x86-64` if you choose to ibstall the *Entreprise Edition*). ## Links diff --git a/check_process b/check_process index 1bb3deb..5be57e9 100644 --- a/check_process +++ b/check_process @@ -1,7 +1,7 @@ # See here for more information # https://github.com/YunoHost/package_check#syntax-check_process-file -;; Test complet +;; Test with Enterprise Edition ; Manifest domain="domain.tld" (DOMAIN) path="/path" (PATH) @@ -11,6 +11,7 @@ password="admin!42" admin_password="admin!42" language="fr" + version="Enterprise" team_display_name="Mon équipe" is_public=1 (PUBLIC|public=1|private=0) ; Checks @@ -26,6 +27,26 @@ multi_instance=1 port_already_use=0 change_url=0 +;; Test with Team Edition + ; Manifest + domain="domain.tld" (DOMAIN) + path="/path" (PATH) + admin="john" (USER) + email="john@gmail.com" + admin_email="john@gmail.com" + password="admin!42" + admin_password="admin!42" + language="fr" + version="Team" + team_display_name="Mon équipe" + is_public=1 (PUBLIC|public=1|private=0) + ; Checks + setup_sub_dir=1 + setup_root=1 + setup_private=1 + setup_public=1 + upgrade=1 + upgrade=1 from_commit=202cc0725652d4b8fbca52630267247bd58c8de1 ;;; Options Email=kemenaran@gmail.com Notification=none diff --git a/conf/enterprise.src b/conf/enterprise.src new file mode 100644 index 0000000..5226b55 --- /dev/null +++ b/conf/enterprise.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://releases.mattermost.com/5.30.1/mattermost-5.30.1-linux-amd64.tar.gz +SOURCE_SUM=14018addf86c040200515cb0141308a6d213f149f8afe425dd171347be516401 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME=mattermost-5.30.1-linux-amd64.tar.gz diff --git a/manifest.json b/manifest.json index b946125..01019f4 100644 --- a/manifest.json +++ b/manifest.json @@ -73,6 +73,20 @@ }, "example": "Choose a password" }, + { + "name": "version", + "type": "string", + "ask": { + "en": "Choose the version you want to install", + "fr": "Choisissez la version que vous souhaitez installer" + }, + "help": { + "en": "Use Team Edition for the open source version (ARM, ARM64 and x86-64 support) or Enterprise Edition if you want to use a license (x86-64 support only)", + "fr": "Utilisez Team Edition pour la version open source (prise en charge ARM, ARM64 et x86-64) ou Enterprise Edition si vous souhaitez utiliser une licence (prise en charge x86-64 uniquement)" + }, + "choices": ["Enterprise", "Team"], + "default": "Team" + }, { "name": "language", "type": "string", diff --git a/scripts/install b/scripts/install index 55b1ee3..a7e0e80 100644 --- a/scripts/install +++ b/scripts/install @@ -32,6 +32,7 @@ password=$YNH_APP_ARG_PASSWORD language=$YNH_APP_ARG_LANGUAGE team_display_name=$YNH_APP_ARG_TEAM_DISPLAY_NAME architecture=$(ynh_detect_arch) +version=$YNH_APP_ARG_VERSION app=$YNH_APP_INSTANCE_NAME @@ -57,6 +58,7 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=password --value=$password ynh_app_setting_set --app=$app --key=language --value=$language +ynh_app_setting_set --app=$app --key=version --value=$version ynh_app_setting_set --app=$app --key=team_display_name --value=$team_display_name #================================================= @@ -94,7 +96,14 @@ ynh_script_progression --message="Setting up source files..." --weight=3 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" + +if [ "$version" = "Enterprise" ]; then + # Get Enterprise binary path + ynh_setup_source --dest_dir="$final_path" --source_id="enterprise" +elif [ "$version" = "Team" ]; then + # Get Team binary path + ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" +fi #================================================= # CREATE DIRECTORY FOR DATA diff --git a/scripts/remove b/scripts/remove index fb1ec22..46b9cc8 100755 --- a/scripts/remove +++ b/scripts/remove @@ -43,7 +43,7 @@ ynh_script_progression --message="Stopping and removing the systemd service..." ynh_remove_systemd_config #================================================= -# REMOVE THE POSTGRESQL DATABASE +# REMOVE THE MySQL DATABASE #================================================= ynh_script_progression --message="Removing the MySQL database..." --weight=2 diff --git a/scripts/upgrade b/scripts/upgrade index 371ae6e..5093a14 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -34,6 +34,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) language=$(ynh_app_setting_get --app=$app --key=language) db_name=$(ynh_app_setting_get --app=$app --key=db_name) architecture=$(ynh_detect_arch) +version=$(ynh_app_setting_get --app=$app --key=version) #================================================= # CHECK VERSION @@ -60,6 +61,18 @@ if ! [[ "$port" ]]; then ynh_app_setting_set --app=$app --key=port --value=$port fi +# Save the language used if not present +if ! [[ "$language" ]]; then + language="en" + ynh_app_setting_set --app=$app --key=language --value=$language +fi + +# If version setting doesn't exist +if [ -z "$version" ]; then + version="Enterprise" + ynh_app_setting_set --app=$app --key=version --value=$version +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -100,8 +113,11 @@ then # Remove the app directory securely ynh_secure_remove --file="$final_path" - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" + if [ "$version" = "Enterprise" ]; then + ynh_setup_source --dest_dir="$final_path" --source_id="enterprise" + elif [ "$version" = "Team" ]; then + ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" + fi # Copy the admin saved settings from tmp directory to final path cp -a "$tmpdir/config.json" "$final_path/config/config.json" @@ -168,7 +184,6 @@ chown -R $app: "$data_path" chown -R $app: $final_path chmod -R g+w $final_path - chown -R $app: "/var/log/$app" #=================================================