forked from wukongdaily/img-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathesir.sh
More file actions
41 lines (36 loc) · 1.28 KB
/
esir.sh
File metadata and controls
41 lines (36 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
REPO="wkccd/esirOpenWrt"
TAG=$(curl -sL "https://api.github.com/repos/$REPO/releases/latest" | jq -r '.tag_name // empty')
[ -z "$TAG" ] && TAG=$(curl -sL "https://api.github.com/repos/$REPO/tags" | jq -r '.[0].name')
echo "最新TAG: $TAG"
# 获取该 Tag 下所有以 .img.gz 结尾的文件
DOWNLOAD_URLS=$(curl -sL "https://api.github.com/repos/$REPO/releases/tags/$TAG" \
| jq -r '.assets[] | select(.name | endswith("img.gz")) | .browser_download_url')
# 保存位置
mkdir -p imm
OUTPUT_PATH="imm/esiropenwrt.img.gz"
if [ -z "$DOWNLOAD_URLS" ]; then
echo "Error: No .img.gz files found under tag $TAG"
exit 1
fi
FIRST_DOWNLOAD_URL=$(echo "$DOWNLOAD_URLS" | head -n1)
echo "下载地址: $FIRST_DOWNLOAD_URL"
curl -L -o "$OUTPUT_PATH" "$FIRST_DOWNLOAD_URL"
if [[ $? -eq 0 ]]; then
echo "下载esiropenwrt成功!"
file imm/esiropenwrt.img.gz
echo "正在解压为:esiropenwrt.img"
gzip -d imm/esiropenwrt.img.gz
ls -lh imm/
echo "准备合成 eSirOpenWrt 安装器"
else
echo "下载失败!"
exit 1
fi
mkdir -p output
docker run --privileged --rm \
-v $(pwd)/output:/output \
-v $(pwd)/supportFiles:/supportFiles:ro \
-v $(pwd)/imm/esiropenwrt.img:/mnt/esiropenwrt.img \
debian:buster \
/supportFiles/esirplayground/build.sh