anduin revised this gist . Go to revision
1 file changed, 3 insertions, 3 deletions
autodown.sh
@@ -1,7 +1,7 @@ | |||
1 | 1 | #!/usr/bin/env bash | |
2 | 2 | set -euo pipefail | |
3 | 3 | ||
4 | - | BASE_URL="https://anduinos-nightly-builds.aiursoft.cn/1.2" | |
4 | + | BASE_URL="https://anduinos-nightly-builds.aiursoft.cn/1.3" | |
5 | 5 | ||
6 | 6 | # 定义所有语言的后缀 | |
7 | 7 | langs=( | |
@@ -11,11 +11,11 @@ langs=( | |||
11 | 11 | ||
12 | 12 | # 遍历每种语言构造 .torrent 文件名并下载 | |
13 | 13 | for lang in "${langs[@]}"; do | |
14 | - | file="AnduinOS-1.2.4-${lang}.torrent" | |
14 | + | file="AnduinOS-1.3.1-${lang}.torrent" | |
15 | 15 | echo "Downloading $file ..." | |
16 | 16 | wget -c "${BASE_URL}/${file}" | |
17 | 17 | ||
18 | - | sha256="AnduinOS-1.2.4-${lang}.sha256" | |
18 | + | sha256="AnduinOS-1.3.1-${lang}.sha256" | |
19 | 19 | echo "Downloading $sha256 ..." | |
20 | 20 | wget -c "${BASE_URL}/${sha256}" | |
21 | 21 | done |
anduin revised this gist . Go to revision
1 file changed, 17 deletions
autoseed.sh
@@ -14,23 +14,6 @@ if ! command -v tmux &> /dev/null; then | |||
14 | 14 | sudo apt-get update && sudo apt-get install -y tmux | |
15 | 15 | fi | |
16 | 16 | ||
17 | - | ||
18 | - | BASE_URL="https://anduinos-nightly-builds.aiursoft.cn/1.2" | |
19 | - | ||
20 | - | # 定义所有语言的后缀 | |
21 | - | langs=( | |
22 | - | ar_SA de_DE en_US en_GB es_ES fr_FR it_IT ja_JP ko_KR nl_NL pl_PL | |
23 | - | pt_BR pt_PT ru_RU sv_SE th_TH tr_TR vi_VN zh_CN zh_HK zh_TW | |
24 | - | ) | |
25 | - | ||
26 | - | # 遍历每种语言构造 .torrent 文件名并下载 | |
27 | - | for lang in "${langs[@]}"; do | |
28 | - | file="AnduinOS-1.2.4-${lang}.torrent" | |
29 | - | echo "Downloading $file ..." | |
30 | - | wget -c "${BASE_URL}/${file}" | |
31 | - | done | |
32 | - | ||
33 | - | ||
34 | 17 | # (可选)如果你没有 ufw,也可以忽略此依赖检查 | |
35 | 18 | if command -v ufw &> /dev/null; then | |
36 | 19 | echo "[INFO] ufw detected." |
anduin revised this gist . Go to revision
1 file changed, 3 insertions, 3 deletions
autoseed.sh
@@ -12,14 +12,14 @@ fi | |||
12 | 12 | if ! command -v tmux &> /dev/null; then | |
13 | 13 | echo "[INFO] Installing tmux..." | |
14 | 14 | sudo apt-get update && sudo apt-get install -y tmux | |
15 | - | fi#!/usr/bin/env bash | |
16 | - | set -euo pipefail | |
15 | + | fi | |
16 | + | ||
17 | 17 | ||
18 | 18 | BASE_URL="https://anduinos-nightly-builds.aiursoft.cn/1.2" | |
19 | 19 | ||
20 | 20 | # 定义所有语言的后缀 | |
21 | 21 | langs=( | |
22 | - | ar_SA de_DE en_US es_ES fr_FR it_IT ja_JP ko_KR nl_NL pl_PL | |
22 | + | ar_SA de_DE en_US en_GB es_ES fr_FR it_IT ja_JP ko_KR nl_NL pl_PL | |
23 | 23 | pt_BR pt_PT ru_RU sv_SE th_TH tr_TR vi_VN zh_CN zh_HK zh_TW | |
24 | 24 | ) | |
25 | 25 |
anduin revised this gist . Go to revision
1 file changed, 1 insertion, 1 deletion
autodown.sh
@@ -5,7 +5,7 @@ BASE_URL="https://anduinos-nightly-builds.aiursoft.cn/1.2" | |||
5 | 5 | ||
6 | 6 | # 定义所有语言的后缀 | |
7 | 7 | langs=( | |
8 | - | ar_SA de_DE en_US es_ES fr_FR it_IT ja_JP ko_KR nl_NL pl_PL | |
8 | + | ar_SA de_DE en_US en_GB es_ES fr_FR it_IT ja_JP ko_KR nl_NL pl_PL | |
9 | 9 | pt_BR pt_PT ru_RU sv_SE th_TH tr_TR vi_VN zh_CN zh_HK zh_TW | |
10 | 10 | ) | |
11 | 11 |
anduin revised this gist . Go to revision
2 files changed, 23 insertions, 2 deletions
autodown.sh
@@ -14,4 +14,8 @@ for lang in "${langs[@]}"; do | |||
14 | 14 | file="AnduinOS-1.2.4-${lang}.torrent" | |
15 | 15 | echo "Downloading $file ..." | |
16 | 16 | wget -c "${BASE_URL}/${file}" | |
17 | - | done | |
17 | + | ||
18 | + | sha256="AnduinOS-1.2.4-${lang}.sha256" | |
19 | + | echo "Downloading $sha256 ..." | |
20 | + | wget -c "${BASE_URL}/${sha256}" | |
21 | + | done |
autoseed.sh
@@ -12,7 +12,24 @@ fi | |||
12 | 12 | if ! command -v tmux &> /dev/null; then | |
13 | 13 | echo "[INFO] Installing tmux..." | |
14 | 14 | sudo apt-get update && sudo apt-get install -y tmux | |
15 | - | fi | |
15 | + | fi#!/usr/bin/env bash | |
16 | + | set -euo pipefail | |
17 | + | ||
18 | + | BASE_URL="https://anduinos-nightly-builds.aiursoft.cn/1.2" | |
19 | + | ||
20 | + | # 定义所有语言的后缀 | |
21 | + | langs=( | |
22 | + | ar_SA de_DE en_US es_ES fr_FR it_IT ja_JP ko_KR nl_NL pl_PL | |
23 | + | pt_BR pt_PT ru_RU sv_SE th_TH tr_TR vi_VN zh_CN zh_HK zh_TW | |
24 | + | ) | |
25 | + | ||
26 | + | # 遍历每种语言构造 .torrent 文件名并下载 | |
27 | + | for lang in "${langs[@]}"; do | |
28 | + | file="AnduinOS-1.2.4-${lang}.torrent" | |
29 | + | echo "Downloading $file ..." | |
30 | + | wget -c "${BASE_URL}/${file}" | |
31 | + | done | |
32 | + | ||
16 | 33 | ||
17 | 34 | # (可选)如果你没有 ufw,也可以忽略此依赖检查 | |
18 | 35 | if command -v ufw &> /dev/null; then |
anduin revised this gist . Go to revision
1 file changed, 17 insertions
autodown.sh(file created)
@@ -0,0 +1,17 @@ | |||
1 | + | #!/usr/bin/env bash | |
2 | + | set -euo pipefail | |
3 | + | ||
4 | + | BASE_URL="https://anduinos-nightly-builds.aiursoft.cn/1.2" | |
5 | + | ||
6 | + | # 定义所有语言的后缀 | |
7 | + | langs=( | |
8 | + | ar_SA de_DE en_US es_ES fr_FR it_IT ja_JP ko_KR nl_NL pl_PL | |
9 | + | pt_BR pt_PT ru_RU sv_SE th_TH tr_TR vi_VN zh_CN zh_HK zh_TW | |
10 | + | ) | |
11 | + | ||
12 | + | # 遍历每种语言构造 .torrent 文件名并下载 | |
13 | + | for lang in "${langs[@]}"; do | |
14 | + | file="AnduinOS-1.2.4-${lang}.torrent" | |
15 | + | echo "Downloading $file ..." | |
16 | + | wget -c "${BASE_URL}/${file}" | |
17 | + | done |
anduin revised this gist . Go to revision
2 files changed, 29 insertions
autocheck.sh(file created)
@@ -0,0 +1,28 @@ | |||
1 | + | ||
2 | + | #!/bin/bash | |
3 | + | ||
4 | + | # Find all .iso files and their corresponding .sha256 files, including subdirectories | |
5 | + | find . -type f -name "*.iso" | while read -r iso_file; do | |
6 | + | # Get the corresponding .sha256 file in the same directory | |
7 | + | sha256_file="${iso_file%.iso}.sha256" | |
8 | + | ||
9 | + | # Check if the .sha256 file exists | |
10 | + | if [[ -f "$sha256_file" ]]; then | |
11 | + | # Read the expected checksum from the .sha256 file and strip the 'SHA256: ' prefix | |
12 | + | expected_checksum=$(cat "$sha256_file" | sed 's/^SHA256: //') | |
13 | + | ||
14 | + | # Calculate the checksum of the .iso file | |
15 | + | actual_checksum=$(sha256sum "$iso_file" | awk '{ print $1 }') | |
16 | + | ||
17 | + | # Compare the checksums | |
18 | + | if [[ "$expected_checksum" == "$actual_checksum" ]]; then | |
19 | + | echo "Checksum for $iso_file matches." | |
20 | + | else | |
21 | + | echo "Checksum for $iso_file does not match!" | |
22 | + | echo "Expected: $expected_checksum" | |
23 | + | echo "Actual: $actual_checksum" | |
24 | + | fi | |
25 | + | else | |
26 | + | echo "SHA256 file for $iso_file not found!" | |
27 | + | fi | |
28 | + | done |
autoseed.sh
@@ -68,6 +68,7 @@ for torrent in "${torrent_files[@]}"; do | |||
68 | 68 | --bt-seed-unverified=true \ | |
69 | 69 | --bt-save-metadata=true \ | |
70 | 70 | --dir="$(pwd)" \ | |
71 | + | --seed-ratio=0.0 \ | |
71 | 72 | --listen-port="$port" \ | |
72 | 73 | "$torrent" || echo "$session_name 启动失败。" | |
73 | 74 | done |
anduin revised this gist . Go to revision
1 file changed, 1 insertion, 1 deletion
autoseed.sh
@@ -69,7 +69,7 @@ for torrent in "${torrent_files[@]}"; do | |||
69 | 69 | --bt-save-metadata=true \ | |
70 | 70 | --dir="$(pwd)" \ | |
71 | 71 | --listen-port="$port" \ | |
72 | - | "$torrent" | |
72 | + | "$torrent" || echo "$session_name 启动失败。" | |
73 | 73 | done | |
74 | 74 | ||
75 | 75 | echo "[INFO] 所有做种会话已启动。" |
anduin revised this gist . Go to revision
1 file changed, 75 insertions
autoseed.sh(file created)
@@ -0,0 +1,75 @@ | |||
1 | + | #!/usr/bin/env bash | |
2 | + | set -euo pipefail | |
3 | + | ||
4 | + | # ----------------------------------------------------------------------------- | |
5 | + | # 依赖检查:aria2c、tmux 和 ufw(如果存在) | |
6 | + | # ----------------------------------------------------------------------------- | |
7 | + | if ! command -v aria2c &> /dev/null; then | |
8 | + | echo "[INFO] Installing aria2..." | |
9 | + | sudo apt-get update && sudo apt-get install -y aria2 | |
10 | + | fi | |
11 | + | ||
12 | + | if ! command -v tmux &> /dev/null; then | |
13 | + | echo "[INFO] Installing tmux..." | |
14 | + | sudo apt-get update && sudo apt-get install -y tmux | |
15 | + | fi | |
16 | + | ||
17 | + | # (可选)如果你没有 ufw,也可以忽略此依赖检查 | |
18 | + | if command -v ufw &> /dev/null; then | |
19 | + | echo "[INFO] ufw detected." | |
20 | + | else | |
21 | + | echo "[INFO] ufw not installed or not in PATH; skipping firewall rules." | |
22 | + | fi | |
23 | + | ||
24 | + | # ----------------------------------------------------------------------------- | |
25 | + | # 查找 .torrent 文件 | |
26 | + | # ----------------------------------------------------------------------------- | |
27 | + | shopt -s nullglob | |
28 | + | torrent_files=( *.torrent ) | |
29 | + | ||
30 | + | if [[ ${#torrent_files[@]} -eq 0 ]]; then | |
31 | + | echo "[INFO] 当前目录下没有找到 .torrent 文件,退出。" | |
32 | + | exit 0 | |
33 | + | fi | |
34 | + | ||
35 | + | # ----------------------------------------------------------------------------- | |
36 | + | # 针对每个 .torrent,创建 tmux 会话并启动做种(随机高端口 + ufw 放行) | |
37 | + | # ----------------------------------------------------------------------------- | |
38 | + | for torrent in "${torrent_files[@]}"; do | |
39 | + | # 会话名:seed-<basename> | |
40 | + | base="$(basename "$torrent" .torrent)" | |
41 | + | session_name="seed-$base" | |
42 | + | ||
43 | + | # 如果会话已存在则跳过 | |
44 | + | if tmux has-session -t "$session_name" 2> /dev/null; then | |
45 | + | echo "[INFO] 会话 $session_name 已存在,跳过。" | |
46 | + | continue | |
47 | + | fi | |
48 | + | ||
49 | + | # 随机选一个高端口(49152–65535) | |
50 | + | if command -v shuf &> /dev/null; then | |
51 | + | port=$(shuf -i 49152-65535 -n 1) | |
52 | + | else | |
53 | + | port=$(( RANDOM % 16384 + 49152 )) | |
54 | + | fi | |
55 | + | ||
56 | + | # 如果 ufw 已启用,则添加放行规则;若已放行则输出提示 | |
57 | + | if command -v ufw &> /dev/null && sudo ufw status | grep -q "Status: active"; then | |
58 | + | echo "[INFO] 放行端口 $port/tcp 到 ufw..." | |
59 | + | sudo ufw allow "${port}/tcp" || echo "[INFO] 端口 $port 已经放行" | |
60 | + | fi | |
61 | + | ||
62 | + | echo "[INFO] 启动会话 $session_name,做种文件:$torrent (端口:$port)" | |
63 | + | tmux new-session -d -s "$session_name" -- \ | |
64 | + | aria2c \ | |
65 | + | --enable-dht=true \ | |
66 | + | --enable-dht6=true \ | |
67 | + | --enable-peer-exchange=true \ | |
68 | + | --bt-seed-unverified=true \ | |
69 | + | --bt-save-metadata=true \ | |
70 | + | --dir="$(pwd)" \ | |
71 | + | --listen-port="$port" \ | |
72 | + | "$torrent" | |
73 | + | done | |
74 | + | ||
75 | + | echo "[INFO] 所有做种会话已启动。" |