diff options
-rw-r--r-- | LICENSE | 6 | ||||
-rwxr-xr-x | build-dual.sh | 57 | ||||
-rwxr-xr-x | build-i686.sh | 49 | ||||
-rwxr-xr-x | find-inofficial-mirrors | 19 | ||||
-rw-r--r-- | flag-names | 61 | ||||
-rwxr-xr-x | update-website | 334 |
6 files changed, 523 insertions, 3 deletions
@@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} 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 @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - <program> Copyright (C) <year> <name of author> + {project} Copyright (C) {year} {fullname} This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/build-dual.sh b/build-dual.sh new file mode 100755 index 0000000..9f14a5f --- /dev/null +++ b/build-dual.sh @@ -0,0 +1,57 @@ +#!/bin/bash +mkdir build-dual +cd build-dual + +cat << "END" > Vagrantfile +Vagrant.configure("2") do |config| + config.vm.box = "archlinux/archlinux" + config.vm.provision "shell", path: "provision.sh", run: "once" +end +END + +cat << "__ENDOFPROVISION.SH__" > provision.sh +#!/bin/bash +set -e +ln -svf /usr/share/zoneinfo/America/Detroit /etc/localtime + +pacman --noconfirm -Sy archlinux-keyring + +tee -a /etc/pacman.conf << "_PACMANCONF_" +[releng] +Include = /etc/pacman.d/mirrorlist32 +_PACMANCONF_ + +cat << "__ENDOFARCH32MIRRORLIST__" > /etc/pacman.d/mirrorlist32 +Server = https://32.arlm.tyzoid.com/$arch/$repo +Server = http://arch32.mirrors.simplysam.us/$arch/$repo +Server = https://mirror.archlinux32.org/$arch/$repo +__ENDOFARCH32MIRRORLIST__ + +pacman --noconfirm -Sy archlinux32-keyring-transition +pacman --noconfirm -R archlinux32-keyring-transition +pacman --noconfirm -S archlinux32-keyring +pacman --noconfirm -Su archiso-dual + +cat << "__ENDOFARCH32MIRRORLIST__" > /etc/pacman.d/mirrorlist32 +Server = https://multiarch.arch32.tyzoid.com/$repo/os/$arch +__ENDOFARCH32MIRRORLIST__ + +cat << "__MIRRORLIST__" | tee /etc/pacman.d/mirrorlist +Server = https://multiarch.arch32.tyzoid.com/$repo/os/$arch +__MIRRORLIST__ + +cat << "__ENDOFISOBUILDSCRIPT__" | tee /root/buildiso.sh >/dev/null +#!/bin/bash +/usr/share/archiso/configs/releng/build.sh -v -V"$(date -d"$(date -d "+2day" +%Y-%m-01T12:00:00Z)" +%Y.%m.%d)" -L"ARCH_$(date -d"$(date -d "+2day" +%Y-%m-01T12:00:00Z)" +%Y%m)" +__ENDOFISOBUILDSCRIPT__ +chmod +x /root/buildiso.sh +__ENDOFPROVISION.SH__ + +vagrant up +vagrant ssh -c "sudo reboot"; +vagrant ssh -c "sudo bash -c '/root/buildiso.sh'"; + +vagrant ssh-config > config.txt +scp -rF config.txt default:/home/vagrant/out ../ + +#vagrant destroy -f diff --git a/build-i686.sh b/build-i686.sh new file mode 100755 index 0000000..171a690 --- /dev/null +++ b/build-i686.sh @@ -0,0 +1,49 @@ +#!/bin/bash +mkdir build-i686 +cd build-i686 + +cat << "END" > Vagrantfile +Vagrant.configure("2") do |config| + config.vm.box = "archlinux/archlinux" + config.vm.provision "shell", path: "provision.sh", run: "once" +end +END + +cat << "__ENDOFPROVISION.SH__" > provision.sh +#!/bin/bash +set -e +ln -svf /usr/share/zoneinfo/America/Detroit /etc/localtime + +pacman --noconfirm -Sy archlinux-keyring + +tee -a /etc/pacman.conf << "_PACMANCONF_" +[releng] +Include = /etc/pacman.d/mirrorlist32 +_PACMANCONF_ + +cat << "__ENDOFARCH32MIRRORLIST__" > /etc/pacman.d/mirrorlist32 +Server = https://32.arlm.tyzoid.com/$arch/$repo +Server = http://arch32.mirrors.simplysam.us/$arch/$repo +Server = https://mirror.archlinux32.org/$arch/$repo +__ENDOFARCH32MIRRORLIST__ + +pacman --noconfirm -Sy archlinux32-keyring-transition +pacman --noconfirm -R archlinux32-keyring-transition +pacman --noconfirm -S archlinux32-keyring +pacman --noconfirm -Syu archiso32 + +cat << "__ENDOFISOBUILDSCRIPT__" | tee /root/buildiso.sh >/dev/null +#!/bin/bash +/usr/share/archiso/configs/releng/build.sh -v -V"$(date -d"$(date -d "+2day" +%Y-%m-01T12:00:00Z)" +%Y.%m.%d)" -L"ARCH_$(date -d"$(date -d "+2day" +%Y-%m-01T12:00:00Z)" +%Y%m)" +__ENDOFISOBUILDSCRIPT__ +chmod +x /root/buildiso.sh +__ENDOFPROVISION.SH__ + +vagrant up +vagrant ssh -c "sudo reboot"; +vagrant ssh -c 'sudo bash -c "/root/buildiso.sh"'; + +vagrant ssh-config > config.txt +scp -rF config.txt default:/home/vagrant/out ../ + +#vagrant destroy -f diff --git a/find-inofficial-mirrors b/find-inofficial-mirrors new file mode 100755 index 0000000..5f6a300 --- /dev/null +++ b/find-inofficial-mirrors @@ -0,0 +1,19 @@ +#!/bin/sh + +sudo journalctl -b "-${1:-0}" -u rsyncd | \ + grep ' rsync on archlinux32/' | \ + grep -ivwF "$( + dig pool.mirror.archlinux32.org | \ + sed -n ' + s/^pool32\.ddns\.eckner\.net\.\s.*\s/(/ + T + s/$/)/ + p + ' + )" | \ + sed ' + s/.* \(\S\+\) (\S\+)$/\1/ + ' | \ + sort | \ + uniq -c | \ + sort -k1n,1 diff --git a/flag-names b/flag-names new file mode 100644 index 0000000..9e0a8cb --- /dev/null +++ b/flag-names @@ -0,0 +1,61 @@ +au Australia +at Austria +by Belarus +be Belgium +ba Bosnia and Herzegovina +br Brazil +bg Bulgaria +ca Canada +cl Chile +cn China +co Colombia +hr Croatia +cz Czech Republic +dk Denmark +ec Ecuador +fi Finland +fr France +de Germany +gr Greece +hk Hong Kong +hu Hungary +is Iceland +in India +id Indonesia +ir Iran +ie Ireland +il Israel +it Italy +jp Japan +kz Kazakhstan +lv Latvia +lt Lithuania +lu Luxembourg +mk Macedonia +mx Mexico +nl Netherlands +nc New Caledonia +nz New Zealand +no Norway +ph Philippines +pl Poland +pt Portugal +qa Qatar +ro Romania +ru Russia +rs Serbia +sg Singapore +sk Slovakia +si Slovenia +za South Africa +kr South Korea +es Spain +se Sweden +ch Switzerland +tw Taiwan +th Thailand +tr Turkey +ua Ukraine +gb United Kingdom +us United States +vn Vietnam diff --git a/update-website b/update-website new file mode 100755 index 0000000..7df537a --- /dev/null +++ b/update-website @@ -0,0 +1,334 @@ +#!/bin/bash + +set -e + +mirror_dir='/mnt/archlinux32' +website_dir='/usr/src/archlinux32/archweb32' + +usage() { + >&2 echo '' + >&2 echo 'get-package-updates: check for packages that need to be built,' + >&2 echo ' and build a list in the proper build order' + >&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-iso:' + >&2 echo ' Update information about iso, too.' + [ -z "$1" ] && exit 1 || exit "$1" +} + +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 website-dir: \ + --long update-iso \ + -n "$(basename "$0")" -- "$@" || \ + echo usage +)" + +tmp_dir="$(mktemp -d)" +cleanup() { + if mountpoint -q "${tmp_dir}"; then + sudo umount "${tmp_dir}" + fi + rm -rf --one-file-system "${tmp_dir}" +} +trap cleanup EXIT + +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 + shift + echo "$1" | \ + tr -d '\n' > \ + "${tmp_dir}/magnet.i686" + ;; + '--magnet-dual') + if [ -s "${tmp_dir}/magnet.dual" ]; then + printf 'Option %s given multiple times.\n' "$1" + usage + fi + shift + echo "$1" | \ + 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" + usage + fi + shift + mirror_dir="$1" + echo "$mirror_dir" > "${tmp_dir}/mirror_dir.set" + ;; + '--website-dir') + if [ -s "${tmp_dir}/website_dir.set" ]; then + printf 'Option %s given multiple times.\n' "$1" + usage + fi + shift + website_dir="$1" + echo "$website_dir" > "${tmp_dir}/website_dir.set" + ;; + '--update-iso') + if [ -s "${tmp_dir}/update_iso.set" ]; then + printf 'Option %s given multiple times.\n' "$1" + usage + fi + echo "true" > "${tmp_dir}/update_iso.set" + ;; + '--help'|'-h') + usage 0 + ;; + '--') + shift + break + ;; + *) + >&2 printf 'Whoops, option "%s" is not yet implemented!\n' "$1" + exit 42 + ;; + esac + shift +done + +if [ $# -gt 0 ]; then + >&2 echo 'Too many arguments.' + exit 2 +fi + +( + printf ' <div id="download-mirrors">\n' + curl -Ss 'https://git.archlinux32.org/archlinux32/packages/raw/branch/master/core/pacman-mirrorlist/mirrorlist?'"$( + head -c 24 /dev/urandom | \ + base64 -w0 + )" | \ + sed ' + 0,/^$/d + /^$/d + /^## /{ + s|^## |\n </ul>\n\n <h5>| + s|$|</h5>\n\n <ul>\n| + '"$( + while read -r flag country; do + printf \ + 's|<h5>%s</h5>|<h5><span class="fam-flag fam-flag-%s" title="%s"></span> %s</h5>|\n' \ + "${country}" \ + "${flag}" \ + "${country}" \ + "${country}" + done < \ + "${0%/*}/flag-names" + )"' + } + /^#Server = /{ + s|^#Server = \(.*//\)\([^/]*\)\(/.*\)\$arch/\$repo$|'"$( + printf \ + ' %s\\n' \ + '<li><a href="\1\2\3archisos/"' \ + ' title="Download from \1\2\3">\2</a></li>' + )"'| + } + ' | \ + sed ' + 0,/<\/ul>/d + ' + printf ' </ul>\n\n' + printf ' </div>\n' +) | \ + sed -i ' + :emptyLines + /^\n*$/{ + N + bemptyLines + } + /^\(\s*\n\)*\s*<div id="download-mirrors">$/{ + :a + s|^.*</div>|| + tb + $!N + ba + :b + r /dev/stdin + } + ' "${website_dir}/download/index.html" + +latest_iso_date="$( + ls "${mirror_dir}/archisos" | \ + grep '^archlinux-[0-9.]\+-\(dual\|i.86\)\.iso$' | \ + sed 's@^archlinux-\([0-9.]\+\)-\(dual\|i.86\)\.iso$@\1@' | \ + sort -k1,1 -u | \ + tail -n1 +)" + +declare -A desc +desc['i686']='i686 only' +desc['dual']='dual bootable' + +for arch in "${!desc[@]}"; do + if [ ! -s "${tmp_dir}/magnet.${arch}" ]; then + continue + fi + if ! tr '&' '\n' < \ + "${tmp_dir}/magnet.${arch}" | \ + grep -qxF "dn=archlinux-${latest_iso_date}-${arch}.iso"; then + >&2 printf 'Magnet link for %s is not for %s, skipping.\n' "${arch}" "archlinux-${latest_iso_date}-${arch}.iso" + continue + fi + 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}"' / + ' "${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 + +if [ ! -s "${tmp_dir}/update_iso.set" ]; then + exit +fi + +unset kernels +unset sizes +declare -A sizes +declare -A md5 +declare -A sha512 + +for arch in "${!desc[@]}"; do + iso="${mirror_dir}/archisos/archlinux-${latest_iso_date}-${arch}.iso" + if [ ! -f "${iso}" ]; then + >&2 echo "Can't find iso to arch ${arch}." + exit 1 + fi + sudo mount -o loop,ro "${iso}" "${tmp_dir}" + kernels="$( + printf '%s\n' ${kernels} $( + find "${tmp_dir}/arch" \ + -maxdepth 1 \ + -name 'pkglist.*.txt' \ + -not -name 'pkglist.x86_64.txt' \ + -execdir cat {} \; \ + | sed ' + s/^linux\s\+\([^-]\+-[^-]\+\)$/\1/ + t + d + ' + ) | \ + sort -u + )" + sudo umount "${tmp_dir}" + sizes["${arch}"]="$( + printf 'scale=1; %s/1024/1024\n' "$(stat -c'%s' "${iso}")" | \ + bc + )" + md5["${arch}"]="$( + grep "\s${iso##*/}\$" "${mirror_dir}/archisos/md5sums" | \ + awk '{print $1}' + )" + sha512["${arch}"]="$( + grep "\s${iso##*/}\$" "${mirror_dir}/archisos/sha512sums" | \ + awk '{print $1}' + )" + sign_keys="$( + printf '%s\n' ${sign_keys} $( + gpg --status-fd=1 --verify "${iso}.sig" "${iso}" 2> /dev/null | \ + grep '^\[GNUPG:] VALIDSIG [0-9A-F]\+ ' | \ + cut -d' ' -f3 + ) | \ + sort -u + )" +done + +if [ $(echo "${kernels}" | grep -c '\S') -ne 1 ]; then + >&2 echo 'Not exactly one kernel on the iso:' + >&2 echo "${kernels}" + exit 1 +fi + +if [ $(echo "${sign_keys}" | grep -c '\S') -ne 1 ]; then + >&2 echo 'Not exactly one key used for signing the iso:' + >&2 echo "'${sign_keys}'" + exit 1 +fi + +if [ "${sign_keys}" != 'F2955C3B63EE4E421F30670A3B08EFC6BA974CFC' ] && + [ "${sign_keys}" != '248BF41F9BDD61D41D060AE774EDA3C6B06D0506' ] && + [ "${sign_keys}" != 'DE9F7688CACF04FEB81A6C590AEEC90755DA7B5A' ]; then + >&2 echo "Unknown signing key '${sign_keys}'." + exit 1 +fi + +values=( + 'Current Release' "${latest_iso_date}" + 'Included Kernel' "${kernels}" + 'PGP Key' '<a href="http://pgp.mit.edu/pks/lookup?search=0x'"${sign_keys}"'\&op=index">'"${sign_keys}"'</a>' +) +for arch in 'i686' 'dual'; do + values+=( + "ISO Size (${desc["${arch}"]})" "${sizes["${arch}"]} MB" + "MD5 (${desc["${arch}"]})" "${md5["${arch}"]}" + "SHA512 (${desc["${arch}"]})" "${sha512["${arch}"]}" + ) +done + +sed -i "$( + printf '/%s:/s|</strong>.*</li>|</strong> %s</li>|\n' "${values[@]}" + printf '/archlinux-[0-9.]\+-%s\.iso\.sig/s@archlinux-[0-9.]\+-%s\.iso\.sig@archlinux-%s-%s.iso.sig@\n' \ + 'i686' 'i686' "${latest_iso_date}" 'i686' \ + 'dual' 'dual' "${latest_iso_date}" 'dual' +) +" \ + "${website_dir}/download/index.html" |