diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index 5226b55..0000000 --- a/conf/app.src +++ /dev/null @@ -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 diff --git a/conf/arm.src b/conf/arm.src new file mode 100644 index 0000000..54444f7 --- /dev/null +++ b/conf/arm.src @@ -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 diff --git a/conf/arm64.src b/conf/arm64.src new file mode 100644 index 0000000..bd34361 --- /dev/null +++ b/conf/arm64.src @@ -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 diff --git a/conf/config.json b/conf/config.json index bf5e9a2..9adf518 100644 --- a/conf/config.json +++ b/conf/config.json @@ -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": "", diff --git a/conf/x86-64.src b/conf/x86-64.src new file mode 100644 index 0000000..cc4b71f --- /dev/null +++ b/conf/x86-64.src @@ -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 diff --git a/scripts/_common.sh b/scripts/_common.sh index 7401a47..7916409 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -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 #================================================= diff --git a/scripts/change_url b/scripts/change_url index 1cea7e4..7c7cd57 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -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 diff --git a/scripts/install b/scripts/install index ef8f81f..55b1ee3 100644 --- a/scripts/install +++ b/scripts/install @@ -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 diff --git a/scripts/upgrade b/scripts/upgrade index 5a6a4f0..371ae6e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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"