Files
docker-transmission/root/etc/cont-init.d/20-config
2020-05-11 13:04:44 -04:00

24 lines
645 B
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/with-contenv bash
# make folders
mkdir -p \
/downloads/{complete,incomplete} /watch
# copy config
[[ ! -f /config/settings.json ]] && cp \
/defaults/settings.json /config/settings.json
if [ ! -z "$USER" ] && [ ! -z "$PASS" ]; then
sed -i '/rpc-authentication-required/c\ "rpc-authentication-required": true,' /config/settings.json
sed -i "/rpc-username/c\ \"rpc-username\": \"$USER\"," /config/settings.json
sed -i "/rpc-password/c\ \"rpc-password\": \"$PASS\"," /config/settings.json
fi
# permissions
chown abc:abc \
/config/settings.json \
/downloads \
/downloads/complete \
/downloads/incomplete \
/watch