mdserver-web/plugins/phpmyadmin/install.sh

90 lines
2.2 KiB
Bash
Raw Normal View History

2019-01-06 08:20:17 -05:00
#!/bin/bash
2023-12-29 13:43:43 -05:00
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
2019-01-06 08:20:17 -05:00
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
2025-09-11 04:38:30 -04:00
# cd /www/server/mdserver-web/plugins/phpmyadmin && bash install.sh install 4.4.15
2025-01-03 09:21:02 -05:00
# cd /www/server/mdserver-web && python3 plugins/phpmyadmin/index.py start
2022-10-24 07:55:09 -04:00
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
fi
if [ "$sys_os" == "Darwin" ];then
BAK='_bak'
else
BAK=''
fi
2022-06-29 07:51:09 -04:00
sysName=`uname`
echo "use system: ${sysName}"
2022-10-24 07:55:09 -04:00
if [ "${sysName}" == "Darwin" ]; then
2022-06-29 07:51:09 -04:00
OSNAME='macos'
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
OSNAME='centos'
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
OSNAME='fedora'
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
OSNAME='debian'
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
OSNAME='ubuntu'
elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then
OSNAME='raspbian'
else
OSNAME='unknow'
fi
2019-01-06 08:20:17 -05:00
Install_phpmyadmin()
{
2022-11-18 11:46:08 -05:00
if [ -d $serverPath/phpmyadmin ];then
exit 0
fi
2019-01-06 08:20:17 -05:00
mkdir -p ${serverPath}/source/phpmyadmin
2023-02-16 02:39:08 -05:00
2019-01-06 08:20:17 -05:00
VER=$1
2022-08-06 00:03:30 -04:00
2019-01-06 08:20:17 -05:00
FDIR=phpMyAdmin-${VER}-all-languages
2022-08-06 00:03:30 -04:00
FILE=phpMyAdmin-${VER}-all-languages.tar.gz
2019-01-06 08:20:17 -05:00
DOWNLOAD=https://files.phpmyadmin.net/phpMyAdmin/${VER}/$FILE
if [ ! -f $serverPath/source/phpmyadmin/$FILE ];then
2022-08-06 00:03:30 -04:00
wget --no-check-certificate -O $serverPath/source/phpmyadmin/$FILE $DOWNLOAD
2019-01-06 08:20:17 -05:00
fi
if [ ! -d $serverPath/source/phpmyadmin/$FDIR ];then
cd $serverPath/source/phpmyadmin && tar zxvf $FILE
fi
2025-01-28 03:44:36 -05:00
mkdir -p ${serverPath}/phpmyadmin
2019-01-06 08:20:17 -05:00
cp -r $serverPath/source/phpmyadmin/$FDIR $serverPath/phpmyadmin/
cd $serverPath/phpmyadmin/ && mv $FDIR phpmyadmin
2023-10-30 14:29:05 -04:00
rm -rf $serverPath/source/phpmyadmin/$FDIR
2025-02-18 03:12:50 -05:00
echo "${1}" > ${serverPath}/phpmyadmin/version.pl
2022-06-29 07:51:09 -04:00
cd ${rootPath} && python3 ${rootPath}/plugins/phpmyadmin/index.py start
2025-01-28 03:44:36 -05:00
echo '安装完成'
2019-01-06 08:20:17 -05:00
}
Uninstall_phpmyadmin()
{
2022-06-29 07:51:09 -04:00
cd ${rootPath} && python3 ${rootPath}/plugins/phpmyadmin/index.py stop
2019-01-06 08:20:17 -05:00
rm -rf ${serverPath}/phpmyadmin
2023-12-29 14:21:20 -05:00
echo '卸载完成'
2019-01-06 08:20:17 -05:00
}
action=$1
if [ "${1}" == 'install' ];then
Install_phpmyadmin $2
else
Uninstall_phpmyadmin $2
fi