From ebff06c64c04ba2aa1666d6ce5b763ccf0365459 Mon Sep 17 00:00:00 2001 From: wukongdaily <2666180@gmail.com> Date: Thu, 13 Jun 2024 21:28:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E7=BB=99=E7=BE=A4?= =?UTF-8?q?=E6=99=966.2=E7=B3=BB=E7=BB=9F=E5=AE=89=E8=A3=85docker-compose?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zero3/pi.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/zero3/pi.sh b/zero3/pi.sh index 7c6864f..7c304b9 100644 --- a/zero3/pi.sh +++ b/zero3/pi.sh @@ -32,6 +32,7 @@ menu_options=( "安装小雅转存清理工具" "安装小雅tvbox" "使用docker-compose部署小雅全家桶(建议x86-64设备)" + "群晖6.2系统安装docker-compose(x86-64)" "修改阿里云盘Token(32位)" "修改阿里云盘OpenToken(335位)" "修改小雅转存文件夹ID(40位)" @@ -63,6 +64,8 @@ commands=( ["安装特斯拉伴侣TeslaMate"]="install_teslamate" ["安装内网穿透工具DDNSTO"]="install_ddnsto" ["使用docker-compose部署小雅全家桶(建议x86-64设备)"]="install_xiaoya_emby" + ["群晖6.2系统安装docker-compose(x86-64)"]="do_install_docker_compose" + ) @@ -523,6 +526,50 @@ install_xiaoya_emby(){ bash -c "$(curl -fsSL https://cafe.cpolar.cn/wkdaily/zero3/raw/branch/main/xiaoya/xiaoya-all.sh)" } +get_docker_compose_url() { + if [ $# -eq 0 ]; then + echo "需要提供GitHub releases页面的URL作为参数。" + return 1 + fi + local releases_url=$1 + # 使用curl获取重定向的URL + latest_url=$(curl -Ls -o /dev/null -w "%{url_effective}" "$releases_url") + # 使用sed从URL中提取tag值,并保留前导字符'v' + tag=$(echo $latest_url | sed 's|.*/v|v|') + # 检查是否成功获取到tag + if [ -z "$tag" ]; then + echo "未找到最新的release tag。" + return 1 + fi + + platform="docker-compose-linux-x86_64" + local repo_path=$(echo "$releases_url" | sed -n 's|https://github.com/\(.*\)/releases/latest|\1|p') + if [[ $(curl -s ipinfo.io/country) == "CN" ]]; then + docker_compose_download_url="https://cafe.cpolar.cn/wkdaily/docker-compose/raw/branch/main/${platform}" + else + docker_compose_download_url="https://github.com/${repo_path}/releases/download/${tag}/${platform}" + fi + echo "$docker_compose_download_url" +} + +# 适配群晖6.2 先行安装 docker-compose +do_install_docker_compose() { + # /usr/local/bin/docker-compose + local github_releases_url="https://github.com/docker/compose/releases/latest" + local docker_compose_url=$(get_docker_compose_url "$github_releases_url") + cyan "最新版docker-compose 地址:$docker_compose_url" + cyan "即将下载最新版docker-compose standalone" + wget -O /usr/local/bin/docker-compose $docker_compose_url + if [ $? -eq 0 ]; then + green "docker-compose下载并安装成功,你可以使用啦" + chmod +x /usr/local/bin/docker-compose + else + red "安装失败,请检查网络连接.或者手动下载到 /usr/local/bin/docker-compose 记得赋予执行权限" + yellow "刚才使用的地址是:$docker_compose_url" + exit 1 + fi +} + show_menu() { clear greenline "————————————————————————————————————————————————————"