From eeb3193ff0e16fb989e0c2d8d5912010f4c4eddb Mon Sep 17 00:00:00 2001 From: Simon Doppler Date: Sun, 6 Aug 2017 16:09:20 +0200 Subject: Add LICENSE and README --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 README.md (limited to 'README.md') diff --git a/README.md b/README.md new file mode 100644 index 0000000..1c050f5 --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# al32-mktorrent + +Torrent creation script for [ArchLinux32](https://archlinux32.org) + +## Usage + + al32-mktorrent.sh [ -d date ] [ i686 | dual ] + +If no architecture is specified, the script will default to `i686`. +If no date is specified, the script will prompt for a date during the process. + +## License + +> 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 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 . + +## Author + +Copyright (c) 2017 Simon Doppler (dopsi) -- cgit v1.2.3-54-g00ecf From 68228740e5d348252ead25982656104428d3d545 Mon Sep 17 00:00:00 2001 From: Simon Doppler Date: Sun, 6 Aug 2017 21:09:54 +0200 Subject: Add features list --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 1c050f5..38b80df 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,24 @@ Torrent creation script for [ArchLinux32](https://archlinux32.org) If no architecture is specified, the script will default to `i686`. If no date is specified, the script will prompt for a date during the process. +## Features + +* [ ] Torrent creation + * [x] Create a torrent file per architecture + * [x] Obtain the latest mirrorlist + * [x] Check mirrors for ISO availability + * [x] Download ISO + * [x] Check ISO + * [ ] Create both torrent files at once + * [x] Create a magnet link per architecture +* [ ] Torrent upload + * [ ] Upload the torrent file to a server via SSH (for sharing) + * [ ] Upload the torrent to transmission-server +* [ ] Inform the world of the new torrent file + * [ ] Add the magnet link to a RSS feed + * [ ] Upload the new RSS feed to the server + * [ ] Send an email to the arch-ports list + ## License > This program is free software: you can redistribute it and/or modify -- cgit v1.2.3-54-g00ecf From 60eb998226809b43bec8e47ab729c5fa6898c90d Mon Sep 17 00:00:00 2001 From: Simon Doppler Date: Mon, 7 Aug 2017 16:33:12 +0200 Subject: Create feed from magnet links --- README.md | 2 +- al32-mktorrent.sh | 7 ++++++- magnet2feed.py | 30 ++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 magnet2feed.py (limited to 'README.md') diff --git a/README.md b/README.md index 38b80df..427daca 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ If no date is specified, the script will prompt for a date during the process. * [ ] Upload the torrent file to a server via SSH (for sharing) * [ ] Upload the torrent to transmission-server * [ ] Inform the world of the new torrent file - * [ ] Add the magnet link to a RSS feed + * [x] Add the magnet link to a RSS feed * [ ] Upload the new RSS feed to the server * [ ] Send an email to the arch-ports list diff --git a/al32-mktorrent.sh b/al32-mktorrent.sh index 1103364..3fdb196 100644 --- a/al32-mktorrent.sh +++ b/al32-mktorrent.sh @@ -103,5 +103,10 @@ fi mktorrent --announce=http://dopsi.ch:6969/announce --web-seed="$(join_by ',' "${available_mirrors[@]}")" "$iso_string" echo -e "$fg_reset${fg_bold}Create magnet link...$fg_reset" -transmission-show --magnet "$iso_string.torrent" +magnet_link="$(transmission-show --magnet "$iso_string.torrent")" +echo "$magnet_link" + +echo -e "$fg_reset${fg_bold}Create RSS feed files...$fg_reset" +python magnet2feed.py "$magnet_link" "$iso_date" + # vim: set ts=4 sw=4: diff --git a/magnet2feed.py b/magnet2feed.py new file mode 100644 index 0000000..5dc767f --- /dev/null +++ b/magnet2feed.py @@ -0,0 +1,30 @@ +from feedgenerator import Rss201rev2Feed +import sys +from os.path import basename + +feed_url = 'https://static.dopsi.ch/al32/feed_{arch}.rss' +architectures = ['i686', 'dual'] + + +def main(link, date): + for arch in architectures: + feed = Rss201rev2Feed(title='ArchLinux32 torrent download feed ({arch} ISO)'.format(arch=arch), + link=feed_url, + description="A torrent feed to download the latest ArchLinux32 {arch} iso".format( + arch=arch + ), + language='en') + + feed.add_item(title='ArchLinux32 {arch} {date}'.format(arch=arch, date=date), + link=link, + description='ArchLinux32 {arch} {date}'.format(arch=arch, date=date)) + + with open(basename(feed_url).format(arch=arch), mode='w') as feed_file: + feed.write(feed_file, 'utf-8') + + +if __name__ == '__main__': + if len(sys.argv) != 3: + print('Error: {cmd} magnet date'.format(cmd=sys.argv[0])) + + main(link=sys.argv[1], date=sys.argv[2]) -- cgit v1.2.3-54-g00ecf From f43000503280370733138fdd311b18936a92d452 Mon Sep 17 00:00:00 2001 From: Simon Doppler Date: Mon, 7 Aug 2017 17:06:13 +0200 Subject: Build both architectures at the same time --- README.md | 7 ++- al32-mktorrent.sh | 125 +++++++++++++++++++++++++++++------------------------- 2 files changed, 70 insertions(+), 62 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 427daca..24c8fa7 100644 --- a/README.md +++ b/README.md @@ -4,20 +4,19 @@ Torrent creation script for [ArchLinux32](https://archlinux32.org) ## Usage - al32-mktorrent.sh [ -d date ] [ i686 | dual ] + al32-mktorrent.sh [ -d date ] -If no architecture is specified, the script will default to `i686`. If no date is specified, the script will prompt for a date during the process. ## Features -* [ ] Torrent creation +* [x] Torrent creation * [x] Create a torrent file per architecture * [x] Obtain the latest mirrorlist * [x] Check mirrors for ISO availability * [x] Download ISO * [x] Check ISO - * [ ] Create both torrent files at once + * [x] Create both torrent files at once * [x] Create a magnet link per architecture * [ ] Torrent upload * [ ] Upload the torrent file to a server via SSH (for sharing) diff --git a/al32-mktorrent.sh b/al32-mktorrent.sh index 3fdb196..3c1090a 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] [i686|dual]" + echo "Usage: $0 [-d date]" } fg_green="\033[32m" @@ -28,6 +28,70 @@ fg_bold="\033[1m" MIRRORLIST_FILE="https://raw.githubusercontent.com/archlinux32/packages/master/core/pacman-mirrorlist/mirrorlist" +function create_torrent_for_arch () { + mirrorlist="$(curl "$MIRRORLIST_FILE" 2>/dev/null | grep Server | cut -d '=' -f 2 | sed -e 's/\s//g;s_$arch/$repo_archisos/_')" + + if [ "$#" -eq 0 ] ; then + echo "No architecture specified, selecting 'i686'" + arch="i686" + elif [ "$#" -eq 1 ] ; then + echo "Selecting architecture '$1'" + arch="$1" + else + usage + echo "Too many arguments, exiting" >&2 + exit 1 + fi + + iso_string="archlinux-$iso_date-$arch.iso" + + for i in $mirrorlist ; do + echo -n -e "$fg_reset${fg_bold}Checking $fg_reset$fg_blue$i$fg_reset " + curl -g "$i" 2>/dev/null | grep -q "$iso_string" && ( + echo -e "$fg_reset${fg_green}OK$fg_reset" + ) || ( echo -e "$fg_reset${fg_red}Failed$fg_reset" ; false ) || continue + available_mirrors=(${available_mirrors[@]} "$i") + done + + echo "${#available_mirrors[@]} mirrors available" + + + if [ ! -f "$iso_string" ] ; then + echo -e "$fg_reset${fg_bold}Downloading iso...$fg_reset" + curl -O "${available_mirrors[0]}$iso_string" + else + echo -e "$fg_reset${fg_bold}Reusing already downloaded iso...$fg_reset" + fi + + + echo -e "$fg_reset${fg_bold}Downloading verification files...$fg_reset" + curl -O "${available_mirrors[0]}$iso_string.sig" + curl -O "${available_mirrors[0]}sha512sums" + + echo -n -e "$fg_reset${fg_bold}Checking PGP signature...$fg_reset " + gpg --verify "$iso_string.sig" "$iso_string" || exit 100 + echo -e "$fg_reset${fg_green}OK" + + echo -e "$fg_reset${fg_bold}Checking SHA512 sums...$fg_reset" + sha512sum --ignore-missing --check sha512sums || exit 101 + + echo -e "$fg_reset${fg_bold}Create torrent file...$fg_reset" + if [ -f "$iso_string.torrent" ] ; then + rm "$iso_string.torrent" + fi + mktorrent --announce=http://dopsi.ch:6969/announce --web-seed="$(join_by ',' "${available_mirrors[@]}")" "$iso_string" + + echo -e "$fg_reset${fg_bold}Create magnet link...$fg_reset" + magnet_link="$(transmission-show --magnet "$iso_string.torrent")" + echo "$magnet_link" + + echo -e "$fg_reset${fg_bold}Create RSS feed files...$fg_reset" + python magnet2feed.py "$magnet_link" "$iso_date" +} + +### Actual program + +declare -a architectures=("i686" "dual") declare -a available_mirrors iso_date='' @@ -50,63 +114,8 @@ shift $((OPTIND-1)) [ -z "$iso_date" ] && read -r -p "Date of the ISO: " iso_date -mirrorlist="$(curl "$MIRRORLIST_FILE" 2>/dev/null | grep Server | cut -d '=' -f 2 | sed -e 's/\s//g;s_$arch/$repo_archisos/_')" - -if [ "$#" -eq 0 ] ; then - echo "No architecture specified, selecting 'i686'" - arch="i686" -elif [ "$#" -eq 1 ] ; then - echo "Selecting architecture '$1'" - arch="$1" -else - usage - echo "Too many arguments, exiting" >&2 - exit 1 -fi - -iso_string="archlinux-$iso_date-$arch.iso" - -for i in $mirrorlist ; do - echo -n -e "$fg_reset${fg_bold}Checking $fg_reset$fg_blue$i$fg_reset " - curl -g "$i" 2>/dev/null | grep -q "$iso_string" && ( - echo -e "$fg_reset${fg_green}OK$fg_reset" - ) || ( echo -e "$fg_reset${fg_red}Failed$fg_reset" ; false ) || continue - available_mirrors=(${available_mirrors[@]} "$i") +for a in "${architectures[@]}" ; do + create_torrent_for_arch "$a" done -echo "${#available_mirrors[@]} mirrors available" - - -if [ ! -f "$iso_string" ] ; then - echo -e "$fg_reset${fg_bold}Downloading iso...$fg_reset" - curl -O "${available_mirrors[0]}$iso_string" -else - echo -e "$fg_reset${fg_bold}Reusing already downloaded iso...$fg_reset" -fi - - -echo -e "$fg_reset${fg_bold}Downloading verification files...$fg_reset" -curl -O "${available_mirrors[0]}$iso_string.sig" -curl -O "${available_mirrors[0]}sha512sums" - -echo -n -e "$fg_reset${fg_bold}Checking PGP signature...$fg_reset " -gpg --verify "$iso_string.sig" "$iso_string" || exit 100 -echo -e "$fg_reset${fg_green}OK" - -echo -e "$fg_reset${fg_bold}Checking SHA512 sums...$fg_reset" -sha512sum --ignore-missing --check sha512sums || exit 101 - -echo -e "$fg_reset${fg_bold}Create torrent file...$fg_reset" -if [ -f "$iso_string.torrent" ] ; then - rm "$iso_string.torrent" -fi -mktorrent --announce=http://dopsi.ch:6969/announce --web-seed="$(join_by ',' "${available_mirrors[@]}")" "$iso_string" - -echo -e "$fg_reset${fg_bold}Create magnet link...$fg_reset" -magnet_link="$(transmission-show --magnet "$iso_string.torrent")" -echo "$magnet_link" - -echo -e "$fg_reset${fg_bold}Create RSS feed files...$fg_reset" -python magnet2feed.py "$magnet_link" "$iso_date" - # vim: set ts=4 sw=4: -- cgit v1.2.3-54-g00ecf From b0cef789aa402ba5aa6ccab66a6e6b8b23dcb907 Mon Sep 17 00:00:00 2001 From: Simon Doppler Date: Mon, 7 Aug 2017 17:09:51 +0200 Subject: Add links to the torrent storage location --- README.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 24c8fa7..066aeee 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ Torrent creation script for [ArchLinux32](https://archlinux32.org) +The latest torrents are hosted on [static.dopsi.ch](https://static.dopsi.ch/al32/) +along with the RSS feeds (for [i686](https://static.dopsi.ch/al32/feed_i686.rss) and +[dual](https://static.dopsi.ch/al32/feed_dual.rss)). + ## Usage al32-mktorrent.sh [ -d date ] -- cgit v1.2.3-54-g00ecf From 01578696cb5b8fc18f36f1b639399c9c3c0ead36 Mon Sep 17 00:00:00 2001 From: Simon Doppler Date: Tue, 8 Aug 2017 12:37:59 +0200 Subject: All architecture selection --- README.md | 3 ++- al32-mktorrent.sh | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 066aeee..9cc69ee 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,9 @@ along with the RSS feeds (for [i686](https://static.dopsi.ch/al32/feed_i686.rss) ## Usage - al32-mktorrent.sh [ -d date ] + al32-mktorrent.sh [ -d date ] [ arch... ] +If no arch is specified both `i686` and `dual` will be generated. If no date is specified, the script will prompt for a date during the process. ## Features diff --git a/al32-mktorrent.sh b/al32-mktorrent.sh index b5aaff7..68ea265 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]" + echo "Usage: $0 [-d date] [arch...]" } fg_green="\033[32m" @@ -112,6 +112,10 @@ while getopts "d:h" o; do done shift $((OPTIND-1)) +if [ "$#" -gt 0 ] ; then + architectures=($@) +fi + [ -z "$iso_date" ] && read -r -p "Date of the ISO: " iso_date for a in "${architectures[@]}" ; do -- cgit v1.2.3-54-g00ecf From 31e047e603cb39868af1cbba288d2ea5f500a18c Mon Sep 17 00:00:00 2001 From: Simon Doppler Date: Sun, 3 Sep 2017 19:32:35 +0200 Subject: Add spaces in README.md --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 9cc69ee..7332da6 100644 --- a/README.md +++ b/README.md @@ -15,21 +15,21 @@ If no date is specified, the script will prompt for a date during the process. ## Features -* [x] Torrent creation - * [x] Create a torrent file per architecture - * [x] Obtain the latest mirrorlist - * [x] Check mirrors for ISO availability - * [x] Download ISO - * [x] Check ISO - * [x] Create both torrent files at once - * [x] Create a magnet link per architecture -* [ ] Torrent upload - * [ ] Upload the torrent file to a server via SSH (for sharing) - * [ ] Upload the torrent to transmission-server -* [ ] Inform the world of the new torrent file - * [x] Add the magnet link to a RSS feed - * [ ] Upload the new RSS feed to the server - * [ ] Send an email to the arch-ports list + * [x] Torrent creation + * [x] Create a torrent file per architecture + * [x] Obtain the latest mirrorlist + * [x] Check mirrors for ISO availability + * [x] Download ISO + * [x] Check ISO + * [x] Create both torrent files at once + * [x] Create a magnet link per architecture + * [ ] Torrent upload + * [ ] Upload the torrent file to a server via SSH (for sharing) + * [ ] Upload the torrent to transmission-server + * [ ] Inform the world of the new torrent file + * [x] Add the magnet link to a RSS feed + * [ ] Upload the new RSS feed to the server + * [ ] Send an email to the arch-ports list ## License -- cgit v1.2.3-54-g00ecf From 5303d8c8b0c72914e62c97f8237bc9c853fe6eac Mon Sep 17 00:00:00 2001 From: Simon Doppler Date: Mon, 4 Sep 2017 18:39:27 +0200 Subject: Handle upload of files to hefur and a web server --- README.md | 16 ++++++++++------ al32-mktorrent.sh | 31 +++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 8 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 7332da6..c1a7cbc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # al32-mktorrent -Torrent creation script for [ArchLinux32](https://archlinux32.org) +Torrent creation script for [ArchLinux32](https://archlinux32.org), with upload +capabilities via `scp` and to [hefur](https://github.com/abique/hefur). The latest torrents are hosted on [static.dopsi.ch](https://static.dopsi.ch/al32/) along with the RSS feeds (for [i686](https://static.dopsi.ch/al32/feed_i686.rss) and @@ -8,10 +9,12 @@ along with the RSS feeds (for [i686](https://static.dopsi.ch/al32/feed_i686.rss) ## Usage - al32-mktorrent.sh [ -d date ] [ arch... ] + al32-mktorrent.sh [ -d date ] [ -w webdir ] [ -t hefurdir ] [ arch... ] -If no arch is specified both `i686` and `dual` will be generated. -If no date is specified, the script will prompt for a date during the process. +If no `arch` is specified both `i686` and `dual` will be generated. +If no `date` is specified, the script will prompt for a date during the process. +If `hefurdir` or `webdir` is not specified no file will be uploaded to +the corresponding server. ## Features @@ -24,11 +27,12 @@ If no date is specified, the script will prompt for a date during the process. * [x] Create both torrent files at once * [x] Create a magnet link per architecture * [ ] Torrent upload - * [ ] Upload the torrent file to a server via SSH (for sharing) + * [x] Upload the torrent file to a web server via SSH + * [x] Upload the torrent file to a torrent tracker via SSH * [ ] Upload the torrent to transmission-server * [ ] Inform the world of the new torrent file * [x] Add the magnet link to a RSS feed - * [ ] Upload the new RSS feed to the server + * [x] Upload the new RSS feed to the server * [ ] Send an email to the arch-ports list ## License 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: -- cgit v1.2.3-54-g00ecf From 6e412efc789efb66b862270d5be0e56979be1016 Mon Sep 17 00:00:00 2001 From: Simon Doppler Date: Fri, 8 Dec 2017 22:31:28 +0100 Subject: Make lists vimwiki compatible --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index c1a7cbc..0de8b0e 100644 --- a/README.md +++ b/README.md @@ -18,21 +18,21 @@ the corresponding server. ## Features - * [x] Torrent creation - * [x] Create a torrent file per architecture - * [x] Obtain the latest mirrorlist - * [x] Check mirrors for ISO availability - * [x] Download ISO - * [x] Check ISO - * [x] Create both torrent files at once - * [x] Create a magnet link per architecture + * [X] Torrent creation + * [X] Create a torrent file per architecture + * [X] Obtain the latest mirrorlist + * [X] Check mirrors for ISO availability + * [X] Download ISO + * [X] Check ISO + * [X] Create both torrent files at once + * [X] Create a magnet link per architecture * [ ] Torrent upload - * [x] Upload the torrent file to a web server via SSH - * [x] Upload the torrent file to a torrent tracker via SSH + * [X] Upload the torrent file to a web server via SSH + * [X] Upload the torrent file to a torrent tracker via SSH * [ ] Upload the torrent to transmission-server * [ ] Inform the world of the new torrent file - * [x] Add the magnet link to a RSS feed - * [x] Upload the new RSS feed to the server + * [X] Add the magnet link to a RSS feed + * [X] Upload the new RSS feed to the server * [ ] Send an email to the arch-ports list ## License -- cgit v1.2.3-54-g00ecf