123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #!/bin/bash
- # 函数名:check_pkg_version
- # 参数1:pkg_ver
- # 参数2:min_ver
- # 参数3:max_ver
- check_pkg_version() {
- pkg_ver=$1
- min_ver=$2
- max_ver=$3
- # 判断版本号是否在范围内
- if dpkg --compare-versions "$min_ver" "<=" "$pkg_ver" \
- && dpkg --compare-versions "$max_ver" ">=" "$pkg_ver"
- then
- return 1
- else
- return 0
- fi
- }
- # cmake 安装,由于rabbitmq安装版本要求最低为3.22,所以需要重新安装cmake
- cmake_ver=$(cmake --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
- check_pkg_version "$cmake_ver" 3.22.0 3.26.0
- if [ $? -eq 1 ]
- then
- echo "cmake version: " "$cmake_ver"
- else
- echo "Reinstall cmake to version: 3.26.0"
- sudo apt autoremove cmake
- # 架构管理
- arch=$(uname -m)
- if [ "$arch" = "x86_64" ]
- then
- cd cmake_x86_64 || exit
- fi
- if [ "$arch" = "aarch64" ]
- then
- cd cmake_aarch64 || exit
- fi
- ./install.sh
- cd ..
- fi
|