diff --git a/scripts/check-all.sh b/scripts/check-all.sh new file mode 100755 index 000000000..ea00db032 --- /dev/null +++ b/scripts/check-all.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# 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. + +# This script is check openim service is running normally +# +# Usage: `scripts/check-all.sh`. +# Encapsulated as: `make check`. +# READ: https://github.com/OpenIMSDK/Open-IM-Server/tree/main/scripts/install/environment.sh + +set -o errexit +set -o nounset +set -o pipefail + +OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. +source "${OPENIM_ROOT}/scripts/install/common.sh" + +OPENIM_VERBOSE=4 + +echo "++++ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}" + +echo "++++ Check all dependent service ports" +echo "+ The port being checked: ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}" +openim::util::check_ports ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]} + +if [[ $? -ne 0 ]]; then + openim::log::error_exit "The service does not start properly, please check the port, query variable definition!" + echo "+++ https://github.com/OpenIMSDK/Open-IM-Server/tree/main/scripts/install/environment.sh +++" +else + echo "++++ Check all dependent service ports successfully !" +fi + +echo "++++ Check all OpenIM service ports" +echo "+ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}" +openim::util::check_ports ${OPENIM_SERVER_PORT_LISTARIES[@]} +if [[ $? -ne 0 ]]; then + echo "+++ cat openim log file >>> ${LOG_FILE}" + openim::log::error_exit "The service does not start properly, please check the port, query variable definition!" +else + echo "++++ Check all openim service ports successfully !" +fi \ No newline at end of file diff --git a/scripts/install/install-protobuf.sh b/scripts/install/install-protobuf.sh new file mode 100644 index 000000000..a9a1ef7a0 --- /dev/null +++ b/scripts/install/install-protobuf.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +# -------------------------------------------------------------- +# OpenIM Protoc Tool v1.0.0 +# -------------------------------------------------------------- +# OpenIM has released its custom Protoc tool version v1.0.0. +# This tool is customized to meet the specific needs of OpenIM and resides in its separate repository. +# It can be downloaded from the following link: +# https://github.com/OpenIMSDK/Open-IM-Protoc/releases/tag/v1.0.0 +# +# Download link (Windows): https://github.com/OpenIMSDK/Open-IM-Protoc/releases/download/v1.0.0/windows.zip +# Download link (Linux): https://github.com/OpenIMSDK/Open-IM-Protoc/releases/download/v1.0.0/linux.zip +# +# Installation steps (taking Windows as an example): +# 1. Visit the above link and download the version suitable for Windows. +# 2. Extract the downloaded file. +# 3. Add the extracted tool to your PATH environment variable so that it can be run directly from the command line. +# +# Note: The specific installation and usage instructions may vary based on the tool's actual implementation. It's advised to refer to official documentation. +# -------------------------------------------------------------- + +function help_message { + echo "Usage: ./install-protobuf.sh [option]" + echo "Options:" + echo "-i, --install Install the OpenIM Protoc tool." + echo "-u, --uninstall Uninstall the OpenIM Protoc tool." + echo "-r, --reinstall Reinstall the OpenIM Protoc tool." + echo "-c, --check Check if the OpenIM Protoc tool is installed." + echo "-h, --help Display this help message." +} + +function install_protobuf { + echo "Installing OpenIM Protoc tool..." + # Logic for installation based on the OS + # e.g., download, unzip, and add to PATH +} + +function uninstall_protobuf { + echo "Uninstalling OpenIM Protoc tool..." + # Logic for uninstallation + # e.g., remove from PATH and delete files +} + +function reinstall_protobuf { + echo "Reinstalling OpenIM Protoc tool..." + uninstall_protobuf + install_protobuf +} + +function check_protobuf { + echo "Checking for OpenIM Protoc tool installation..." + # Logic to check if the tool is installed + # e.g., which protoc or checking PATH +} + +while [ "$1" != "" ]; do + case $1 in + -i | --install ) install_protobuf + ;; + -u | --uninstall ) uninstall_protobuf + ;; + -r | --reinstall ) reinstall_protobuf + ;; + -c | --check ) check_protobuf + ;; + -h | --help ) help_message + exit + ;; + * ) help_message + exit 1 + esac + shift +done \ No newline at end of file