From fcfdfe822acee5c88b6976e1e75cf6d5cfa70171 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sun, 19 May 2024 21:36:25 +0800 Subject: [PATCH] up --- plugins/sphinx/info.json | 3 +- plugins/sphinx/install.sh | 100 ++++++++++++++++++++++++++++++-------- 2 files changed, 81 insertions(+), 22 deletions(-) diff --git a/plugins/sphinx/info.json b/plugins/sphinx/info.json index cecab533c..9150c8822 100755 --- a/plugins/sphinx/info.json +++ b/plugins/sphinx/info.json @@ -4,8 +4,7 @@ "name": "sphinx", "title": "sphinx", "shell": "install.sh", - "versions":["3.1.1"], - "updates":["3.1.1"], + "versions":["3.1.1","3.2.1","3.3.1","3.4.1","3.5.1","3.6.1","3.7.1"], "tip": "soft", "checks": "server/sphinx", "path": "server/sphinx", diff --git a/plugins/sphinx/install.sh b/plugins/sphinx/install.sh index 231489a0d..b9f3ec800 100755 --- a/plugins/sphinx/install.sh +++ b/plugins/sphinx/install.sh @@ -7,6 +7,7 @@ rootPath=$(dirname "$curPath") rootPath=$(dirname "$rootPath") serverPath=$(dirname "$rootPath") sysName=`uname` +sysArch=`arch` install_tmp=${rootPath}/tmp/mw_install.pl @@ -17,40 +18,90 @@ install_tmp=${rootPath}/tmp/mw_install.pl # /Users/midoks/Desktop/mwdev/server/sphinx/bin/bin/indexer /Users/midoks/Desktop/mwdev/server/sphinx/sphinx.conf 99cms_mc_comic --rotate bash ${rootPath}/scripts/getos.sh -OSNAME=`cat ${rootPath}/data/osname.pl` -OSNAME_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` +echo "bash ${rootPath}/scripts/getos.sh" -if [ ${OSNAME} == "centos" ] || - [ ${OSNAME} == "fedora" ] || - [ ${OSNAME} == "alma" ]; then +OSNAME="macos" +if [ -f ${rootPath}/data/osname.pl ];then + OSNAME=`cat ${rootPath}/data/osname.pl` +fi + +if [ "${OSNAME}" == "centos" ] || + [ "${OSNAME}" == "fedora" ] || + [ "${OSNAME}" == "alma" ]; then yum install -y postgresql-libs unixODBC fi +# http://sphinxsearch.com/files/sphinx-3.7.1-da9f8a4-linux-amd64.tar.gz + +VERSION=$2 + +# echo $VERSION + +if [ "$VERSION" == "3.1.1" ];then + VERSION_NUM=${VERSION}-612d99f +elif [ "$VERSION" == "3.2.1" ]; then + VERSION_NUM=${VERSION}-f152e0b +elif [ "$VERSION" == "3.3.1" ]; then + VERSION_NUM=${VERSION}-b72d67b +elif [ "$VERSION" == "3.4.1" ]; then + VERSION_NUM=${VERSION}-efbcc65 +elif [ "$VERSION" == "3.5.1" ]; then + VERSION_NUM=${VERSION}-82c60cb +elif [ "$VERSION" == "3.6.1" ]; then + VERSION_NUM=${VERSION}-c9dbeda +elif [ "$VERSION" == "3.7.1" ]; then + VERSION_NUM=${VERSION}-da9f8a4 +fi + +# echo $VERSION_NUM -VERSION=3.1.1 Install_sphinx() { - echo '正在安装Sphinx...' mkdir -p $serverPath/sphinx SPHINX_DIR=${serverPath}/source/sphinx mkdir -p $SPHINX_DIR - - if [ ! -f ${SPHINX_DIR}/sphinx-${VERSION}.tar.gz ];then + + SPH_NAME=amd64 + if [ "$sysArch" == "arm64" ];then + SPH_NAME=amd64 + elif [ "$sysArch" == "x86_64" ]; then + SPH_NAME=amd64 + elif [ "$sysArch" == "aarch64" ]; then + SPH_NAME=aarch64 + fi + + if [ "$sysName" == "Darwin" ] && [ "$VERSION" == "3.7.1" ];then + SPH_NAME=aarch64 + fi + + SPH_SYSNAME=linux + if [ $sysName == 'Darwin' ]; then + SPH_SYSNAME=darwin + elif [ "$sysName" == "aarch64" ]; then + SPH_NAME=aarch64 + elif [ "$sysName" == "freebsd" ]; then + SPH_NAME=freebsd + fi + + FILE_NAME=sphinx-${VERSION_NUM}-${SPH_SYSNAME}-${SPH_NAME} + FILE_TGZ=${FILE_NAME}.tar.gz + + echo "${SPHINX_DIR}/${FILE_TGZ}" + if [ ! -f ${SPHINX_DIR}/${FILE_TGZ} ];then if [ $sysName == 'Darwin' ]; then - wget -O ${SPHINX_DIR}/sphinx-${VERSION}.tar.gz http://sphinxsearch.com/files/sphinx-${VERSION}-612d99f-darwin-amd64.tar.gz + wget -O ${SPHINX_DIR}/sphinx-${VERSION}.tar.gz http://sphinxsearch.com/files/${FILE_TGZ} else - curl -sSLo ${SPHINX_DIR}/sphinx-${VERSION}.tar.gz http://sphinxsearch.com/files/sphinx-${VERSION}-612d99f-linux-amd64.tar.gz + curl -sSLo ${SPHINX_DIR}/sphinx-${VERSION}.tar.gz http://sphinxsearch.com/files/${FILE_TGZ} fi fi - if [ ! -f ${SPHINX_DIR}/sphinx-${VERSION}.tar.gz ];then - curl -sSLo ${SPHINX_DIR}/sphinx-${VERSION}.tar.gz https://github.com/midoks/mdserver-web/releases/download/init/sphinx-${VERSION}.tar.gz - fi + # if [ ! -f ${SPHINX_DIR}/sphinx-${VERSION}.tar.gz ];then + # curl -sSLo ${SPHINX_DIR}/sphinx-${VERSION}.tar.gz https://github.com/midoks/mdserver-web/releases/download/init/sphinx-${VERSION}.tar.gz + # fi - - cd ${SPHINX_DIR} && tar -zxvf sphinx-${VERSION}.tar.gz + cd ${SPHINX_DIR} && tar -zxvf ${FILE_TGZ} if [ "$?" == "0" ];then mkdir -p $SPHINX_DIR @@ -74,8 +125,14 @@ Uninstall_sphinx() if [ -f /usr/lib/systemd/system/sphinx.service ] || [ -f /lib/systemd/system/sphinx.service ];then systemctl stop sphinx systemctl disable sphinx - rm -rf /usr/lib/systemd/system/sphinx.service - rm -rf /lib/systemd/system/sphinx.service + + if [ -f /usr/lib/systemd/system/sphinx.service ];then + rm -rf /usr/lib/systemd/system/sphinx.service + fi + + if [ -f /lib/systemd/system/sphinx.service ];then + rm -rf /lib/systemd/system/sphinx.service + fi systemctl daemon-reload fi @@ -83,8 +140,11 @@ Uninstall_sphinx() $serverPath/sphinx/initd/sphinx stop fi - rm -rf $serverPath/sphinx - echo "Uninstall_sphinx" > $install_tmp + if [ -f $serverPath/sphinx ];then + rm -rf $serverPath/sphinx + fi + + echo "卸载sphinx成功" } action=$1