From 0aa89327da5538ffebfb0b3d83555138dc06ca35 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Fri, 5 Nov 2021 10:03:13 +0000 Subject: [PATCH 1/4] scripts: use an absolute path when invoking mmctl It seems on some distros (like Raspian), the current working directory is not preserved accross sudo invocations, which causes an "bin/mmctl not found" error. Fix #304 --- scripts/install | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/install b/scripts/install index 47c8fcb..f9a07f8 100644 --- a/scripts/install +++ b/scripts/install @@ -185,15 +185,14 @@ ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_ ynh_script_progression --message="Create the first administrator and team..." --weight=1 team_name=$(echo "$team_display_name" | iconv -f utf8 -t ascii//TRANSLIT//IGNORE | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z) +bin_mmctl="$final_path/bin/mmctl" -pushd "$final_path" - export MMCTL_LOCAL=true - export MMCTL_LOCAL_SOCKET_PATH="$local_socket_path" +export MMCTL_LOCAL=true +export MMCTL_LOCAL_SOCKET_PATH="$local_socket_path" - ynh_exec_warn_less sudo --preserve-env -u $app bin/mmctl user create --username "$admin" --email "$email" --password "$password" --locale "$language" --email-verified --system-admin - ynh_exec_warn_less sudo --preserve-env -u $app bin/mmctl team create --name "$team_name" --display_name "$team_display_name" --email "$email" - ynh_exec_warn_less sudo --preserve-env -u $app bin/mmctl team users add "$team_name" "$admin" -popd +ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" user create --username "$admin" --email "$email" --password "$password" --locale "$language" --email-verified --system-admin +ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" team create --name "$team_name" --display_name "$team_display_name" --email "$email" +ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" team users add "$team_name" "$admin" # Now that the first user is created, disable mmctl passwordless access ynh_replace_string '"EnableLocalMode": true' '"EnableLocalMode": false' "$final_path/config/config.json" From b20163105dc5d920719f45f762244ddd2f3d3a11 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Fri, 5 Nov 2021 16:43:05 +0100 Subject: [PATCH 2/4] scripts: skip user and team creation if mmctl is missing mmctl is not available for ARM builds yet. See #306 --- scripts/install | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index f9a07f8..ed5720f 100644 --- a/scripts/install +++ b/scripts/install @@ -187,14 +187,17 @@ ynh_script_progression --message="Create the first administrator and team..." -- team_name=$(echo "$team_display_name" | iconv -f utf8 -t ascii//TRANSLIT//IGNORE | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z) bin_mmctl="$final_path/bin/mmctl" -export MMCTL_LOCAL=true -export MMCTL_LOCAL_SOCKET_PATH="$local_socket_path" +# mmctl is not packaged with ARM versions yet +if [[ -f $"bin_mmctl" ]]; then + export MMCTL_LOCAL=true + export MMCTL_LOCAL_SOCKET_PATH="$local_socket_path" -ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" user create --username "$admin" --email "$email" --password "$password" --locale "$language" --email-verified --system-admin -ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" team create --name "$team_name" --display_name "$team_display_name" --email "$email" -ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" team users add "$team_name" "$admin" + ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" user create --username "$admin" --email "$email" --password "$password" --locale "$language" --email-verified --system-admin + ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" team create --name "$team_name" --display_name "$team_display_name" --email "$email" + ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" team users add "$team_name" "$admin" +fi -# Now that the first user is created, disable mmctl passwordless access +# Disable mmctl passwordless access ynh_replace_string '"EnableLocalMode": true' '"EnableLocalMode": false' "$final_path/config/config.json" ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Started Mattermost" From 98e27be266e6860e2b645fcf068fc89e89e209a5 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Sun, 7 Nov 2021 12:34:59 +0100 Subject: [PATCH 3/4] manifest: bump version number --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index fb6e74a..0951182 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Open source collaboration platform built for developers", "fr": "Plateforme de collaboration open source conçue pour les développeurs" }, - "version": "6.0.2~ynh1", + "version": "6.0.2~ynh2", "url": "http://www.mattermost.org/", "upstream": { "license": "GPL-3.0-only", From 6762ce32d2433fd971040106f7689cb89165c713 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sun, 7 Nov 2021 11:35:08 +0000 Subject: [PATCH 4/4] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0455614..cc85bc9 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ To explore the benefits of Mattermost’s enterprise features, you can replace t - Multiple languages including U.S. English, Australian English, Bulgarian, Chinese (Simplified and Traditional), Dutch, French, German, Hungarian, Italian, Japanese, Korean, Polish, Brazilian Portuguese, Romanian, Russian, Turkish, Spanish, Swedish, and Ukrainian -**Shipped version:** 6.0.2~ynh1 +**Shipped version:** 6.0.2~ynh2 diff --git a/README_fr.md b/README_fr.md index 841d939..96f1433 100644 --- a/README_fr.md +++ b/README_fr.md @@ -33,7 +33,7 @@ Pour explorer les avantages des fonctionnalités d'entreprise de Mattermost, vou - Plusieurs langues dont l'anglais américain, l'anglais australien, le bulgare, le chinois (simplifié et traditionnel), le néerlandais, le français, l'allemand, le hongrois, l'italien, le japonais, le coréen, le polonais, le portugais brésilien, le roumain, le russe, le turc, l'espagnol, le suédois et l'ukrainien -**Version incluse :** 6.0.2~ynh1 +**Version incluse :** 6.0.2~ynh2