aports/config/transmission/APKBUILD

35 lines
1.2 KiB
Plaintext

# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
. ../APKBUILD-config.template
pkgver=2022.09.27.01
pkgrel=0
source="
secret
settings.json
"
build() {
. secret
: "${TRANSMISSION_USERNAME:?'Transmission username is missing'}"
: "${TRANSMISSION_PASSWORD:?'Transmission password is missing'}"
cp "settings.json" "settings.json.private"
TRANSMISSION_PASS_SALT="$(cat /dev/urandom | tr -dc '[:alnum:]./' | head -c 8)"
TRANSMISSION_PASS_HASH="$(printf '%s%s' "$TRANSMISSION_PASSWORD" "$TRANSMISSION_PASS_SALT" | sha1sum)"
TRANSMISSION_PASS_SALTED="{${TRANSMISSION_PASS_HASH%% *}$TRANSMISSION_PASS_SALT"
rx_replace "TRANSMISSION_USERNAME" "$TRANSMISSION_USERNAME" settings.json.private
rx_replace "TRANSMISSION_PASSWORD" "$TRANSMISSION_PASS_SALTED" settings.json.private
}
package() {
rx_install "settings.json.private" "settings.json"
install -dm700 "$(rx_cpkgdir)"/"$_rx_installdir"/resume "$(rx_cpkgdir)"/seedbox
}
sha512sums="
7435cdea2f9a63d09164c6c7cf6105e24a27316150bbebb7c2abda0a72c9ffcbd36632be1f9d77bccdc616fa8b84a9bfeaa4b5b32349d11a3d4f9c12ee884963 secret
3581c24c08a1c5f2653759ca79014096423425e0ffbe7e7ba6c854ef102a33f5f14b8781dff4820814303321ecafe8c8c2667c80eb16d58621ddf4dcf51531a5 settings.json
"