Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/build-isos
blob: 480d9e0e9d091f99df30694a87b25a01832c5a6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash

# to be executed on nlopc43 ... sry for all the hard-coded stuff

set -e

archive='/mnt/archlinux32archive'
destination='/mnt/archlinux32/archisos'
base_dir=$(
  readlink -e "${0%/*}"
)

case "$(hostname -s)" in
  'nlopc43')
    echo 'build isos on nlopc46 ...'
    rsync "$0" nlopc46.ioq.uni-jena.de:/tmp/
    isos=$(
      ssh nlopc46.ioq.uni-jena.de "/tmp/${0##*/}"
    )
    echo '... done.'

    if [ -z "${isos}" ]; then
      echo 'no isos were built!?'
      exit 1
    fi

    echo 'sign and upload isos ...'

    tmp_dir=$(mktemp -d)
    trap 'cd "${base_dir}"; rm -rf --one-file-system "${tmp_dir}"' EXIT

    rsync -av $(printf 'nlopc46.ioq.uni-jena.de:%s\n' ${isos}) "${tmp_dir}/"

    isos=$(
      printf '%s\n' "${isos}" | \
        sed 's,^.*/,,'
    )

    cd "${tmp_dir}"
    cp "${destination}/sha512sums" .
    cp "${destination}/md5sums" .

    date=$(
      printf '%s\n' "${isos}" \
      | sed 's/^.*-\([^-]\+\)-[^-]\+$/\1/' \
      | sort -u
    )

    for iso in ${isos}; do
      gpg --local-user '33CA3597B0D161AAE4173F65C17F1214114574A4' --batch --no-tty --detach-sign "${iso}" </dev/null
    done
    sha512sum ${isos} >> sha512sums
    md5sum ${isos} >> md5sums
    sort -k2,2 sha512sums --output sha512sums
    sort -k2,2 md5sums --output md5sums

    cp $(
      printf '%s\n' ${isos}
      printf '%s.sig\n' ${isos}
    ) sha512sums md5sums "${destination}/"

    date +%s > "${destination%/*}/lastupdate"

    "${base_dir}/al32-mktorrent.sh" -d "${date}" -t "hefur@archlinux32:"

    mv $(
      printf '%s.torrent\n' ${isos}
    ) feed_dual.rss feed_i686.rss "${destination}/"

    git -C "${base_dir}/../archweb32" pull --ff-only
    "${base_dir}/update-website" \
      --torrent-seed-i686 "https://pool.mirror.archlinux32.org/archisos/archlinux-${date}-i686.iso.torrent" \
      --torrent-seed-dual "https://pool.mirror.archlinux32.org/archisos/archlinux-${date}-dual.iso.torrent" \
      --update-iso
    git -C "${base_dir}/../archweb32" commit 'download/index.html' -m 'download/index.html: new isos ('"${date}"')'
    git -C "${base_dir}/../archweb32" push

    find "${destination}" -name 'archlinux-*' -not -name 'archlinux-'"${date}"'-*' \
    | while read -r to_delete; do
      if diff -q "${to_delete}" "${archive}/iso/${to_delete#${destination}/}" >/dev/null; then
        rm "${to_delete}"
        printf '%s\n' "${to_delete}" \
        | sed '
          s@^.*/@@
          s/\./\\./g
          s@.*@/  \0$/d@
        '
      fi
    done \
    >> "${tmp_dir}/delete-regex"
    sed -i -f "${tmp_dir}/delete-regex" "${destination}/sha512sums"
    sed -i -f "${tmp_dir}/delete-regex" "${destination}/md5sums"

    echo '... done.'
    ;;
  'nlopc46')
    if [ "$(whoami)" = 'root' ]; then
      cd "/usr/share/archiso/configs/$1"
      rm --one-file-system -rf out work
      mkdir out work
      ./build.sh
      chown "${SUDO_USER}:users" out/archlinux-*.iso
      mv out/archlinux-*.iso "$2/"
      exit
    fi

    rm -rf --one-file-system ~/archisos
    mkdir ~/archisos

    >&2 echo 'build i686-iso ...'

    >&2 sudo "$0" releng32 ~/archisos/

    >&2 echo '... done.'

    >&2 echo 'build dual-iso ...'

    >&2 sudo "$0" releng-dual ~/archisos/

    >&2 echo '... done.'
    
    find ~/archisos/ -type f
  ;;
  *)
    >&2 echo 'execute on nlopc43 (or nlopc46) - sry'
    exit 1
  ;;
esac