Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/al32-mktorrent.sh
diff options
context:
space:
mode:
authorSimon Doppler <dopsi@dopsi.ch>2017-09-04 18:39:27 +0200
committerSimon Doppler <dopsi@dopsi.ch>2017-09-04 18:42:44 +0200
commit5303d8c8b0c72914e62c97f8237bc9c853fe6eac (patch)
tree9867bcaaafafcfe86cccd08a348ea1874af967a8 /al32-mktorrent.sh
parent31e047e603cb39868af1cbba288d2ea5f500a18c (diff)
Handle upload of files to hefur and a web server
Diffstat (limited to 'al32-mktorrent.sh')
-rw-r--r--al32-mktorrent.sh31
1 files changed, 29 insertions, 2 deletions
diff --git a/al32-mktorrent.sh b/al32-mktorrent.sh
index 3190f0c..26f068d 100644
--- a/al32-mktorrent.sh
+++ b/al32-mktorrent.sh
@@ -17,7 +17,7 @@ set -euo pipefail
function join_by { local IFS="$1"; shift; echo "$*"; }
usage () {
- echo "Usage: $0 [-d date] [arch...]"
+ echo "Usage: $0 [-d date] [-w webdir] [-t hefurdir] [arch...]"
}
fg_green="\033[32m"
@@ -95,6 +95,13 @@ function create_torrent_for_arch () {
python magnet2feed.py "$magnet_link" "$iso_date"
}
+function upload_file_to_remote_dir {
+ if [ -f "$1" ] && [ -n "$2" ] ; then
+ echo -e "$fg_reset${fg_bold}Uploading file$fg_reset "${fg_blue}$1$fg_reset" ${fg_bold}to$fg_reset "${fg_blue}$1$fg_reset" $fg_bold...$fg_reset"
+ scp "$1" "$2"
+ fi
+}
+
### Check for if required programs are present
which mktorrent 2>/dev/null || (
@@ -111,12 +118,20 @@ python -c "import feedgenerator" 2>/dev/null || (
declare -a architectures=("i686" "dual")
iso_date=''
+web_dir=''
+hefur_dir=''
-while getopts "d:h" o; do
+while getopts "d:w:t:h" o; do
case "${o}" in
d)
iso_date=${OPTARG}
;;
+ t)
+ hefur_dir=${OPTARG}
+ ;;
+ w)
+ web_dir=${OPTARG}
+ ;;
h)
usage
exit
@@ -141,4 +156,16 @@ for a in "${architectures[@]}" ; do
create_torrent_for_arch "$a"
done
+for a in "${architectures[@]}" ; do
+ torrent_filename="archlinux-$iso_date-$arch.iso.torrent"
+ if [ -n "$web_dir" ] ; then
+ feed_filename="feed_$arch.rss"
+ upload_file_to_remote_dir "$torrent_filename" "$web_dir"
+ upload_file_to_remote_dir "$feed_filename" "$web_dir"
+ fi
+ if [ -n "$hefur_dir" ] ; then
+ upload_file_to_remote_dir "$torrent_filename" "$hefur_dir"
+ fi
+done
+
# vim: set ts=4 sw=4: