From ed53c387983f00bcd1f55ac336b37bc3fb5bbda7 Mon Sep 17 00:00:00 2001 From: Simon Doppler Date: Tue, 8 May 2018 11:38:40 +0200 Subject: Add torrent link with long options --- update-website | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'update-website') diff --git a/update-website b/update-website index a7fd6a9..df88f5d 100755 --- a/update-website +++ b/update-website @@ -16,6 +16,10 @@ usage() { >&2 echo ' Set archiso-i686 magnet link to $link.' >&2 echo ' --magnet-dual $link:' >&2 echo ' Set archiso-dual magnet link to $link.' + >&2 echo ' --torrent-seed-i686 $link:' + >&2 echo ' Set archiso-i686 torrent link to $link.' + >&2 echo ' --torrent-seed-dual $link:' + >&2 echo ' Set archiso-dual torrent link to $link.' [ -z "$1" ] && exit 1 || exit "$1" } @@ -24,6 +28,8 @@ eval set -- "$( --long help \ --long magnet-i686: \ --long magnet-dual: \ + --long torrent-seed-i686: \ + --long torrent-seed-dual: \ -n "$(basename "$0")" -- "$@" || \ echo usage )" @@ -59,6 +65,26 @@ while [ $# -gt 0 ]; do tr -d '\n' > \ "${tmp_dir}/magnet.dual" ;; + '--torrent-seed-i686') + if [ -s "${tmp_dir}/torrent-seed.i686" ]; then + printf 'Option %s given multiple times.\n' "$1" + usage + fi + shift + echo "$1" | \ + tr -d '\n' > \ + "${tmp_dir}/torrent-seed.i686" + ;; + '--torrent-seed-dual') + if [ -s "${tmp_dir}/torrent-seed.dual" ]; then + printf 'Option %s given multiple times.\n' "$1" + usage + fi + shift + echo "$1" | \ + tr -d '\n' > \ + "${tmp_dir}/torrent-seed.dual" + ;; '--') shift break @@ -247,3 +273,17 @@ for arch in "${!desc[@]}"; do /title="Magnet link">Magnet link for \S\+ ('"${desc["${arch}"]}"')/ s/>Magnet link for \S\+ />Magnet link for '"${latest_iso_date}"' / ' "${website_dir}/download/index.html" done + +for arch in "${!desc[@]}"; do + if [ ! -s "${tmp_dir}/torrent-seed.${arch}" ]; then + continue + fi + if ! grep -qF "archlinux-${latest_iso_date}-${arch}" "${tmp_dir}/torrent-seed.${arch}"; then + >&2 printf 'Torrent seed for %s is not for %s, skipping.\n' "${arch}" "archlinux-${latest_iso_date}-${arch}.iso" + continue + fi + sed -i ' + /
  • Torrent for \S\+ ('"${desc["${arch}"]}"')/ s/>Torrent for \S\+ />Torrent for '"${latest_iso_date}"' / + ' "${website_dir}/download/index.html" +done -- cgit v1.2.3