Debian Codegraph @

contrib/testingcds

raw
1 #!/bin/bash
2 #
3 # testingcds (c) 2005 Santiago Garcia Mantinan <[email protected]>
4 #
5 # Updates since then by:
6 # Joey Hess <[email protected]>
7 # Steve McIntyre <[email protected]>
8 #
9 # GPL v2
10 #
11 # See cronjob.weekly and cronjob.daily for examples of how to call this script
12
13 #set -x
14
15 if [ "$CONF"x = ""x ] ; then
16 CONF=~/build.${CODENAME}/CONF.sh
17 fi
18 export CF=$CONF
19
20 if [ "$DCD_DIR"x = ""x ] ; then
21 DCD_DIR=~/build.${CODENAME}/debian-cd
22 fi
23
24 now () {
25 date -u +%F:%H:%M:%S
26 }
27
28 # Set up and cleaning
29 if [ $# -lt 1 ] ; then
30 echo $0 \$ARCH
31 echo "variables: PUBDIR[ISO|JIG]"
32 exit 1
33 fi
34
35 if [ ! "$DATE_BUILD" ] ; then
36 DATE_BUILD=`/bin/date -u +%Y%m%d`
37 fi
38
39 export ARCH="$1"
40 NUM_ARCHES=`echo $ARCH | wc -w`
41
42 if [ ! "$JIGDOFALLBACKURLS" ] ; then
43 export JIGDOFALLBACKURLS="Debian=http://us.cdimage.debian.org/cdimage/snapshot/Debian/"
44 fi
45
46 # $DI is used to set DI_CODENAME and also to specify the directory for images
47 if [ "$DI" ] ; then
48 export DI_CODENAME="$DI"
49 fi
50
51 export LOG="`pwd`/log/"
52 if [ "$NUM_ARCHES"x = "1"x ] ; then
53 export OUTARCH=$ARCH
54 else
55 export OUTARCH="multi-arch"
56 fi
57 export RUN="$INSTALLER_CD$DI$OUTARCH$LOGAPPEND"
58 export LOGFILE="$LOG/$RUN"
59
60 case "$INSTALLER_CD" in
61 1)
62 export DISKTYPE=BC;;
63 2|7|8|C|F|G|H)
64 export DISKTYPE=NETINST;;
65 3|6|I|J)
66 export OUT_TYPE=dvd
67 export DISKTYPE=DVD;;
68 4)
69 export DISKTYPE=kde-CD;;
70 5)
71 export DISKTYPE=xfce-CD;;
72 A)
73 export DISKTYPE=lxde-CD;;
74 B)
75 export DISKTYPE=xfce+lxde-CD;;
76 9|K|L)
77 export OUT_TYPE=bd
78 export DISKTYPE=BD;;
79 D)
80 export OUT_TYPE=dlbd
81 export DISKTYPE=DLBD;;
82 E)
83 export DISKTYPE=gnome-CD;;
84 M|N)
85 export OUT_TYPE=16G
86 export DISKTYPE=STICK16GB;;
87 *) export DISKTYPE=CD;;
88 esac
89
90 if [ "$DEBIAN_EDU"x = "1"x ] ; then
91 # Different logo for the debian-edu images
92 export LOGOPNG="$DCD_DIR/data/$DI_CODENAME/debian-edu-installer-logo.png"
93 export SPLASHPNG="$DCD_DIR/data/$DI_CODENAME/splash-skolelinux.png"
94 fi
95
96 if [ "$OUT_TYPE"x = ""x ] ; then
97 OUT_TYPE=cd
98 fi
99
100 export IMAGETARGET=official_images
101 cd $DCD_DIR && . $CONF
102
103 if [ "$OUT"x = ""x ] ; then
104 echo Config error
105 exit 1
106 fi
107
108 if [ "$BUILDNAME"x = ""x ] ; then
109 BUILDNAME="$OUT_TYPE"
110 fi
111
112 TRACEFILE="$PUBDIRJIG/$OUTARCH/$BUILD.trace"
113 #printf " %s: Making %s %s (%s) in $OUT\n using config from %s\n no config in %s\n" \
114 # "$BUILD" "$ARCH" "$DISKTYPE" "$BUILDNAME" \
115 # "$CONFIG_USED" "$CONFIG_UNUSED"
116 printf "%s%s: Making %s %s (%s) in $OUT\n" \
117 "$SHOW_BUILDS" "$BUILD" "$ARCH" "$DISKTYPE" "$BUILDNAME"
118
119 if [ "$INSTALLER_CD" = "1" ] ; then
120 export OFFICIAL="Official BusinessCard Snapshot"
121 elif [ "$INSTALLER_CD" = "2" ] ; then
122 export OFFICIAL="Official NetInst Snapshot"
123 elif [ "$INSTALLER_CD" = "4" ]; then
124 export OFFICIAL="Official KDE CD Snapshot"
125 elif [ "$INSTALLER_CD" = "5" ]; then
126 export OFFICIAL="Official Xfce CD Snapshot"
127 elif [ "$INSTALLER_CD" = "A" ]; then
128 export OFFICIAL="Official LXDE CD Snapshot"
129 elif [ "$INSTALLER_CD" = "B" ]; then
130 export OFFICIAL="Official Xfce/LXDE CD Snapshot"
131 elif [ "$INSTALLER_CD" = "6" ]; then
132 export OFFICIAL="Official Multi-Arch DVD"
133 elif [ "$INSTALLER_CD" = "7" ]; then
134 export OFFICIAL="Official Multi-Arch Netinst"
135 elif [ "$INSTALLER_CD" = "8" ]; then
136 export OFFICIAL="Official Multi-Arch Netinst"
137
138 elif [ "$INSTALLER_CD" = "E" ]; then
139 export OFFICIAL="Official Gnome CD Snapshot"
140 elif [ "$INSTALLER_CD" = "F" ]; then
141 export OFFICIAL="Official Mac Netinst"
142 elif [ "$INSTALLER_CD" = "G" ]; then
143 export OFFICIAL="Official Debian-Edu Netinst"
144
145 elif [ "$INSTALLER_CD" = "K" ]; then
146 export OFFICIAL="Debian-Edu Full USB image"
147
148 elif [ "$INSTALLER_CD" = "M" ]; then
149 export OFFICIAL="Official 16G USB image"
150 fi
151
152 rm -rf "$OUT"
153 mkdir -p "$OUT"
154 rm -f $TRACEFILE
155 #mkdir -p "$LOG"
156
157 overview_log="$LOG/overview"
158 overview () {
159 LOCK=$overview_log.LOCK
160 lockfile -l 900 -1 -r-1 $LOCK
161 if [ -e $overview_log ]; then
162 grep -v " $1 " $overview_log > $overview_log.new
163 mv $overview_log.new $overview_log
164 fi
165 LANG=C echo "$(dpkg --print-architecture) ($(date)) $(whoami)@$(hostname | cut -d . -f 1) $1 $2" >> $overview_log
166 rm -f $LOCK
167 }
168
169 > $LOGFILE
170
171 # Make sure we have an extension for all builds, so we don't have
172 # multiple processes tripping over each other when generating checksum
173 # files
174 if [ "$INSTALLER_CD" = ""x ] ; then
175 SUMS_EXTENSION=".cd"
176 else
177 SUMS_EXTENSION=".${INSTALLER_CD}"
178 fi
179
180 if [ "${DI}" = "sid" ] ; then
181 ARCHDIR=$OUT_FREE_SID/$OUTARCH
182 else
183 ARCHDIR=$OUT_FREE_TST/$OUTARCH
184 fi
185
186 # Do the actual building
187 START=`now`
188 if ./build.sh "$ARCH" >>"$LOGFILE" 2>&1 ; then
189 # if it went ok get things ready for publishing
190 # we treat the daily netinst images in a different way
191 if [ "$DISKTYPE" = "NETINST" ] || \
192 [ "$DISKTYPE" = "BC" ] ; then
193
194 ##################################
195 # NETINST STUFF
196 ##################################
197
198 mkdir -p $ARCHDIR/list-cd $ARCHDIR/jigdo-cd $ARCHDIR/iso-cd
199 # put the isos and jigdos in their place
200
201 for i in "$OUT"/*-1.iso; do
202 BASE=`basename $i .iso`
203 NETINSTNAME=`echo $BASE | sed 's/-BC-1/-businesscard/g;s/-NETINST-1/-netinst/g'`
204 mv $OUT/$BASE.iso $ARCHDIR/iso-cd/$NETINSTNAME.iso
205 cat $OUT/$BASE.jigdo | \
206 sed 's/-BC-1/-businesscard/g;s/-NETINST-1/-netinst/g' | \
207 gzip --best --no-name > $ARCHDIR/jigdo-cd/$NETINSTNAME.jigdo
208 rm $OUT/$BASE.jigdo
209 mv $OUT/$BASE.template $ARCHDIR/jigdo-cd/$NETINSTNAME.template
210 # Make sure that the ISO is as new/newer than the jigdo file; #587774
211 touch $ARCHDIR/iso-cd/$NETINSTNAME.iso
212 mv $OUT/$BASE.list.gz $ARCHDIR/list-cd/$NETINSTNAME.list.gz
213 done
214 rm -f "$OUT"/*
215 END=`now`
216 mkdir -p "$PUBDIRJIG"/$OUTARCH
217 echo -e "start=$START\nend=$END\nerror=0\nlogfile=$RUN\n" > $TRACEFILE
218
219 else
220
221 #######################################
222 # NORMAL STUFF - full builds (weekly)
223 #######################################
224
225 # finish up the jigdos (compress & move them)
226 gzip --best --no-name "$OUT"/*.jigdo
227 for i in "$OUT"/*.jigdo.gz; do
228 mv $i ${i%.gz}
229 done
230
231 # Make sure that the ISOs are as new/newer than the jigdo files; #587774
232 for file in "$OUT"/*.iso; do
233 if [ -e $file ] ; then
234 touch $file
235 fi
236 done
237
238 mkdir -p $ARCHDIR/jigdo-${OUT_TYPE}
239 mv "$OUT"/*.template $ARCHDIR/jigdo-${OUT_TYPE}
240 mv "$OUT"/*.jigdo $ARCHDIR/jigdo-${OUT_TYPE}
241
242 mkdir -p $ARCHDIR/iso-${OUT_TYPE}
243 for file in "$OUT"/*.iso; do
244 if [ -e $file ] ; then
245 mv $file $ARCHDIR/iso-${OUT_TYPE}
246 fi
247 done
248
249 mkdir -p $ARCHDIR/list-${OUT_TYPE}
250 mv "$OUT"/*list*gz $ARCHDIR/list-${OUT_TYPE}
251
252 END=`now`
253 echo -e "start=$START\nend=$END\nerror=0\nlogfile=$RUN\n" > $TRACEFILE
254 fi
255
256 touch $TDIR/$CODENAME/1.pkgs_extracted # so we don't get errors below
257 for file in `cat $TDIR/$CODENAME/*.pkgs_extracted | sort | uniq`; do
258 basefile=`basename $file`
259 if [ ! -e $EXTRACTED_SOURCES/$file ] ; then
260 cp -a $MIRROR/$file $EXTRACTED_SOURCES
261 fi
262 done
263
264 # Mail the sizes of the images
265 if [ -e "../.debian-cd.mail" ] ; then
266 MYEMAIL=`grep -v "^#" "../.debian-cd.mail"`
267 else
268 MYEMAIL=`whoami`
269 fi
270
271 for i in $MYEMAIL
272 do
273 grep -e "extents written" -e "Written to medi." "$LOGFILE"|mail -s "$RELEASE_BUILD testingcds $RUN ($OUTARCH $BUILDNAME) went ok" "$i"
274 done
275 overview "$RUN" success
276
277 else
278 # Run failed
279 if [ -e "../.debian-cd.mail" ] ; then
280 MYEMAIL=`grep -v "^#" "../.debian-cd.mail"`
281 else
282 MYEMAIL=`whoami`
283 fi
284 for i in $MYEMAIL
285 do
286 (echo Error when trying to create cds for $RUN ; cat $LOGFILE) | \
287 mail -s "$RELEASE_BUILD testingcds $RUN ($OUTARCH $BUILDNAME) has failed; log included" "$i"
288 done
289 overview "$RUN" failed
290 END=`now`
291 mkdir -p "$PUBDIRJIG"/$OUTARCH
292 echo -e "start=$START\nend=$END\nerror=1\nlogfile=$RUN\n" > $TRACEFILE
293 exit 1
294 fi