Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xupdate-website40
1 files changed, 40 insertions, 0 deletions
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 '
+ /<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