This commit is contained in:
Mr Chen
2024-05-19 21:36:25 +08:00
parent d8e08812f9
commit fcfdfe822a
2 changed files with 81 additions and 22 deletions
+1 -2
View File
@@ -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",
+80 -20
View File
@@ -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