add teslamate for arm64

This commit is contained in:
悟空的日常镜像仓库 2024-05-12 10:00:42 +08:00
parent e3eeee9b0a
commit 8a6ffd5e68
1 changed files with 67 additions and 1 deletions

View File

@ -99,6 +99,68 @@ install_1panel_on_openwrt() {
} }
#根据release地址和命名前缀获取apk地址
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
# 拼接docker-compose下载链接
local repo_path=$(echo "$releases_url" | sed -n 's|https://github.com/\(.*\)/releases/latest|\1|p')
docker_compose_download_url="https://github.com/${repo_path}/releases/download/${tag}/docker-compose-linux-aarch64"
echo "$docker_compose_download_url"
}
# 下载并安装Docker Compose
do_install_docker_compose() {
# https://github.com/docker/compose/releases/download/v2.26.0/docker-compose-linux-aarch64
# 检查/usr/bin/docker是否存在并且可执行
if [ -f "/usr/bin/docker" ] && [ -x "/usr/bin/docker" ]; then
echo "Docker is installed and has execute permissions."
else
red "警告 您还没有安装Docker"
exit 1
fi
local github_releases_url="https://github.com/docker/compose/releases/latest"
local docker_compose_url=$(get_docker_compose_url "$github_releases_url")
echo "最新版docker-compose 地址:$docker_compose_url"
wget -O /usr/bin/docker-compose $docker_compose_url
if [ $? -eq 0 ]; then
green "docker-compose下载并安装成功,你可以使用啦"
chmod +x /usr/bin/docker-compose
else
red "安装失败,请检查网络连接.或者手动下载到 /usr/bin/docker-compose 记得赋予执行权限"
yellow "刚才使用的地址是:$docker_compose_url"
exit 1
fi
}
# 安装特斯拉伴侣
install_teslamate() {
if which docker-compose >/dev/null 2>&1; then
echo "Docker Compose is installed."
docker-compose --version
mkdir -p /tmp/teslamate
wget -O /tmp/teslamate/docker-compose.yml https://cafe.cpolar.cn/wkdaily/zero3/raw/branch/main/teslamate/docker-compose.yml
cd /tmp/teslamate
docker-compose up -d
else
echo "Docker Compose is not installed. "
do_install_docker_compose
fi
}
# ************************************************************* # *************************************************************
while true; do while true; do
#************************************* #*************************************
@ -116,7 +178,8 @@ while true; do
echo " 2. 安装盒子助手docker版" echo " 2. 安装盒子助手docker版"
echo " 3. 安装AList docker版" echo " 3. 安装AList docker版"
echo " 4. 安装1panel面板docker版" echo " 4. 安装1panel面板docker版"
echo " 5. 更新脚本" echo " 5. 安装特斯拉伴侣TeslaMate"
echo " 6. 更新脚本"
echo echo
echo " Q. 退出本程序" echo " Q. 退出本程序"
echo echo
@ -137,6 +200,9 @@ while true; do
install_1panel_on_openwrt install_1panel_on_openwrt
;; ;;
5) 5)
install_teslamate
;;
6)
update_scripts update_scripts
;; ;;
q | Q) q | Q)