Last active 1746804508

Seed all torrent files under current folder.

Revision a1f6f5e7980fd9c4786f6b40037e79f80c14c7c3

autocheck.sh Raw
1
2#!/bin/bash
3
4# Find all .iso files and their corresponding .sha256 files, including subdirectories
5find . -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
28done
autodown.sh Raw
1#!/usr/bin/env bash
2set -euo pipefail
3
4BASE_URL="https://anduinos-nightly-builds.aiursoft.cn/1.2"
5
6# 定义所有语言的后缀
7langs=(
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 文件名并下载
13for lang in "${langs[@]}"; do
14 file="AnduinOS-1.2.4-${lang}.torrent"
15 echo "Downloading $file ..."
16 wget -c "${BASE_URL}/${file}"
17
18 sha256="AnduinOS-1.2.4-${lang}.sha256"
19 echo "Downloading $sha256 ..."
20 wget -c "${BASE_URL}/${sha256}"
21done
autoseed.sh Raw
1#!/usr/bin/env bash
2set -euo pipefail
3
4# -----------------------------------------------------------------------------
5# 依赖检查:aria2c、tmux 和 ufw(如果存在)
6# -----------------------------------------------------------------------------
7if ! command -v aria2c &> /dev/null; then
8 echo "[INFO] Installing aria2..."
9 sudo apt-get update && sudo apt-get install -y aria2
10fi
11
12if ! command -v tmux &> /dev/null; then
13 echo "[INFO] Installing tmux..."
14 sudo apt-get update && sudo apt-get install -y tmux
15fi#!/usr/bin/env bash
16set -euo pipefail
17
18BASE_URL="https://anduinos-nightly-builds.aiursoft.cn/1.2"
19
20# 定义所有语言的后缀
21langs=(
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 文件名并下载
27for lang in "${langs[@]}"; do
28 file="AnduinOS-1.2.4-${lang}.torrent"
29 echo "Downloading $file ..."
30 wget -c "${BASE_URL}/${file}"
31done
32
33
34# (可选)如果你没有 ufw,也可以忽略此依赖检查
35if command -v ufw &> /dev/null; then
36 echo "[INFO] ufw detected."
37else
38 echo "[INFO] ufw not installed or not in PATH; skipping firewall rules."
39fi
40
41# -----------------------------------------------------------------------------
42# 查找 .torrent 文件
43# -----------------------------------------------------------------------------
44shopt -s nullglob
45torrent_files=( *.torrent )
46
47if [[ ${#torrent_files[@]} -eq 0 ]]; then
48 echo "[INFO] 当前目录下没有找到 .torrent 文件,退出。"
49 exit 0
50fi
51
52# -----------------------------------------------------------------------------
53# 针对每个 .torrent,创建 tmux 会话并启动做种(随机高端口 + ufw 放行)
54# -----------------------------------------------------------------------------
55for torrent in "${torrent_files[@]}"; do
56 # 会话名:seed-<basename>
57 base="$(basename "$torrent" .torrent)"
58 session_name="seed-$base"
59
60 # 如果会话已存在则跳过
61 if tmux has-session -t "$session_name" 2> /dev/null; then
62 echo "[INFO] 会话 $session_name 已存在,跳过。"
63 continue
64 fi
65
66 # 随机选一个高端口(49152–65535)
67 if command -v shuf &> /dev/null; then
68 port=$(shuf -i 49152-65535 -n 1)
69 else
70 port=$(( RANDOM % 16384 + 49152 ))
71 fi
72
73 # 如果 ufw 已启用,则添加放行规则;若已放行则输出提示
74 if command -v ufw &> /dev/null && sudo ufw status | grep -q "Status: active"; then
75 echo "[INFO] 放行端口 $port/tcp 到 ufw..."
76 sudo ufw allow "${port}/tcp" || echo "[INFO] 端口 $port 已经放行"
77 fi
78
79 echo "[INFO] 启动会话 $session_name,做种文件:$torrent (端口:$port"
80 tmux new-session -d -s "$session_name" -- \
81 aria2c \
82 --enable-dht=true \
83 --enable-dht6=true \
84 --enable-peer-exchange=true \
85 --bt-seed-unverified=true \
86 --bt-save-metadata=true \
87 --dir="$(pwd)" \
88 --seed-ratio=0.0 \
89 --listen-port="$port" \
90 "$torrent" || echo "$session_name 启动失败。"
91done
92
93echo "[INFO] 所有做种会话已启动。"
94