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

Arm arch. support (#201)

* Add ARM sources
* Switch to TEAM edition
This commit is contained in:
Éric Gaspar 2021-01-12 10:33:02 +01:00 committed by GitHub
parent 7586f58759
commit c425aa5d94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 77 additions and 15 deletions

View file

@ -1,6 +0,0 @@
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

6
conf/arm.src Normal file
View file

@ -0,0 +1,6 @@
SOURCE_URL=https://github.com/SmartHoneybee/ubiquitous-memory/releases/download/v5.30.1/mattermost-v5.30.1-linux-arm.tar.gz
SOURCE_SUM=2292157939eb5be0ac5e1d58bc690d8f359040f1ae55f37f1f90cab422d11e2d
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=mattermost-v5.30.1-linux-arm.tar.gz

6
conf/arm64.src Normal file
View file

@ -0,0 +1,6 @@
SOURCE_URL=https://github.com/SmartHoneybee/ubiquitous-memory/releases/download/v5.30.1/mattermost-v5.30.1-linux-arm64.tar.gz
SOURCE_SUM=cbd150100947686c2d177db6067e98a36859e7da2fe4c173b89925a2fd1415d1
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=mattermost-v5.30.1-linux-arm64.tar.gz

View file

@ -321,14 +321,14 @@
"LdapSettings": {
"Enable": false,
"EnableSync": false,
"LdapServer": "ldap://127.0.0.1",
"LdapServer": "",
"LdapPort": 389,
"ConnectionSecurity": "",
"BaseDN": "ou=users,dc=yunohost,dc=org",
"BaseDN": "",
"BindUsername": "cn",
"BindPassword": "",
"UserFilter": "",
"GroupFilter": "(&(|(objectclass=posixAccount))(uid={{username}})(permission=cn=mattermost.main,ou=permission,dc=yunohost,dc=org))",
"GroupFilter": "",
"GuestFilter": "",
"EnableAdminFilter": false,
"AdminFilter": "",

6
conf/x86-64.src Normal file
View file

@ -0,0 +1,6 @@
SOURCE_URL=https://releases.mattermost.com/5.30.1/mattermost-team-5.30.1-linux-amd64.tar.gz
SOURCE_SUM=3c4165d7ea240ad49dba8e486d9fd7de83eea7cac2cb9a355d891dd605b3fa52
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=mattermost-team-5.30.1-linux-amd64.tar.gz

View file

@ -12,6 +12,33 @@
# EXPERIMENTAL HELPERS
#=================================================
# Check the architecture
#
# example: architecture=$(ynh_detect_arch)
#
# usage: ynh_detect_arch
#
# Requires YunoHost version 2.2.4 or higher.
ynh_detect_arch(){
local architecture
if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then
architecture="arm64"
elif [ -n "$(uname -m | grep 64)" ]; then
architecture="x86-64"
elif [ -n "$(uname -m | grep armv7)" ]; then
architecture="arm"
elif [ -n "$(uname -m | grep armv6)" ]; then
architecture="arm"
elif [ -n "$(uname -m | grep armv5)" ]; then
architecture="arm"
else
architecture="unknown"
fi
echo $architecture
}
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -31,9 +31,9 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
# Add settings here as needed by your application
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#db_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
@ -106,6 +106,27 @@ then
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..." --weight=3
cp ../conf/config.json $final_path/config/config.json
# Main config File
ynh_replace_string --match_string="__URL__" --replace_string="https://$new_domain$new_path" --target_file="$final_path/config/config.json"
ynh_replace_string --match_string="__PORT__" --replace_string="127.0.0.1:$port" --target_file="$final_path/config/config.json"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config/config.json"
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/config/config.json"
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/config/config.json"
ynh_replace_string --match_string="__DATA__" --replace_string="$data_path" --target_file="$final_path/config/config.json"
ynh_replace_string --match_string="__FEEDBACK__" --replace_string="no-reply@${new_domain}" --target_file="$final_path/config/config.json"
ynh_replace_string --match_string="__USER_PW__" --replace_string="$(ynh_string_random --length=24)" --target_file="$final_path/config/config.json"
ynh_replace_string --match_string="__LOG__" --replace_string="$logs_path" --target_file="$final_path/config/config.json"
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/config/config.json"
ynh_store_file_checksum --file="$final_path/config/config.json"
#=================================================
# GENERIC FINALISATION
#=================================================
@ -113,7 +134,7 @@ fi
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=3
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started Mattermost"
ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Started Mattermost"
#=================================================
# RELOAD NGINX

View file

@ -31,6 +31,7 @@ email=$(ynh_user_get_info "$admin" mail)
password=$YNH_APP_ARG_PASSWORD
language=$YNH_APP_ARG_LANGUAGE
team_display_name=$YNH_APP_ARG_TEAM_DISPLAY_NAME
architecture=$(ynh_detect_arch)
app=$YNH_APP_INSTANCE_NAME
@ -93,7 +94,7 @@ 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"
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
#=================================================
# CREATE DIRECTORY FOR DATA

View file

@ -33,6 +33,7 @@ port=$(ynh_app_setting_get --app=$app --key=port)
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)
#=================================================
# CHECK VERSION
@ -100,7 +101,7 @@ then
ynh_secure_remove --file="$final_path"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
# Copy the admin saved settings from tmp directory to final path
cp -a "$tmpdir/config.json" "$final_path/config/config.json"