add teslamate for x86_64
This commit is contained in:
parent
8a6ffd5e68
commit
5a17346344
21
zero3/op.sh
21
zero3/op.sh
|
@ -10,6 +10,15 @@ light_magenta() { echo -e "\033[95m\033[01m[NOTICE] $1\033[0m"; }
|
|||
highlight() { echo -e "\033[32m\033[01m$1\033[0m"; }
|
||||
cyan() { echo -e "\033[38;2;0;255;255m$1\033[0m"; }
|
||||
|
||||
is_x86_64_router() {
|
||||
DISTRIB_ARCH=$(cat /etc/openwrt_release | grep "DISTRIB_ARCH" | cut -d "'" -f 2)
|
||||
if [ "$DISTRIB_ARCH" = "x86_64" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
get_hostname() {
|
||||
hostname=$(uci get system.@system[0].hostname)
|
||||
echo "${hostname}.lan"
|
||||
|
@ -116,8 +125,13 @@ get_docker_compose_url() {
|
|||
return 1
|
||||
fi
|
||||
# 拼接docker-compose下载链接
|
||||
if is_x86_64_router; then
|
||||
platform="docker-compose-linux-x86_64"
|
||||
else
|
||||
platform="docker-compose-linux-aarch64"
|
||||
fi
|
||||
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"
|
||||
docker_compose_download_url="https://github.com/${repo_path}/releases/download/${tag}/${platform}"
|
||||
echo "$docker_compose_download_url"
|
||||
}
|
||||
|
||||
|
@ -133,7 +147,8 @@ do_install_docker_compose() {
|
|||
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"
|
||||
cyan "最新版docker-compose 地址:$docker_compose_url"
|
||||
cyan "即将下载最新版docker-compose standalone"
|
||||
wget -O /usr/bin/docker-compose $docker_compose_url
|
||||
if [ $? -eq 0 ]; then
|
||||
green "docker-compose下载并安装成功,你可以使用啦"
|
||||
|
@ -156,7 +171,7 @@ install_teslamate() {
|
|||
cd /tmp/teslamate
|
||||
docker-compose up -d
|
||||
else
|
||||
echo "Docker Compose is not installed. "
|
||||
red "Docker Compose is not installed. "
|
||||
do_install_docker_compose
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue