diff --git a/conf/config.json b/conf/config.json index c5a1403..7cd2878 100644 --- a/conf/config.json +++ b/conf/config.json @@ -83,7 +83,7 @@ "EnableSVGs": false, "EnableLatex": false, "EnableAPIChannelDeletion": false, - "EnableLocalMode": false, + "EnableLocalMode": true, "LocalModeSocketLocation": "/var/tmp/mattermost_local.socket", "EnableAWSMetering": false, "SplitKey": "", diff --git a/scripts/install b/scripts/install index 2ef3c9b..e7e7d29 100644 --- a/scripts/install +++ b/scripts/install @@ -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 #=================================================