File: testingcds

package info (click to toggle)
debian-cd 3.1.5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,532 kB
  • ctags: 138
  • sloc: sh: 6,174; perl: 2,352; makefile: 349
file content (268 lines) | stat: -rw-r--r-- 8,034 bytes parent folder | download
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#!/bin/bash
#
# testingcds (c) 2005 Santiago Garcia Mantinan <manty@manty.net>
#
# Updates since then by:
# Joey Hess <joey@kitenet.net>
# Steve McIntyre <steve@einval.com>
#
# GPL v2
#
# See cronjob.weekly and cronjob.daily for examples of how to call this script

#set -x

if [ "$CONF"x = ""x ] ; then
    CONF=~/build/CONF.sh
fi
export CF=$CONF

now () {
    date -u +%F:%H:%M:%S
}

# Set up and cleaning
if [ $# -lt 1 ] ; then
    echo $0 \$ARCH
    echo "variables: PUBDIR[ISO|JIG]"
    exit 1
fi

if [ ! "$DATE_BUILD" ] ; then
    DATE_BUILD=`/bin/date -u +%Y%m%d`
fi

export ARCH="$1"
NUM_ARCHES=`echo $ARCH | wc -w`

if [ ! "$JIGDOFALLBACKURLS" ] ; then
   export JIGDOFALLBACKURLS="Debian=http://us.cdimage.debian.org/cdimage/snapshot/Debian/"
fi

# $DI is used to set DI_CODENAME and also to specify the directory for images
if [ "$DI" ] ; then
    export DI_CODENAME="$DI"
fi

export LOG="`pwd`/log/"
if [ "$NUM_ARCHES"x = "1"x ] ; then
    export OUTARCH=$ARCH
else
    export OUTARCH="multi-arch"
fi
export RUN="$INSTALLER_CD$DI$OUTARCH$LOGAPPEND"
export LOGFILE="$LOG/$RUN"

case "$INSTALLER_CD" in
    1)
        export DISKTYPE=BC;;
    2|7|8|C)
        export DISKTYPE=NETINST;;
    3|6)
        export OUT_TYPE=dvd
        export DISKTYPE=DVD;;
    4)
        export DISKTYPE=kde-CD;;
    5)
        export DISKTYPE=xfce-CD;;
    A)
        export DISKTYPE=lxde-CD;;
    B)
        export DISKTYPE=xfce+lxde-CD;;
    9)
        export OUT_TYPE=bd
        export DISKTYPE=BD;;
    *)  export DISKTYPE=CD;;
esac

if [ "$OUT_TYPE"x = ""x ] ; then
    OUT_TYPE=cd
fi

export IMAGETARGET=official_images
cd debian-cd && . $CONF

if [ "$OUT"x = ""x ] ; then
    echo Config error
    exit 1
fi

if [ "$BUILDNAME"x = ""x ] ; then
    TRACEFILE="$OUT_TYPE-trace"
    echo "  Making $ARCH ${DISKTYPE} in $OUT"
else
    TRACEFILE="$BUILDNAME-trace"
    echo "  Making $ARCH ${DISKTYPE} (${BUILDNAME}) in $OUT"
fi

if [ "$INSTALLER_CD" = "1" ] ; then
    export OFFICIAL="Official BusinessCard Snapshot"
elif [ "$INSTALLER_CD" = "2" ] ; then
    export OFFICIAL="Official NetInst Snapshot"
elif [ "$INSTALLER_CD" = "4" ]; then
    export OFFICIAL="Official KDE CD Snapshot"
elif [ "$INSTALLER_CD" = "5" ]; then
    export OFFICIAL="Official Xfce CD Snapshot"
elif [ "$INSTALLER_CD" = "A" ]; then
    export OFFICIAL="Official LXDE CD Snapshot"
elif [ "$INSTALLER_CD" = "B" ]; then
    export OFFICIAL="Official Xfce/LXDE CD Snapshot"
elif [ "$INSTALLER_CD" = "6" ]; then
    export OFFICIAL="Official Multi-Arch DVD"
elif [ "$INSTALLER_CD" = "7" ]; then
    export OFFICIAL="Official Multi-Arch Netinst"
elif [ "$INSTALLER_CD" = "8" ]; then
    export OFFICIAL="Official Multi-Arch Netinst"
elif [ "$INSTALLER_CD" = "C" ]; then
    export OFFICIAL="Unofficial Netinst including firmware"
fi

rm -rf "$OUT"
mkdir -p "$OUT"
rm -f "$PUBDIRJIG"/$OUTARCH/$TRACEFILE
#mkdir -p "$LOG"

overview_log="$LOG/overview"
overview () {
    if [ -e $overview_log ]; then
    	grep -v " $1 " $overview_log > $overview_log.new
        mv $overview_log.new $overview_log
    fi
    LANG=C echo "$(dpkg --print-architecture) ($(date)) $(whoami)@$(hostname | cut -d . -f 1) $1 $2" >> $overview_log
}

> $LOGFILE

# Do the actual building
START=`now`
if ./build.sh "$ARCH" >>"$LOGFILE" 2>&1 ; then
    # if it went ok get things ready for publishing
    # we treat the daily netinst images in a different way
    if [ "$INSTALLER_CD" = "1" -o "$INSTALLER_CD" = "2" ] ; then

        ##################################
        # NETINST STUFF
        ##################################

        ARCHDIR="$PUBDIRJIG"/${DI}_d-i/$DATE_BUILD/$OUTARCH

        # put the isos and jigdos in their place
        for i in "$OUT"/*-1.iso; do
            BASE=`basename $i .iso`
            NETINSTNAME=`echo $BASE | sed 's/-BC-1/-businesscard/g;s/-NETINST-1/-netinst/g'`
            mv $OUT/$BASE.iso $ARCHDIR/iso-cd/$NETINSTNAME.iso
            cat $OUT/$BASE.jigdo | \
                sed 's/-BC-1/-businesscard/g;s/-NETINST-1/-netinst/g' | \
                gzip --best --no-name > $ARCHDIR/jigdo-cd/$NETINSTNAME.jigdo
            rm $OUT/$BASE.jigdo
            mv $OUT/$BASE.template $ARCHDIR/jigdo-cd/$NETINSTNAME.template
            # Make sure that the ISO is as new/newer than the jigdo file; #587774
            touch $ARCHDIR/iso-cd/$NETINSTNAME.iso
        done
        rm -f "$OUT"/*
        END=`now`
        mkdir -p "$PUBDIRJIG"/$OUTARCH
        echo -e "start=$START\nend=$END\nerror=0\n" > "$PUBDIRJIG"/$OUTARCH/$TRACEFILE

    elif [ "$INSTALLER_CD" = "C" ] ; then

        ##################################
        # FIRMWARE NETINST STUFF
        ##################################

        ARCHDIR="$PUBDIRJIG"-firmware/${DI}_d-i/$DATE_BUILD/$OUTARCH

        # put the isos and jigdos in their place
        for i in "$OUT"/*-1.iso; do
            BASE=`basename $i .iso`
            NETINSTNAME=`echo $BASE | sed 's/-BC-1/-businesscard/g;s/-NETINST-1/-netinst/g'`
            mv $OUT/$BASE.iso $ARCHDIR/iso-cd/$NETINSTNAME.iso
            cat $OUT/$BASE.jigdo | \
                sed 's/-BC-1/-businesscard/g;s/-NETINST-1/-netinst/g' | \
                gzip --best --no-name > $ARCHDIR/jigdo-cd/$NETINSTNAME.jigdo
            rm $OUT/$BASE.jigdo
            mv $OUT/$BASE.template $ARCHDIR/jigdo-cd/$NETINSTNAME.template
            # Make sure that the ISO is as new/newer than the jigdo file; #587774
            touch $ARCHDIR/iso-cd/$NETINSTNAME.iso
        done
        rm -f "$OUT"/*
        END=`now`
        mkdir -p "$PUBDIRJIG"/$OUTARCH
        echo -e "start=$START\nend=$END\nerror=0\n" > "$PUBDIRJIG"/$OUTARCH/$TRACEFILE
    else

        #######################################
        # NORMAL STUFF - full builds (weekly)
        #######################################

        # finish up the jigdos (compress & move them)
        gzip --best --no-name "$OUT"/*.jigdo
        for i in "$OUT"/*.jigdo.gz; do
            mv $i ${i%.gz}
        done

        # Make sure that the ISOs are as new/newer than the jigdo files; #587774
	for file in "$OUT"/*.iso; do
	    if [ -e $file ] ; then 
		touch $file
	    fi
        done

        mkdir -p "$PUBDIRJIG"/$OUTARCH/jigdo-${OUT_TYPE}
	for file in "$OUT"/*SUMS${SUMS_EXTENSION}; do
	    outfile="$PUBDIRJIG"/$OUTARCH/jigdo-${OUT_TYPE}/`basename $file`
	    cat $file >> $outfile
	done
        mv "$OUT"/*.template "$PUBDIRJIG"/$OUTARCH/jigdo-${OUT_TYPE}
        mv "$OUT"/*.jigdo    "$PUBDIRJIG"/$OUTARCH/jigdo-${OUT_TYPE}

        mkdir -p "$PUBDIRJIG"/$OUTARCH/iso-${OUT_TYPE}
	for file in "$OUT"/*SUMS${SUMS_EXTENSION}; do
	    outfile="$PUBDIRJIG"/$OUTARCH/iso-${OUT_TYPE}/`basename $file`
	    cat $file >> $outfile
	done
        mv "$OUT"/*.iso    "$PUBDIRJIG"/$OUTARCH/iso-${OUT_TYPE}

        END=`now`
        echo -e "start=$START\nend=$END\nerror=0\n" > "$PUBDIRJIG"/$OUTARCH/$TRACEFILE
    fi

    touch $TDIR/$CODENAME/1.pkgs_extracted # so we don't get errors below
    for file in `cat $TDIR/$CODENAME/*.pkgs_extracted | sort | uniq`; do
        basefile=`basename $file`
        if [ ! -e $EXTRACTED_SOURCES/$file ] ; then
            cp -a  $MIRROR/$file $EXTRACTED_SOURCES
        fi
    done

    # Mail the sizes of the images
    if [ -e "../.debian-cd.mail" ] ; then
        MYEMAIL=`grep -v "^#" "../.debian-cd.mail"`
    else
        MYEMAIL=`whoami`
    fi

    for i in $MYEMAIL
    do
        grep -e "extents written" -e "Written to media" "$LOGFILE"|mail -s "testingcds $RUN went ok" "$i"
    done
    overview "$RUN" success

else
    # Run failed
    if [ -e "../.debian-cd.mail" ] ; then
        MYEMAIL=`grep -v "^#" "../.debian-cd.mail"`
    else
        MYEMAIL=`whoami`
    fi
    for i in $MYEMAIL
    do
        (echo Error when trying to create cds for $RUN ; cat $LOGFILE) | \
            mail -s "testingcds $RUN has failed; log included" "$i"
    done
    overview "$RUN" failed
    END=`now`
    mkdir -p "$PUBDIRJIG"/$OUTARCH
    echo -e "start=$START\nend=$END\nerror=0\n" > "$PUBDIRJIG"/$OUTARCH/$TRACEFILE
    exit 1
fi