~ubuntu-archive/ubuntu-archive-scripts/trunk

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
#! /bin/sh
set -e

amd64="kapok"
i386="cardamom"
powerpc="royal"
arm="kishi00"
arm64="magic"
ppc64el="fisher01"

mkdir -p /home/ubuntu-archive/public_html/livefs-build-logs
cd /home/ubuntu-archive/public_html/livefs-build-logs
find . -type d -name latest -print0 | xargs -r -0 rm -rf
find . -type d -name current -print0 | xargs -r -0 rm -rf

if [ -t 1 ]; then
    VERBOSE=:
else
    VERBOSE=false
fi

mirror () {
    local machine ret
    machine="$1"
    ret=:
    if $VERBOSE; then
        echo "$(date): starting mirror for $machine"
    fi
    wget -q --mirror -np -nH --cut-dirs=2 -A out http://$machine.buildd/~buildd/LiveCD/ \
    || ret=false
    if $VERBOSE; then
        echo -n "$(date): finished mirror for $machine "
        if $ret; then
            echo "(success)"
        else
            echo "(failed)"
        fi
    fi
    $ret
}

for machine in $amd64 $i386 $powerpc $arm $arm64 $ppc64el; do
    mirror "$machine" &
    RES="$RES $!"
done

for proc in $RES; do
    wait $proc && retval=0
done

if [ "$retval" != 0 ]; then
    echo "LiveFS log mirroring had a sad"
fi