index : releng | |
Archlinux32 release engineering | gitolite user |
summaryrefslogtreecommitdiff |
author | Simon Doppler <dopsi@dopsi.ch> | 2017-09-04 18:39:27 +0200 |
---|---|---|
committer | Simon Doppler <dopsi@dopsi.ch> | 2017-09-04 18:42:44 +0200 |
commit | 5303d8c8b0c72914e62c97f8237bc9c853fe6eac (patch) | |
tree | 9867bcaaafafcfe86cccd08a348ea1874af967a8 /al32-mktorrent.sh | |
parent | 31e047e603cb39868af1cbba288d2ea5f500a18c (diff) |
-rw-r--r-- | al32-mktorrent.sh | 31 |
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: |