diff --git a/plugins/php-apt/install.sh b/plugins/php-apt/install.sh index 06984246a..0c2dd9cab 100755 --- a/plugins/php-apt/install.sh +++ b/plugins/php-apt/install.sh @@ -18,6 +18,17 @@ else useradd -g www -s /bin/bash www fi +_os=`uname` +if [ ${_os} == "Darwin" ]; then + OSNAME='macos' +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' +else + OSNAME='unknow' +fi + action=$1 type=$2 @@ -32,9 +43,13 @@ if [ ! -d $curPath/versions/$2 ];then fi + +if [ "$OSNAME" == "ubuntu" ];then + echo "y" | add-apt-repository ppa:ondrej/php && apt update -y +fi # apt install $(grep-aptavail -S PHP-defaults -s Package -n) -if [ ! -f /etc/apt/sources.list.d/php.list ];then +if [ ! -f /etc/apt/sources.list.d/php.list ] && [ "$OSNAME" == "debian" ];then # install php source apt update -y @@ -46,7 +61,6 @@ apt update -y fi - if [ "${action}" == "uninstall" ] && [ -d ${serverPath}/php-apt/${type} ];then #初始化 cd ${rootPath} && python3 ${rootPath}/plugins/php-apt/index.py stop ${type}