feat(scripts): seed Flashpoint Ultimate before extracting

--seed-ratio and --seed-hours keep aria2c seeding after the download,
stopping at whichever limit comes first, before extraction starts; this
needs no extra disk. The README asks people to seed and explains
long-term seeding with --keep-archives. Re-running with --torrent once
extraction has begun no longer downloads the deleted archives again.
This commit is contained in:
2026-10-13 21:49:27 -07:00
parent 8d0504f6f2
commit 33b99cafd5
2 changed files with 58 additions and 8 deletions
+16 -3
View File
@@ -95,11 +95,24 @@ Re-run it to resume after an interruption.
sudo apt install aria2 7zip tmux
tmux new -s flashpoint
scripts/setup-flashpoint.sh --torrent FlashpointUltimate14.torrent \
--infinity fp14.0.3_lin_20251201.7z /srv/flashpoint
--infinity fp14.0.3_lin_20251201.7z --seed-ratio 1.0 /srv/flashpoint
```
`--keep-archives` keeps the archives so you can keep seeding, which needs room
for both copies.
#### Please seed
Flashpoint Ultimate is shared over BitTorrent, and stays available only as long
as people seed it. If you can, give back at least what you downloaded:
- **Seed before extracting.** `--seed-ratio 1.0` keeps seeding after the
download until you've uploaded as much as you downloaded. `--seed-hours 24`
seeds for a day. With both, seeding stops at whichever comes first. This needs
no extra disk space, but extraction waits until seeding stops.
- **Seed for the long term.** `--keep-archives` keeps the archives after
extracting (about 4.6 TB in total), so a torrent client such as qBittorrent or
Transmission can go on seeding the downloads directory.
- **Let peers reach you.** The download listens on ports 6881-6999, TCP and UDP.
Forwarding them on your router and allowing them through your firewall lets
more people download from you.
### 2. Configure
+42 -5
View File
@@ -12,10 +12,17 @@
# (default: DEST/../downloads)
# --infinity FILE add the software streaming needs (FPSoftware/, Server/)
# from Flashpoint Infinity for Linux (.7z, same page)
# --keep-archives keep each archive after extracting it, e.g. to seed;
# needs room for both copies
# --seed-ratio N after downloading, keep seeding until N times the
# download has been uploaded (e.g. 1.0), then extract
# --seed-hours N after downloading, keep seeding for up to N hours, then
# extract; with --seed-ratio, whichever comes first
# --keep-archives keep each archive after extracting it, e.g. to go on
# seeding with a torrent client; needs room for both copies
# --yes don't ask for confirmation
#
# Seeding helps keep Flashpoint's torrent alive for everyone. Seeding before
# extracting needs no extra disk space.
#
# Without --torrent, it uses the Ultimate archives already in the downloads
# directory. Requires 7-Zip (7z, 7zz or 7za), and aria2c with --torrent.
#
@@ -33,7 +40,7 @@ MARGIN=$((20 * 1024 ** 3))
LARGEST_ARCHIVE=$((100 * 1024 ** 3))
usage() {
sed -n '6,27p' "$0" | sed 's/^# \{0,1\}//'
sed -n '6,34p' "$0" | sed 's/^# \{0,1\}//'
exit 1
}
@@ -43,11 +50,15 @@ TORRENT=
INFINITY=
KEEP=false
YES=false
SEED_RATIO=
SEED_HOURS=
while (($#)); do
case $1 in
--torrent) TORRENT=${2:?}; shift ;;
--downloads) DOWNLOADS=${2:?}; shift ;;
--infinity) INFINITY=${2:?}; shift ;;
--seed-ratio) SEED_RATIO=${2:?}; shift ;;
--seed-hours) SEED_HOURS=${2:?}; shift ;;
--keep-archives) KEEP=true ;;
--yes) YES=true ;;
-h | --help) usage ;;
@@ -57,6 +68,14 @@ while (($#)); do
shift
done
[[ -n $DEST ]] || usage
# aria2c reads a ratio of 0 as "seed forever", which would never get to extracting
[[ -z $SEED_RATIO || ($SEED_RATIO =~ ^[0-9]+(\.[0-9]+)?$ && $SEED_RATIO =~ [1-9]) ]] ||
{ echo "--seed-ratio takes a number above 0, e.g. 1.0" >&2; exit 1; }
[[ -z $SEED_HOURS || $SEED_HOURS =~ ^[0-9]+$ ]] || { echo "--seed-hours takes a whole number of hours" >&2; exit 1; }
if [[ -z $TORRENT && -n $SEED_RATIO$SEED_HOURS ]]; then
echo "Seeding needs --torrent" >&2
exit 1
fi
[[ -z $TORRENT || -f $TORRENT ]] || { echo "No torrent file at $TORRENT" >&2; exit 1; }
[[ -z $INFINITY || -f $INFINITY ]] || { echo "No Infinity archive at $INFINITY" >&2; exit 1; }
mkdir -p "$DEST"
@@ -74,6 +93,12 @@ same_disk() { [[ $(stat -c %d "$1") == $(stat -c %d "$2") ]]; }
DONE=$DOWNLOADS/.extracted
touch "$DONE"
# Once extraction has started, extracted archives are deleted; downloading
# again would fetch them all over
if [[ -n $TORRENT && -s $DONE ]]; then
echo "Extraction already started; continuing it without downloading."
TORRENT=
fi
# What's left to extract, measured from the archives on disk
remaining=0
@@ -149,8 +174,17 @@ extract() {
# 1. Download the packed archives
if [[ -n $TORRENT ]]; then
echo "==> Downloading into $DOWNLOADS"
aria2c --dir="$DOWNLOADS" --seed-time=0 --check-integrity=true \
# aria2c stops seeding at whichever limit it reaches first; with neither, it
# stops as soon as the download completes
seed=(--seed-time=0)
if [[ -n $SEED_RATIO || -n $SEED_HOURS ]]; then
seed=(--seed-ratio="${SEED_RATIO:-0.0}")
[[ -z $SEED_HOURS ]] || seed+=(--seed-time="$((SEED_HOURS * 60))")
echo "==> Downloading into $DOWNLOADS, then seeding (${SEED_RATIO:+ratio $SEED_RATIO}${SEED_RATIO:+${SEED_HOURS:+, }}${SEED_HOURS:+up to $SEED_HOURS hours})"
else
echo "==> Downloading into $DOWNLOADS"
fi
aria2c --dir="$DOWNLOADS" "${seed[@]}" --check-integrity=true \
--file-allocation=falloc --bt-max-peers=100 "$TORRENT"
fi
# fp-index.json stays behind once the archives are extracted and deleted
@@ -200,3 +234,6 @@ fi
[[ -f $DEST/Data/flashpoint.sqlite ]] ||
echo "Warning: no Data/flashpoint.sqlite. Re-run with --infinity to take Infinity's." >&2
echo "Done. Set FLASHPOINT_HOST_PATH=$DEST in .env."
if [[ -n $TORRENT && -z $SEED_RATIO$SEED_HOURS ]]; then
echo "Consider seeding next time (--seed-ratio 1.0, or --seed-hours 24) to help keep Flashpoint's torrent alive."
fi