diff --git a/plugins/mongodb/info.json b/plugins/mongodb/info.json index f42160c5e..0c6d350ca 100755 --- a/plugins/mongodb/info.json +++ b/plugins/mongodb/info.json @@ -7,7 +7,7 @@ "shell": "install.sh", "install_pre_inspection":true, "uninstall_pre_inspection":true, - "versions":["4.4","5.0","6.0","7.0","8.0","8.2"], + "versions":["3.0","4.4","5.0","6.0","7.0","8.0","8.2"], "tip": "soft", "checks": "server/mongodb", "path": "server/mongodb", diff --git a/plugins/mongodb/versions/3.0/centos.sh b/plugins/mongodb/versions/3.0/centos.sh new file mode 100644 index 000000000..3c10f1a0a --- /dev/null +++ b/plugins/mongodb/versions/3.0/centos.sh @@ -0,0 +1,110 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin +export PATH + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") + +VERSION=3.0.1 +SYS_ARCH=`arch` + +SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` +SYS_NAME=${SYS_VERSION_ID/./} +SYS_NAME_LEN=`echo "$SYS_NAME" | wc -L` + +if [ "$SYS_NAME_LEN" == "1" ];then + SYS_NAME=${SYS_NAME}0 +fi + +if [ "$SYS_ARCH" == "aarch64" ];then + if [ "$SYS_NAME" -gt "82" ];then + SYS_NAME="82" + fi + + if [ "$SYS_NAME" -lt "62" ];then + SYS_NAME="62" + fi +else + + if [ "$SYS_NAME" -gt "80" ];then + SYS_NAME="80" + fi + + if [ "$SYS_NAME" -lt "70" ];then + SYS_NAME="70" + fi +fi + + +# https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel82-4.4.23.tgz +# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.4.23.tgz +# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-4.4.23.tgz +# https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel82-4.4.23.tgz +# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-4.4.23.tgz + +MG_DIR=$serverPath/source/mongodb +mkdir -p $MG_DIR + +FILE_NAME=mongodb-linux-${SYS_ARCH}-rhel${SYS_NAME}-${VERSION} +FILE_NAME_TGZ=${FILE_NAME}.tgz + +if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ} + echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}" +fi + +if [ ! -d $MG_DIR/${FILE_NAME} ];then + cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ} +fi + +if [ ! -d $serverPath/mongodb/bin ];then + mkdir -p $serverPath/mongodb + cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb +fi + +cd ${MG_DIR} && rm -rf ${MG_DIR}/${FILE_NAME} + +#--------------- mongosh tool install ------------------ # +TOOL_VERSION=2.2.5 +TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-x64 +if [ "aarch64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-arm64 +fi +TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz +if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ} + echo "wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}" +fi + +if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then + cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ} +fi + +cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb +cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME} + +#--------------- mongodb database install ------------------ # +TOOL_VERSION=100.9.4 +TOOL_FILE_NAME=mongodb-database-tools-rhel${SYS_NAME}-x86_64-${TOOL_VERSION} +if [ "aarch64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongodb-database-tools-rhel${SYS_NAME}-aarch64-${TOOL_VERSION} +fi + +if [ "arm64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongodb-database-tools-rhel${SYS_NAME}-arm64-${TOOL_VERSION} +fi + +TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz +if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://fastdl.mongodb.org/tools/db/${TOOL_FILE_NAME_TGZ} +fi + +if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then + cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ} +fi + +cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb +cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME} diff --git a/plugins/mongodb/versions/3.0/debian.sh b/plugins/mongodb/versions/3.0/debian.sh new file mode 100644 index 000000000..24008b150 --- /dev/null +++ b/plugins/mongodb/versions/3.0/debian.sh @@ -0,0 +1,88 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin +export PATH + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") + +VERSION=3.0.1 +SYS_ARCH=`arch` +SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` +SYS_NAME=${SYS_VERSION_ID/./} + +if [ "$SYS_NAME" -gt "10" ];then + SYS_NAME="10" +fi + +if [ "$SYS_NAME" -lt "10" ];then + SYS_NAME="10" +fi + +FILE_NAME=mongodb-linux-${SYS_ARCH}-debian${SYS_NAME}-${VERSION} +FILE_NAME_TGZ=${FILE_NAME}.tgz + + +MG_DIR=$serverPath/source/mongodb +mkdir -p $MG_DIR + +if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ} + echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}" +fi + +if [ ! -d $MG_DIR/${FILE_NAME_TGZ} ];then + cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ} +fi + +if [ ! -d $serverPath/mongodb/bin ];then + mkdir -p $serverPath/mongodb + cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb +fi + +cd ${MG_DIR} && rm -rf ${MG_DIR}/${FILE_NAME} + +#--------------- mongosh tool install ------------------ # +TOOL_VERSION=2.2.5 +TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-x64 +if [ "aarch64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-arm64 +fi +TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz +if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ} + echo "wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}" +fi + +if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then + cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ} +fi + +cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb +cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME} + + +#--------------- mongodb database install ------------------ # +TOOL_VERSION=100.9.4 +TOOL_FILE_NAME=mongodb-database-tools-debian${SYS_NAME}-x86_64-${TOOL_VERSION} +if [ "aarch64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongodb-database-tools-debian${SYS_NAME}-arm64-${TOOL_VERSION} +fi + +if [ "arm64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongodb-database-tools-debian${SYS_NAME}-arm64-${TOOL_VERSION} +fi + +TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.zip +if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://fastdl.mongodb.org/tools/db/${TOOL_FILE_NAME_TGZ} +fi + +if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then + cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ} +fi + +cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb +cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME} diff --git a/plugins/mongodb/versions/3.0/macos.sh b/plugins/mongodb/versions/3.0/macos.sh new file mode 100644 index 000000000..153b9390b --- /dev/null +++ b/plugins/mongodb/versions/3.0/macos.sh @@ -0,0 +1,76 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin +export PATH + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") + +VERSION=3.0.1 + +MG_DIR=$serverPath/source/mongodb +mkdir -p $MG_DIR + +if [ ! -f $MG_DIR/mongodb-macos-x86_64-${VERSION}.tgz ]; then + wget --no-check-certificate -O $MG_DIR/mongodb-macos-x86_64-${VERSION}.tgz https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-${VERSION}.tgz + echo "wget --no-check-certificate -O $MG_DIR/mongodb-macos-x86_64-${VERSION}.tgz https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-${VERSION}.tgz" +fi + +if [ ! -d $MG_DIR/mongodb-macos-x86_64-${VERSION} ];then + cd $MG_DIR && tar -zxvf mongodb-macos-x86_64-${VERSION}.tgz +fi + +if [ ! -d $serverPath/mongodb/bin ];then + mkdir -p $serverPath/mongodb + cd $MG_DIR/mongodb-macos-x86_64-${VERSION} && cp -rf ./bin $serverPath/mongodb +fi + +#--------------- mongosh tool install ------------------ # +TOOL_VERSION=2.2.5 +TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-darwin-x64 +if [ "aarch64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-darwin-arm64 +fi + +if [ "arm64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-darwin-arm64 +fi +TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.zip +if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ} + echo "wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}" +fi + +if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then + cd $MG_DIR && unzip ${TOOL_FILE_NAME_TGZ} +fi + +cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb +cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME} + +#--------------- mongodb-database-tools ------------------ # +# https://fastdl.mongodb.org/tools/db/mongodb-database-tools-macos-arm64-100.9.4.zip +TOOL_VERSION=100.9.4 +TOOL_FILE_NAME=mongodb-database-tools-macos-x86_64-${TOOL_VERSION} +if [ "aarch64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongodb-database-tools-macos-arm64-${TOOL_VERSION} +fi + +if [ "arm64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongodb-database-tools-macos-arm64-${TOOL_VERSION} +fi + +TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.zip +if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://fastdl.mongodb.org/tools/db/${TOOL_FILE_NAME_TGZ} + echo "wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://fastdl.mongodb.org/tools/db/${TOOL_FILE_NAME_TGZ}" +fi + +if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then + cd $MG_DIR && unzip ${TOOL_FILE_NAME_TGZ} +fi + +cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb +cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME} \ No newline at end of file diff --git a/plugins/mongodb/versions/3.0/opensuse.sh b/plugins/mongodb/versions/3.0/opensuse.sh new file mode 100644 index 000000000..64ffcac37 --- /dev/null +++ b/plugins/mongodb/versions/3.0/opensuse.sh @@ -0,0 +1,92 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin +export PATH + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") + +VERSION=3.0.1 +SYS_ARCH=`arch` + +SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}' | awk -F . '{print $1}'` + +SYS_NAME="15" +if [ "$SYS_VERSION_ID" -gt "15" ];then + SYS_NAME="15" +fi + +if [ "$SYS_NAME" -lt "12" ];then + SYS_NAME="12" +fi + +# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-suse15-4.4.23.tgz +# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-suse12-4.4.23.tgz + +MG_DIR=$serverPath/source/mongodb +mkdir -p $MG_DIR + +FILE_NAME=mongodb-linux-${SYS_ARCH}-suse${SYS_NAME}-${VERSION} +FILE_NAME_TGZ=${FILE_NAME}.tgz + +if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ} + echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}" +fi + +if [ ! -d $MG_DIR/${FILE_NAME} ];then + cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ} +fi + +if [ ! -d $serverPath/mongodb/bin ];then + mkdir -p $serverPath/mongodb + cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb +fi + +cd ${MG_DIR} && rm -rf ${MG_DIR}/${FILE_NAME} + +#--------------- mongosh tool install ------------------ # +TOOL_VERSION=2.2.5 +TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-x64 +if [ "aarch64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-arm64 +fi +TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz +if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ} + echo "wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}" +fi + +if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then + cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ} +fi + +cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb +cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME} + + +# https://fastdl.mongodb.org/tools/db/mongodb-database-tools-suse12-x86_64-100.9.4.tgz +#--------------- mongodb database install ------------------ # +TOOL_VERSION=100.9.4 +TOOL_FILE_NAME=mongodb-database-tools-suse${SYS_NAME}-x86_64-${TOOL_VERSION} +if [ "aarch64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongodb-database-tools-suse${SYS_NAME}-arm64-${TOOL_VERSION} +fi + +if [ "arm64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongodb-database-tools-suse${SYS_NAME}-arm64-${TOOL_VERSION} +fi + +TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz +if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://fastdl.mongodb.org/tools/db/${TOOL_FILE_NAME_TGZ} +fi + +if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then + cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ} +fi + +cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb +cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME} \ No newline at end of file diff --git a/plugins/mongodb/versions/3.0/rhel.sh b/plugins/mongodb/versions/3.0/rhel.sh new file mode 100644 index 000000000..1f8210b22 --- /dev/null +++ b/plugins/mongodb/versions/3.0/rhel.sh @@ -0,0 +1,63 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin +export PATH + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") + +VERSION=3.0.1 +SYS_ARCH=`arch` + +SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` +SYS_NAME=${SYS_VERSION_ID/./} +SYS_NAME_LEN=`echo "$SYS_NAME" | wc -L` + +if [ "$SYS_NAME_LEN" == "1" ];then + SYS_NAME=${SYS_NAME}0 +fi + +# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.4.23.tgz + +MG_DIR=$serverPath/source/mongodb +mkdir -p $MG_DIR + +FILE_NAME=mongodb-linux-${SYS_ARCH}-ubuntu${SYS_NAME}-${VERSION} +FILE_NAME_TGZ=${FILE_NAME}.tgz + +if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ} + echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}" +fi + +if [ ! -d $MG_DIR/${FILE_NAME} ];then + cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ} +fi + +if [ ! -d $serverPath/mongodb/bin ];then + mkdir -p $serverPath/mongodb + cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb +fi + +cd ${MG_DIR} && rm -rf ${MG_DIR}/${FILE_NAME} + +#--------------- mongosh tool install ------------------ # +TOOL_VERSION=2.2.5 +TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-x64 +if [ "aarch64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-arm64 +fi +TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz +if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ} + echo "wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}" +fi + +if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then + cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ} +fi + +cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb +cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME} \ No newline at end of file diff --git a/plugins/mongodb/versions/3.0/ubuntu.sh b/plugins/mongodb/versions/3.0/ubuntu.sh new file mode 100644 index 000000000..5eac1b70f --- /dev/null +++ b/plugins/mongodb/versions/3.0/ubuntu.sh @@ -0,0 +1,89 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin +export PATH + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") + +VERSION=3.0.1 +SYS_ARCH=`arch` + +SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` +SYS_NAME=${SYS_VERSION_ID/./} +# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.23.tgz + +if [ "$SYS_NAME" -gt "2004" ];then + SYS_NAME="2004" +fi + +if [ "$SYS_NAME" -lt "1604" ];then + SYS_NAME="1604" +fi + +MG_DIR=$serverPath/source/mongodb +mkdir -p $MG_DIR + +FILE_NAME=mongodb-linux-${SYS_ARCH}-ubuntu${SYS_NAME}-${VERSION} +FILE_NAME_TGZ=${FILE_NAME}.tgz + +if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ} + echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}" +fi + +if [ ! -d $MG_DIR/${FILE_NAME} ];then + cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ} +fi + +if [ ! -d $serverPath/mongodb/bin ];then + mkdir -p $serverPath/mongodb + cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb +fi + +cd ${MG_DIR} && rm -rf ${MG_DIR}/${FILE_NAME} + +#--------------- mongosh tool install ------------------ # +TOOL_VERSION=2.2.5 +TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-x64 +if [ "aarch64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-arm64 +fi +TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz +if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ} + echo "wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}" +fi + +if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then + cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ} +fi + +cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb +cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME} + +# https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.9.4.tgz +#--------------- mongodb database install ------------------ # +TOOL_VERSION=100.9.4 +TOOL_FILE_NAME=mongodb-database-tools-ubuntu${SYS_NAME}-x86_64-${TOOL_VERSION} +if [ "aarch64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongodb-database-tools-ubuntu${SYS_NAME}-arm64-${TOOL_VERSION} +fi + +if [ "arm64" == ${SYS_ARCH} ];then + TOOL_FILE_NAME=mongodb-database-tools-ubuntu${SYS_NAME}-arm64-${TOOL_VERSION} +fi + +TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz +if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then + wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://fastdl.mongodb.org/tools/db/${TOOL_FILE_NAME_TGZ} +fi + +if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then + cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ} +fi + +cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb +cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME} \ No newline at end of file