1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mattermost_ynh.git synced 2024-09-03 19:36:29 +02:00

Merge pull request #299 from YunoHost-Apps/migrate-to-mmctl

This commit is contained in:
Pierre de La Morinerie 2021-10-31 13:01:21 +01:00 committed by GitHub
commit 6a099f775c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 14 deletions

View file

@ -83,7 +83,7 @@
"EnableSVGs": false,
"EnableLatex": false,
"EnableAPIChannelDeletion": false,
"EnableLocalMode": false,
"EnableLocalMode": true,
"LocalModeSocketLocation": "/var/tmp/mattermost_local.socket",
"EnableAWSMetering": false,
"SplitKey": "",

View file

@ -163,19 +163,6 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=2
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# CREATE ADMIN AND FIRST 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)
pushd "$final_path"
ynh_exec_warn_less ynh_exec_as $app bin/mattermost user create --username "$admin" --email "$email" --password "$password" --locale "$language" --system_admin
ynh_exec_warn_less ynh_exec_as $app bin/mattermost user verify "$admin"
ynh_exec_warn_less ynh_exec_as $app bin/mattermost team create --name "$team_name" --display_name "$team_display_name" --email "$email"
ynh_exec_warn_less ynh_exec_as $app bin/mattermost team add "$team_name" "$admin"
popd
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
@ -191,6 +178,24 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Started Mattermost"
#=================================================
# CREATE ADMIN AND FIRST TEAM
#=================================================
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)
pushd "$final_path"
ynh_exec_warn_less ynh_exec_as $app bin/mmctl user create --local --username "$admin" --email "$email" --password "$password" --locale "$language" --system_admin
ynh_exec_warn_less ynh_exec_as $app bin/mmctl user verify --local "$admin"
ynh_exec_warn_less ynh_exec_as $app bin/mmctl team create --local --name "$team_name" --display_name "$team_display_name" --email "$email"
ynh_exec_warn_less ynh_exec_as $app bin/mmctl team add --local "$team_name" "$admin"
popd
# Now that the first user is created, 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"
#=================================================
# SETUP SSOWAT
#=================================================