Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/update-website
diff options
context:
space:
mode:
Diffstat (limited to 'update-website')
-rwxr-xr-xupdate-website152
1 files changed, 59 insertions, 93 deletions
diff --git a/update-website b/update-website
index 33dbe61..c653820 100755
--- a/update-website
+++ b/update-website
@@ -3,13 +3,9 @@
# parameters and default values
ARCH='i686'
DESC='i686 only'
-OUTPUT_DIR="${HOME}/archisos"
DATE=$(date +%Y.%m.%d)
ISO="archlinux32-${DATE}-${ARCH}.iso"
-mirror_dir='/mnt/archlinux32'
-website_dir='/usr/src/archlinux32/archweb32'
-
# fail on first error
set -e
@@ -24,25 +20,19 @@ usage() {
>&2 echo ''
>&2 echo 'possible options:'
>&2 echo ' -h|--help: Show this help and exit.'
- >&2 echo ' --magnet-i686 $link:'
- >&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:'
- >&2 echo ' Set mirror-dir to $dir.'
- >&2 echo ' --update-mirrors:'
- >&2 echo ' regenerate mirror list and country flags.'
- >&2 echo ' --update-iso update information about ISO, too.'
- >&2 echo " --iso name of ISO to be checked, default is '${ISO}'."
- >&2 echo " --output-dir where to write the isos, default is '${OUTPUT_DIR}."
- >&2 echo " --arch architecture of the ISO to update, default '$ARCH'."
- >&2 echo " --desc description of the ISO to update, default '$DESC'."
+ >&2 echo ''
+ >&2 echo 'configuration options:'
+ >&2 echo " --arch <arch> architecture of the ISO to update, default '$ARCH'."
+ >&2 echo " --desc <desc> description of the ISO to update, default '$DESC'."
+ >&2 echo " --iso name of ISO to be checked, default is '${ISO}'."
+ >&2 echo ' --website-dir <dir> set website-dir to <dir>.'
+ >&2 echo ' --mirror-dir <dir> set mirror-dir to <dir>.'
+ >&2 echo ' --magnet-link <link> set magnet link to <link> for architecture --arch.'
+ >&2 echo ' --torrent-seed <link> set torrent seed link to $link for architecture --arch.'
+ >&2 echo ''
+ >&2 echo 'operations:'
+ >&2 echo ' --update-mirrors regenerate mirror list and country flags.'
+ >&2 echo ' --update-iso update information about ISO, too.'
[ -z "$1" ] && exit 1 || exit "$1"
}
@@ -50,17 +40,15 @@ usage() {
eval set -- "$(
getopt -o h \
--long help \
- --long magnet-i686: \
- --long magnet-dual: \
- --long torrent-seed-i686: \
- --long torrent-seed-dual: \
- --long mirror-dir: \
+ --long arch: \
+ --long desc: \
+ --long iso: \
--long website-dir: \
+ --long mirror-dir: \
+ --long magnet-link: \
+ --long torrent-seed: \
--long update-mirrors \
--long update-iso \
- --long iso: \
- --long arch: \
- --long desc: \
-n "$(basename "$0")" -- "$@" || \
echo usage
)"
@@ -81,45 +69,26 @@ iso="${ISO}"
while [ $# -gt 0 ]; do
case "$1" in
- '--magnet-i686')
- if [ -s "${tmp_dir}/magnet.i686" ]; then
- printf 'Option %s given multiple times.\n' "$1"
- usage
- fi
+ '--arch')
shift
- echo "$1" | \
- tr -d '\n' > \
- "${tmp_dir}/magnet.i686"
+ arch="$1"
;;
- '--magnet-dual')
- if [ -s "${tmp_dir}/magnet.dual" ]; then
- printf 'Option %s given multiple times.\n' "$1"
- usage
- fi
+ '--desc')
shift
- echo "$1" | \
- tr -d '\n' > \
- "${tmp_dir}/magnet.dual"
+ desc="$1"
;;
- '--torrent-seed-i686')
- if [ -s "${tmp_dir}/torrent-seed.i686" ]; then
- printf 'Option %s given multiple times.\n' "$1"
- usage
- fi
+ '--iso')
shift
- echo "$1" | \
- tr -d '\n' > \
- "${tmp_dir}/torrent-seed.i686"
+ iso="$1"
;;
- '--torrent-seed-dual')
- if [ -s "${tmp_dir}/torrent-seed.dual" ]; then
+ '--website-dir')
+ if [ -s "${tmp_dir}/website_dir.set" ]; then
printf 'Option %s given multiple times.\n' "$1"
usage
fi
shift
- echo "$1" | \
- tr -d '\n' > \
- "${tmp_dir}/torrent-seed.dual"
+ website_dir="$1"
+ echo "$website_dir" > "${tmp_dir}/website_dir.set"
;;
'--mirror-dir')
if [ -s "${tmp_dir}/mirror_dir.set" ]; then
@@ -130,14 +99,25 @@ while [ $# -gt 0 ]; do
mirror_dir="$1"
echo "$mirror_dir" > "${tmp_dir}/mirror_dir.set"
;;
- '--website-dir')
- if [ -s "${tmp_dir}/website_dir.set" ]; then
+ '--magnet-link')
+ if [ -s "${tmp_dir}/magnet.link.set" ]; then
printf 'Option %s given multiple times.\n' "$1"
usage
fi
shift
- website_dir="$1"
- echo "$website_dir" > "${tmp_dir}/website_dir.set"
+ echo "$1" | \
+ tr -d '\n' > \
+ "${tmp_dir}/magnet.link.set"
+ ;;
+ '--torrent-seed')
+ if [ -s "${tmp_dir}/torrent-seed.set" ]; then
+ printf 'Option %s given multiple times.\n' "$1"
+ usage
+ fi
+ shift
+ echo "$1" | \
+ tr -d '\n' > \
+ "${tmp_dir}/torrent-seed.set"
;;
'--update-mirrors')
if [ -s "${tmp_dir}/update_mirrors.set" ]; then
@@ -153,18 +133,6 @@ while [ $# -gt 0 ]; do
fi
echo "true" > "${tmp_dir}/update_iso.set"
;;
- '--iso')
- shift
- iso="$1"
- ;;
- '--arch')
- shift
- arch="$1"
- ;;
- '--desc')
- shift
- desc="$1"
- ;;
'--help'|'-h')
usage 0
;;
@@ -244,22 +212,20 @@ if [ -s "${tmp_dir}/update_mirrors.set" ]; then
' "${website_dir}/download/index.html"
fi
-latest_iso_date="$(
- ls "${mirror_dir}/archisos" | \
- grep '^archlinux32-[0-9.]\+-\(dual\|i.86\)\.iso$' | \
- sed 's@^archlinux32-\([0-9.]\+\)-\(dual\|i.86\)\.iso$@\1@' | \
- sort -k1,1 -u | \
- tail -n1
-)"
+# date of the ISO
+date=$(echo "${iso}" \
+ | sed 's/^.*-\([^-]\+\)-[^-]\+$/\1/' \
+ | sort -u
+)
# update magnet links
-if [ -s "${tmp_dir}/magnet.${arch}" ]; then
+if [ -s "${tmp_dir}/magnet.link.set" ]; then
if ! tr '&' '\n' < \
- "${tmp_dir}/magnet.${arch}" | \
+ "${tmp_dir}/magnet.link.set" | \
grep -qxF "dn=${iso}"; then
sed -i '
- /<li><a href="magnet:?.*-'"${arch}"'\.iso/ s/href="[^"]\+"/href="'"$(sed 's|&|\\&|g' "${tmp_dir}/magnet.${arch}")"'"/
- /title="Magnet link">Magnet link for \S\+ ('"${desc["${arch}"]}"')/ s/>Magnet link for \S\+ />Magnet link for '"${latest_iso_date}"' /
+ /<li>(<strike>)?<a href="magnet:?.*-'"${arch}"'\.iso/ s/href="[^"]\+"/href="'"$(sed 's|&|\\&|g' "${tmp_dir}/magnet.link.set")"'"/
+ /title="Magnet link">Magnet link for \S\+ ('"${desc}"')/ s/>Magnet link for \S\+ />Magnet link for '"${date}"' /
' "${website_dir}/download/index.html"
else
>&2 printf 'Magnet link for %s is not for %s, skipping.\n' "${arch}" "${iso}"
@@ -267,11 +233,11 @@ if [ -s "${tmp_dir}/magnet.${arch}" ]; then
fi
# update torrent links
-if [ -s "${tmp_dir}/torrent-seed.${arch}" ]; then
- if grep -qF "archlinux32-${latest_iso_date}-${arch}" "${tmp_dir}/torrent-seed.${arch}"; then
+if [ -s "${tmp_dir}/torrent-seed.set" ]; then
+ if grep -qF "archlinux32-${date}-${arch}" "${tmp_dir}/torrent-seed.set"; then
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}"' /
+ /<li>(<strike>)?<a href="http.*-'"${arch}"'\.iso.torrent/ s/href="[^"]\+"/href="'"$(sed -e 's_/_\\/_g' "${tmp_dir}/torrent-seed.set")"'"/
+ /title="Download torrent">Torrent for \S\+ ('"${desc["${arch}"]}"')/ s/>Torrent for \S\+ />Torrent for '"${date}"' /
' "${website_dir}/download/index.html"
else
>&2 printf 'Torrent seed for %s is not for %s, skipping.\n' "${arch}" "${iso}"
@@ -293,7 +259,7 @@ fi
# adapt release info on the top
values=(
- 'Current Release' "${latest_iso_date}"
+ 'Current Release' "${date}"
'Included Kernel' "${kernel}"
'PGP Key' '<a href="http://www.archlinux32.org/buildmaster/gpg-keys.php?fp='"${sign_key}"'">'"${sign_key}"'</a>'
)
@@ -318,7 +284,7 @@ sed -i "$(
# adapt dates in signatures
sed -i "$(
printf '/archlinux32-[0-9.]\+-%s\.iso\.sig/s@archlinux32-[0-9.]\+-%s\.iso\.sig@archlinux32-%s-%s.iso.sig@\n' \
- "${arch}" "${arch}" "${latest_iso_date}" "${arch}"
+ "${arch}" "${arch}" "${date}" "${arch}"
)
" \
"${website_dir}/download/index.html"