Files
open-im-server/scripts/path_info.sh
T

124 lines
4.2 KiB
Bash
Raw Normal View History

2023-07-09 16:51:43 +08:00
#!/usr/bin/env bash
2023-07-12 12:28:18 +08:00
# Copyright © 2023 OpenIM. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2023-07-07 19:45:32 +08:00
# Determine the architecture and version
architecture=$(uname -m)
version=$(uname -s | tr '[:upper:]' '[:lower:]')
2023-07-09 15:28:19 +08:00
#Include shell font styles and some basic information
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
2023-07-09 16:51:43 +08:00
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2023-07-09 15:28:19 +08:00
#Include shell font styles and some basic information
2023-07-09 16:51:43 +08:00
source $SCRIPTS_ROOT/style_info.sh
2023-07-09 15:28:19 +08:00
cd $SCRIPTS_ROOT
2023-07-07 19:45:32 +08:00
# Define the supported architectures and corresponding bin directories
declare -A supported_architectures=(
["linux-amd64"]="_output/bin/platforms/linux/amd64"
["linux-arm64"]="_output/bin/platforms/linux/arm64"
["linux-mips64"]="_output/bin/platforms/linux/mips64"
["linux-mips64le"]="_output/bin/platforms/linux/mips64le"
["linux-ppc64le"]="_output/bin/platforms/linux/ppc64le"
["linux-s390x"]="_output/bin/platforms/linux/s390x"
["darwin-amd64"]="_output/bin/platforms/darwin/amd64"
["windows-amd64"]="_output/bin/platforms/windows/amd64"
["linux-x86_64"]="_output/bin/platforms/linux/amd64" # Alias for linux-amd64
["darwin-x86_64"]="_output/bin/platforms/darwin/amd64" # Alias for darwin-amd64
)
# Check if the architecture and version are supported
if [[ -z ${supported_architectures["$version-$architecture"]} ]]; then
2023-07-10 17:49:28 +08:00
echo -e "${BLUE_PREFIX}================> Unsupported architecture: $architecture or version: $version${COLOR_SUFFIX}"
2023-07-07 19:45:32 +08:00
exit 1
fi
2023-07-09 14:16:19 +08:00
2023-07-10 17:49:28 +08:00
echo -e "${BLUE_PREFIX}================> Architecture: $architecture${COLOR_SUFFIX}"
2023-07-07 21:27:07 +08:00
2023-07-07 19:45:32 +08:00
# Set the BIN_DIR based on the architecture and version
BIN_DIR=${supported_architectures["$version-$architecture"]}
2023-07-10 17:49:28 +08:00
echo -e "${BLUE_PREFIX}================> BIN_DIR: $OPENIM_ROOT/$BIN_DIR${COLOR_SUFFIX}"
2023-07-07 21:27:07 +08:00
2023-07-07 19:45:32 +08:00
# Don't put the space between "="
2023-07-07 21:27:07 +08:00
openim_msggateway="openim-msggateway"
2023-07-09 14:16:19 +08:00
msg_gateway_binary_root="$OPENIM_ROOT/$BIN_DIR"
2023-07-09 17:12:16 +08:00
msg_gateway_source_root="$OPENIM_ROOT/cmd/openim-msggateway/"
2023-06-30 23:22:58 +08:00
2023-07-07 21:27:07 +08:00
msg_name="openim-rpc-msg"
2023-07-09 14:16:19 +08:00
msg_binary_root="$OPENIM_ROOT/$BIN_DIR"
2023-07-09 17:12:16 +08:00
msg_source_root="$OPENIM_ROOT/cmd/openim-rpc/openim-rpc-msg/"
2023-06-30 23:22:58 +08:00
2023-07-07 19:45:32 +08:00
push_name="openim-push"
2023-07-09 14:16:19 +08:00
push_binary_root="$OPENIM_ROOT/$BIN_DIR"
2023-07-09 17:12:16 +08:00
push_source_root="$OPENIM_ROOT/cmd/openim-push/"
2023-06-30 23:22:58 +08:00
2023-07-09 17:12:16 +08:00
openim_msgtransfer="openim-msgtransfer"
2023-07-09 14:16:19 +08:00
msg_transfer_binary_root="$OPENIM_ROOT/$BIN_DIR"
2023-07-09 16:51:43 +08:00
msg_transfer_source_root="$OPENIM_ROOT/cmd/openim-msgtransfer/"
2023-06-30 23:22:58 +08:00
msg_transfer_service_num=4
2023-07-07 21:27:07 +08:00
cron_task_name="openim-crontask"
2023-07-09 14:16:19 +08:00
cron_task_binary_root="$OPENIM_ROOT/$BIN_DIR"
2023-07-09 16:51:43 +08:00
cron_task_source_root="$OPENIM_ROOT/cmd/openim-crontask/"
2023-06-30 23:22:58 +08:00
2023-07-09 16:51:43 +08:00
cmd_utils_name="openim-cmdutils"
2023-07-09 14:16:19 +08:00
cmd_utils_binary_root="$OPENIM_ROOT/$BIN_DIR"
2023-07-09 16:51:43 +08:00
cmd_utils_source_root="$OPENIM_ROOT/cmd/openim-cmdutils/"
2023-06-30 23:22:58 +08:00
2023-07-07 19:45:32 +08:00
# Global configuration file default dir
2023-07-09 15:28:19 +08:00
config_path="$OPENIM_ROOT/config/config.yaml"
2023-07-11 21:13:06 +08:00
configfile_path="$OPENIM_ROOT/config"
2023-07-13 11:37:23 +08:00
log_path="$OPENIM_ROOT/log"
2023-07-11 21:13:06 +08:00
2023-07-07 19:45:32 +08:00
# servicefile dir path
2023-06-30 23:22:58 +08:00
service_source_root=(
2023-07-07 19:45:32 +08:00
# api service file
2023-07-09 16:51:43 +08:00
"$OPENIM_ROOT/cmd/api/"
2023-07-07 19:45:32 +08:00
# rpc service file
2023-07-09 16:51:43 +08:00
"$OPENIM_ROOT/cmd/openim-rpc/openim-rpc-user/"
"$OPENIM_ROOT/cmd/openim-rpc/openim-rpc-friend/"
"$OPENIM_ROOT/cmd/openim-rpc/openim-rpc-group/"
"$OPENIM_ROOT/cmd/openim-rpc/openim-rpc-auth/"
"$OPENIM_ROOT/cmd/openim-rpc/openim-rpc-conversation/"
"$OPENIM_ROOT/cmd/openim-rpc/openim-rpc-third/"
"$OPENIM_ROOT/cmd/openim-crontask"
2023-07-07 19:45:32 +08:00
"${msg_gateway_source_root}"
"${msg_transfer_source_root}"
"${msg_source_root}"
"${push_source_root}"
# "${sdk_server_source_root}"
2023-06-30 23:22:58 +08:00
)
2023-07-07 19:45:32 +08:00
# service filename
service_names=(
# api service filename
"openim-api"
# rpc service filename
2023-07-07 21:27:07 +08:00
"openim-rpc-user"
"openim-rpc-friend"
"openim-rpc-group"
"openim-rpc-auth"
"openim-rpc-conversation"
"openim-rpc-third"
"openim-crontask"
"${openim_msggateway}"
"${openim_msgtransfer}"
2023-07-07 19:45:32 +08:00
"${msg_name}"
"${push_name}"
# "${sdk_server_name}"
2023-07-11 21:13:06 +08:00
)