diff options
author | deep-42-thought <github@eckner.net> | 2018-05-08 14:40:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-08 14:40:51 +0200 |
commit | 5c7d2a43fc1f532d7df8cdd01dbe90592093410d (patch) | |
tree | d70105e61b3bca081c3cc24aab4afc3830bf05b1 | |
parent | 4c8b552c63abc6bd419dcb79945aa230b8a9f205 (diff) | |
parent | fb0e1bb605062e9d15189ab8e99f86fb75d35160 (diff) | |
download | releng-5c7d2a43fc1f532d7df8cdd01dbe90592093410d.tar.xz |
Merge pull request #5 from dopsi/set-torrent-link
Add torrent link with long options
-rwxr-xr-x | update-website | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/update-website b/update-website index 09bd403..e7c4fc9 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.' >&2 echo ' --website-dir $dir:' >&2 echo ' Set website-dir to $dir.' >&2 echo ' --mirror-dir $dir:' @@ -28,6 +32,8 @@ eval set -- "$( --long help \ --long magnet-i686: \ --long magnet-dual: \ + --long torrent-seed-i686: \ + --long torrent-seed-dual: \ --long mirror-dir: \ --long website-dir: \ -n "$(basename "$0")" -- "$@" || \ @@ -65,6 +71,25 @@ 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" '--mirror-dir') if [ -s "${tmp_dir}/mirror_dir.set" ]; then printf 'Option %s given multiple times.\n' "$1" @@ -271,3 +296,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 ' + /<li><a href="http.*-'"${arch}"'\.iso.torrent/ s/href="[^"]\+"/href="'"$(sed -e 's_/_\\/_g' "${tmp_dir}/torrent-seed.${arch}")"'"/ + /title="Download torrent">Torrent for \S\+ ('"${desc["${arch}"]}"')/ s/>Torrent for \S\+ />Torrent for '"${latest_iso_date}"' / + ' "${website_dir}/download/index.html" +done |