#!/bin/bash export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH : ' Copyright (C) 2022 - now HaoZi Technology Co., Ltd. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . ' source <(curl -f -s --connect-timeout 10 --retry 3 https://dl.cdn.haozi.net/panel/public.sh) if [ $? -ne 0 ]; then echo "下载 public.sh 失败,请检查网络或稍后重试。" echo "Download public.sh failed, please check the network or try again later." exit 1 fi channel=${1} version=${2} phpmyadmin_path="${setup_path}/server/phpmyadmin" random_dir="$(cat /dev/urandom | head -n 16 | sha256sum | head -c 10)" # 准备安装目录 rm -rf ${phpmyadmin_path} mkdir -p ${phpmyadmin_path} cd ${phpmyadmin_path} wget --retry-connrefused --retry-on-host-error --retry-on-http-error=429,500,502,503,504 -t 10 -T 120 -O phpMyAdmin-${version}-all-languages.zip ${download_url}/phpmyadmin/phpMyAdmin-${version}-all-languages.zip wget --retry-connrefused --retry-on-host-error --retry-on-http-error=429,500,502,503,504 -t 10 -T 120 -O phpMyAdmin-${version}-all-languages.zip.sha256 ${download_url}/phpmyadmin/phpMyAdmin-${version}-all-languages.zip.sha256 if ! sha256sum --status -c phpMyAdmin-${version}-all-languages.zip.sha256; then rm -rf ${phpmyadmin_path} error "phpMyAdmin 校验失败" fi unzip -o phpMyAdmin-${version}-all-languages.zip mv phpMyAdmin-${version}-all-languages phpmyadmin_${random_dir} chown -R www:www ${phpmyadmin_path} chmod -R 755 ${phpmyadmin_path} rm -rf phpMyAdmin-${version}-all-languages.zip rm -rf phpMyAdmin-${version}-all-languages.zip.sha256 # 判断PHP版本 php_version="" if [ -d "${setup_path}/server/php/74" ]; then php_version="74" fi if [ -d "${setup_path}/server/php/80" ]; then php_version="80" fi if [ -d "${setup_path}/server/php/81" ]; then php_version="81" fi if [ -d "${setup_path}/server/php/82" ]; then php_version="82" fi if [ -d "${setup_path}/server/php/83" ]; then php_version="83" fi if [ -d "${setup_path}/server/php/84" ]; then php_version="84" fi if [ "${php_version}" == "" ]; then rm -rf ${phpmyadmin_path} error "未安装 PHP" fi # 写入 phpMyAdmin 配置文件 cat >${setup_path}/server/vhost/phpmyadmin.conf <