Files
homelabstack/stacks/media/chaptarr/start.sh
T

26 lines
828 B
Bash
Executable File

#!/bin/sh
# Chaptarr entrypoint wrapper (compose: entrypoint: /scripts/start.sh).
#
# /storage1 is mounted ONCE; /downloads, /audiobooks and /ebooks are symlinks into it.
# Separate bind mounts make link() fail with EXDEV, and chaptarr silently falls back to a
# full copy, so every seeding audiobook used to exist twice on disk. One mount → real hardlinks.
# The container paths stay the same, so nothing in chaptarr's DB had to change.
set -e
link() { # $1 = container path, $2 = target under /storage1
if [ -L "$1" ]; then
ln -sfn "$2" "$1"
elif [ -d "$1" ]; then
rmdir "$1" # fails loudly if something unexpected is in there
ln -s "$2" "$1"
else
ln -s "$2" "$1"
fi
}
link /downloads /storage1/complete
link /audiobooks /storage1/Media/Audiobooks
link /ebooks /storage1/Media/Ebooks
exec /entrypoint.sh "$@"