更新判断面板是否是通过docker安装的逻辑 (#311)
* 更新判断面板是否是通过docker安装的逻辑 * Updated logic for determining whether a panel is installed via docker or not
This commit is contained in:
parent
b00a00e791
commit
53581d48fc
@ -797,14 +797,29 @@ select_version() {
|
|||||||
DOCKER_COMPOSE_COMMAND=""
|
DOCKER_COMPOSE_COMMAND=""
|
||||||
if docker compose version >/dev/null 2>&1; then
|
if docker compose version >/dev/null 2>&1; then
|
||||||
DOCKER_COMPOSE_COMMAND="docker compose"
|
DOCKER_COMPOSE_COMMAND="docker compose"
|
||||||
elif command -v docker-compose >/dev/null 2>&1; then
|
|
||||||
DOCKER_COMPOSE_COMMAND="docker-compose"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n $DOCKER_COMPOSE_COMMAND ]]; then
|
|
||||||
if $DOCKER_COMPOSE_COMMAND ls | grep -qw "$NZ_DASHBOARD_PATH/docker-compose.yaml" >/dev/null 2>&1; then
|
if $DOCKER_COMPOSE_COMMAND ls | grep -qw "$NZ_DASHBOARD_PATH/docker-compose.yaml" >/dev/null 2>&1; then
|
||||||
|
NEZHA_IMAGES=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -w "nezha-dashboard")
|
||||||
|
if [ -n "$NEZHA_IMAGES" ]; then
|
||||||
|
echo "存在带有 nezha-dashboard 仓库的 Docker 镜像:"
|
||||||
|
echo "$NEZHA_IMAGES"
|
||||||
IS_DOCKER_NEZHA=1
|
IS_DOCKER_NEZHA=1
|
||||||
return
|
return
|
||||||
|
else
|
||||||
|
echo "未找到带有 nezha-dashboard 仓库的 Docker 镜像。"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif command -v docker-compose >/dev/null 2>&1; then
|
||||||
|
DOCKER_COMPOSE_COMMAND="docker-compose"
|
||||||
|
if $DOCKER_COMPOSE_COMMAND -f "$NZ_DASHBOARD_PATH/docker-compose.yaml" config >/dev/null 2>&1; then
|
||||||
|
NEZHA_IMAGES=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -w "nezha-dashboard")
|
||||||
|
if [ -n "$NEZHA_IMAGES" ]; then
|
||||||
|
echo "存在带有 nezha-dashboard 仓库的 Docker 镜像:"
|
||||||
|
echo "$NEZHA_IMAGES"
|
||||||
|
IS_DOCKER_NEZHA=1
|
||||||
|
return
|
||||||
|
else
|
||||||
|
echo "未找到带有 nezha-dashboard 仓库的 Docker 镜像。"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -795,14 +795,29 @@ select_version() {
|
|||||||
DOCKER_COMPOSE_COMMAND=""
|
DOCKER_COMPOSE_COMMAND=""
|
||||||
if docker compose version >/dev/null 2>&1; then
|
if docker compose version >/dev/null 2>&1; then
|
||||||
DOCKER_COMPOSE_COMMAND="docker compose"
|
DOCKER_COMPOSE_COMMAND="docker compose"
|
||||||
elif command -v docker-compose >/dev/null 2>&1; then
|
|
||||||
DOCKER_COMPOSE_COMMAND="docker-compose"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n $DOCKER_COMPOSE_COMMAND ]]; then
|
|
||||||
if $DOCKER_COMPOSE_COMMAND ls | grep -qw "$NZ_DASHBOARD_PATH/docker-compose.yaml" >/dev/null 2>&1; then
|
if $DOCKER_COMPOSE_COMMAND ls | grep -qw "$NZ_DASHBOARD_PATH/docker-compose.yaml" >/dev/null 2>&1; then
|
||||||
|
NEZHA_IMAGES=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -w "nezha-dashboard")
|
||||||
|
if [ -n "$NEZHA_IMAGES" ]; then
|
||||||
|
echo "Docker image with nezha-dashboard repository exists:"
|
||||||
|
echo "$NEZHA_IMAGES"
|
||||||
IS_DOCKER_NEZHA=1
|
IS_DOCKER_NEZHA=1
|
||||||
return
|
return
|
||||||
|
else
|
||||||
|
echo "No Docker images with the nezha-dashboard repository were found."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif command -v docker-compose >/dev/null 2>&1; then
|
||||||
|
DOCKER_COMPOSE_COMMAND="docker-compose"
|
||||||
|
if $DOCKER_COMPOSE_COMMAND -f "$NZ_DASHBOARD_PATH/docker-compose.yaml" config >/dev/null 2>&1; then
|
||||||
|
NEZHA_IMAGES=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -w "nezha-dashboard")
|
||||||
|
if [ -n "$NEZHA_IMAGES" ]; then
|
||||||
|
echo "Docker image with nezha-dashboard repository exists:"
|
||||||
|
echo "$NEZHA_IMAGES"
|
||||||
|
IS_DOCKER_NEZHA=1
|
||||||
|
return
|
||||||
|
else
|
||||||
|
echo "No Docker images with the nezha-dashboard repository were found."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user