新增:给群晖6.2系统安装docker-compose

This commit is contained in:
悟空的日常镜像仓库 2024-06-13 21:28:05 +08:00
parent 2f86277c9b
commit ebff06c64c
1 changed files with 47 additions and 0 deletions

View File

@ -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 "————————————————————————————————————————————————————"