diff options
author | Luke Shumaker <lukeshu@parabola.nu> | 2018-09-25 01:49:27 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@parabola.nu> | 2018-09-25 01:49:27 -0400 |
commit | fe27caea29421b01e502a6b99cb59707bfe467be (patch) | |
tree | d58b44ce00318eb4f6134c990449c715375b91e5 /make_individual_torrent | |
parent | 18f5224b2b08cf07ccb3d000d5a083e8bcb500cb (diff) |
Clean up make_individual_torrent, add config drop the second argument
- Add 'torrent.conf' instead of hard-coding the settings
- The second argument is $FTP_BASE, just load that from 'config', rather
than asking for it.
Diffstat (limited to 'make_individual_torrent')
-rwxr-xr-x | make_individual_torrent | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/make_individual_torrent b/make_individual_torrent index d44bb24..2cfb6ce 100755 --- a/make_individual_torrent +++ b/make_individual_torrent @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (C) 2014, 2017 Joseph Graham <joseph@xylon.me.uk> +# Copyright (C) 2018 Luke Shumaker <lukeshu@parabola.nu> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,34 +20,19 @@ # $1 - path of package # $2 - public location -# Comma seperated list of trackers, no spaces -# taskenizer.crabdance.com is run by Xylon. the others come from https://github.com/ngosang/trackerslist -trackers='http://taskenizer.crabdance.com:6969/announce,http://tracker.opentrackr.org:1337/announce,udp://tracker.pirateparty.gr:6969/announce' +source "$(dirname "$(readlink -e "$0")")/config" +source "$(dirname "$(readlink -e "$0")")/torrent.conf" +source "$(librelib messages)" -# This mirror is put as a webseed. Which mirror we use for a webseed -# doesn't really matter since it's re-written on the client machine by -# pacman2pacman so it won't normally be used anyway. -seed_url='http://repo.parabolagnulinux.org/' - -if [[ -z "${1}" ]] -then - echo "Error. First arg must be the path of the package." - echo 1 -fi - -if [[ -z "${2}" ]] -then - echo "Error. Second arg must be the public location." - echo 1 +if (( $# != 1 )) || [[ $1 != "$FTP_BASE"/* ]]; then + msg "usage: %s <pkgfile> <public_location>" + exit $EXIT_INVALIDARGUMENT fi -pkg="${1}" -public_location="${2}" - -pkg_name="${pkg##*/}" - -# URL of the actual package for the webseed -webseed="${seed_url}${pkg#${public_location}}" +pkgfile=$1 -mktorrent -a "${trackers}" "${pkg}" -w "${webseed}" >/dev/null || - echo "Error making torrent for \"${pkg}\"" +IFS=, +mktorrent \ + -a "${TRACKERS[*]}" \ + -w "${WEBSEED_MIRROR}${pkgfile#"${FTP_BASE}/"}" \ + -- "${pkgfile}" >/dev/null |