mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-05 09:36:00 +08:00
feat: set openim lint
Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
@@ -21,17 +21,17 @@
|
||||
# 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
|
||||
#
|
||||
#
|
||||
# About the tool:
|
||||
# https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/protoc-tools.md
|
||||
# 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.
|
||||
# --------------------------------------------------------------
|
||||
|
||||
@@ -40,79 +40,79 @@ DOWNLOAD_DIR="/tmp/openim-protoc"
|
||||
INSTALL_DIR="/usr/local/bin"
|
||||
|
||||
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."
|
||||
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..."
|
||||
|
||||
# Create temporary directory and download the zip file
|
||||
mkdir -p $DOWNLOAD_DIR
|
||||
wget $PROTOC_DOWNLOAD_URL -O $DOWNLOAD_DIR/linux.zip
|
||||
|
||||
# Unzip the file
|
||||
unzip -o $DOWNLOAD_DIR/linux.zip -d $DOWNLOAD_DIR
|
||||
|
||||
# Move binaries to the install directory and make them executable
|
||||
sudo cp $DOWNLOAD_DIR/linux/protoc $INSTALL_DIR/
|
||||
sudo cp $DOWNLOAD_DIR/linux/protoc-gen-go $INSTALL_DIR/
|
||||
sudo chmod +x $INSTALL_DIR/protoc
|
||||
sudo chmod +x $INSTALL_DIR/protoc-gen-go
|
||||
|
||||
# Clean up
|
||||
rm -rf $DOWNLOAD_DIR
|
||||
|
||||
echo "OpenIM Protoc tool installed successfully!"
|
||||
echo "Installing OpenIM Protoc tool..."
|
||||
|
||||
# Create temporary directory and download the zip file
|
||||
mkdir -p $DOWNLOAD_DIR
|
||||
wget $PROTOC_DOWNLOAD_URL -O $DOWNLOAD_DIR/linux.zip
|
||||
|
||||
# Unzip the file
|
||||
unzip -o $DOWNLOAD_DIR/linux.zip -d $DOWNLOAD_DIR
|
||||
|
||||
# Move binaries to the install directory and make them executable
|
||||
sudo cp $DOWNLOAD_DIR/linux/protoc $INSTALL_DIR/
|
||||
sudo cp $DOWNLOAD_DIR/linux/protoc-gen-go $INSTALL_DIR/
|
||||
sudo chmod +x $INSTALL_DIR/protoc
|
||||
sudo chmod +x $INSTALL_DIR/protoc-gen-go
|
||||
|
||||
# Clean up
|
||||
rm -rf $DOWNLOAD_DIR
|
||||
|
||||
echo "OpenIM Protoc tool installed successfully!"
|
||||
}
|
||||
|
||||
function uninstall_protobuf {
|
||||
echo "Uninstalling OpenIM Protoc tool..."
|
||||
|
||||
# Removing binaries from the install directory
|
||||
sudo rm -f $INSTALL_DIR/protoc
|
||||
sudo rm -f $INSTALL_DIR/protoc-gen-go
|
||||
|
||||
echo "OpenIM Protoc tool uninstalled successfully!"
|
||||
echo "Uninstalling OpenIM Protoc tool..."
|
||||
|
||||
# Removing binaries from the install directory
|
||||
sudo rm -f $INSTALL_DIR/protoc
|
||||
sudo rm -f $INSTALL_DIR/protoc-gen-go
|
||||
|
||||
echo "OpenIM Protoc tool uninstalled successfully!"
|
||||
}
|
||||
|
||||
function reinstall_protobuf {
|
||||
echo "Reinstalling OpenIM Protoc tool..."
|
||||
uninstall_protobuf
|
||||
install_protobuf
|
||||
echo "Reinstalling OpenIM Protoc tool..."
|
||||
uninstall_protobuf
|
||||
install_protobuf
|
||||
}
|
||||
|
||||
function check_protobuf {
|
||||
echo "Checking for OpenIM Protoc tool installation..."
|
||||
|
||||
which protoc > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "OpenIM Protoc tool is installed."
|
||||
else
|
||||
echo "OpenIM Protoc tool is not installed."
|
||||
fi
|
||||
echo "Checking for OpenIM Protoc tool installation..."
|
||||
|
||||
which protoc > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "OpenIM Protoc tool is installed."
|
||||
else
|
||||
echo "OpenIM Protoc tool is not installed."
|
||||
fi
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user