summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2018-09-25 02:10:12 -0400
committerLuke Shumaker <lukeshu@parabola.nu>2018-09-25 02:10:12 -0400
commit409980fcca34075f20d8d7da049f9859702a1daf (patch)
tree2537eeba9520eb847b5ea80b3a13e256554850a0
parent114225c19aa1dfe427527acf71b7479cdff1e186 (diff)
Have make_individual_torrent be a function in make_repo_torrents
Rather than it being a separate executable.
-rw-r--r--README.md2
-rwxr-xr-xcron-jobs/make_repo_torrents12
-rwxr-xr-xmake_individual_torrent38
3 files changed, 10 insertions, 42 deletions
diff --git a/README.md b/README.md
index 6179887..37f3c0d 100644
--- a/README.md
+++ b/README.md
@@ -39,7 +39,6 @@ The executables that you (might) care about are:
├── db-repo-add
├── db-repo-remove
├── db-update
- ├── make_individual_torrent [Parabola only]
└── testing2x [Arch Linux only]
Ok, now let's talk about what those are.
@@ -102,7 +101,6 @@ Things that haven't been mentioned yet:
- `cron-jobs/make_repo_torrents`
- `cron-jobs/sourceballs`
- `db-init`
- - `make_individual_torrent`
## Testing
diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents
index dd14b22..68cc942 100755
--- a/cron-jobs/make_repo_torrents
+++ b/cron-jobs/make_repo_torrents
@@ -22,11 +22,19 @@
# so it's OK to just stuff all the torrents into a single directory.
set -eE
-script_directory="$(dirname "$(readlink -e "$0")")/.."
. "$(dirname "$(readlink -e "$0")")/../config"
. "$(dirname "$(readlink -e "$0")")/../torrent.conf"
. "$(dirname "$(readlink -e "$0")")/../db-functions"
+make_individual_torrent() {
+ local pkgfile=$1
+ local IFS=,
+ mktorrent \
+ -a "${TRACKERS[*]}" \
+ -w "${WEBSEED_MIRROR}${pkgfile#"${FTP_BASE}/"}" \
+ -- "${pkgfile}" >/dev/null
+}
+
mkdir -p -- "${FTP_BASE}/${TORRENTPOOL}"
cd "${FTP_BASE}/${TORRENTPOOL}"
@@ -39,7 +47,7 @@ for pkgpath in "$FTP_BASE"/*/os/*/*${PKGEXTS}; do
# If a .torrent file does not already exist for this package, we call
# `make_individual_torrent' to make it.
if ! [[ -f ${pkgfile}.torrent ]]; then
- "$script_directory/make_individual_torrent" "$pkgpath"
+ make_individual_torrent "$pkgpath"
fi
done
diff --git a/make_individual_torrent b/make_individual_torrent
deleted file mode 100755
index 2cfb6ce..0000000
--- a/make_individual_torrent
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/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
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# This script is called by `make_repo_torrents' to make a torrent. It
-# depends on `mktorrent'. It takes the following args:
-# $1 - path of package
-# $2 - public location
-
-source "$(dirname "$(readlink -e "$0")")/config"
-source "$(dirname "$(readlink -e "$0")")/torrent.conf"
-source "$(librelib messages)"
-
-if (( $# != 1 )) || [[ $1 != "$FTP_BASE"/* ]]; then
- msg "usage: %s <pkgfile> <public_location>"
- exit $EXIT_INVALIDARGUMENT
-fi
-
-pkgfile=$1
-
-IFS=,
-mktorrent \
- -a "${TRACKERS[*]}" \
- -w "${WEBSEED_MIRROR}${pkgfile#"${FTP_BASE}/"}" \
- -- "${pkgfile}" >/dev/null