#!/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 if [ ${OS} == "unknown" ]; then error "该系统不支持安装面板(The system does not support installing the panel)" fi old_version=$(panel-cli setting get version) old_version=${old_version#v} panel_path="${setup_path}/panel" # 大于 function version_gt() { test "$(echo -e "$1\n$2" | tr " " "\n" | sort -V | head -n 1)" != "$1"; } # 小于 function version_lt() { test "$(echo -e "$1\n$2" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; } # 大于等于 function version_ge() { test "$(echo -e "$1\n$2" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; } # 小于等于 function version_le() { test "$(echo -e "$1\n$2" | tr " " "\n" | sort -V | head -n 1)" == "$1"; } # 判断版本号是否合法 version_pattern="^[0-9]+\.[0-9]+\.[0-9]+$" if [[ ! $old_version =~ $version_pattern ]]; then error "面板版本号不合法(The panel version number is invalid)" fi echo $HR # TODO echo $HR echo "更新结束" echo "Update finished"