3
# testingcds (c) 2005 Santiago Garcia Mantinan <manty@manty.net>
7
# This file is included here just as an example, it was used when building the
8
# official testing cds at some point, it was written for a very specific setup
9
# and then went over a lot of changes during its life, so now this code is
10
# horrible, hoever some fellows feel it should be included in debian-cd,
11
# well, I (manty) will leave that on their hands.
13
# The setup we have uses normal debian-cd for daily builds, while it uses a jte
14
# patched debian-cd for weekly builds, this is done just for speed, the script
15
# should work with normal debian-cd for all kind of builds just removing -jte
16
# down there. We are currently just building isos for dailies and jigdos for
17
# weeklies, no snapshots being generated on the build machine, so I cannot
18
# waranty that all the code down here works, again, I must stress that you
19
# should take this just as an example, because part of it is untested and
20
# the rest is written for a very very specific setup, so... no waranties at all
22
# This is how this script is called for the daily images:
23
# OMIT_MANUAL=1 NORECOMMENDS=1 NOSUGGESTS=1 COMPLETE=0 INSTALLER_CD=1 TASK=tasks/debian-installer-sarge DOJIGDO=0 DI=sarge DI_DIST=sarge ./testingcds "$arch"
24
# OMIT_MANUAL=1 NORECOMMENDS=1 NOSUGGESTS=1 COMPLETE=0 INSTALLER_CD=2 TASK=tasks/debian-installer+kernel-sarge DOJIGDO=0 DI=sarge DI_DIST=sarge ./testingcds "$arch"
25
# OMIT_MANUAL=1 NORECOMMENDS=1 NOSUGGESTS=1 COMPLETE=0 INSTALLER_CD=1 TASK=tasks/debian-installer-sid DOJIGDO=0 DI=sid DI_WWW_HOME=default DI_DIR="$ARCH_DI_DIR" ./testingcds "$arch"
26
# OMIT_MANUAL=1 NORECOMMENDS=1 NOSUGGESTS=1 COMPLETE=0 INSTALLER_CD=2 TASK=tasks/debian-installer+kernel-sid DOJIGDO=0 DI=sid DI_WWW_HOME=default DI_DIR="$ARCH_DI_DIR" ./testingcds "$arch"
27
# This is respectively for sarge_d-i businesscards, sarge_d-i netinsts,
28
# sid_d-i businesscards, and sid_d-i netinsts.
29
# Where $ARCH_DI_DIR is set to the path for the local mirror of the d-i daily
30
# built images, this parameter can be omited if no mirror of the images is used
32
# For the weekly images it is run for normal cds like this:
33
# DI_DIST=sarge ./testingcds "$arch"
34
# and for the dvds like this:
35
# PUBDIRJIG=/path_to_the/dvd INSTALLER_CD=3 DEFBINSIZE=4440 DEFSRCSIZE=4432 DI_DIST=sarge ./testingcds "$arch"
42
echo "variables: PUBDIR[ISO|JIG]"
46
if [ ! "$DATE" ];then DATE=`/bin/date -u +%Y%m%d`;fi
49
export PATH=$PATH:/sbin:/usr/sbin
50
if [ ! "$PUBDIRJIG" ];then PUBDIRJIG=/org/cdimage.debian.org/www/testing/cd;fi
51
if [ ! "$PUBDIRISO" ];then PUBDIRISO=/org/cdimage.debian.org/www/testing;fi
52
if [ ! "$JIGDOFALLBACKURLS" ];then
53
if [ "$ARCH" = "amd64" ];then
54
export JIGDOFALLBACKURLS="Debian=http://amd64-cdsnap.debian.net/cdimage/snapshot-amd64/Debian/"
56
export JIGDOFALLBACKURLS="Debian=http://us.cdimage.debian.org/cdimage/snapshot/Debian/"
59
# $DI is used to set DI_CODENAME and also to specify the directory for images
61
export DI_CODENAME="$DI"
62
PUBDIRJIG="$PUBDIRJIG"/"$DI"_d-i
63
PUBDIRISO="$PUBDIRISO"/"$DI"_d-i
66
CALC="Using previous sizes estimations."
67
if [ "$INSTALLER_CD" = "1" -o "$INSTALLER_CD" = "2" ]
69
# Do a tradicional build for the ISOs of the small cds
70
cd /org/cdimage.debian.org/setup/debian-cd &&
72
# this is for build.sh
74
export IMAGETARGET=bin-official_images
76
export SKIPMIRRORCHECK=yes
78
# Do the size stimation and a JTE build for jigdos
79
cd /org/cdimage.debian.org/setup/debian-cd-jte &&
81
export IMAGETARGET="ok bootable upgrade bin-infos bin-list" &&
82
export CF=../CONF.sh &&
83
./build.sh $ARCH >/dev/null 2>&1 &&
84
cd tools && CALC=`./calc` && cd ..
85
# this is for build.sh
86
if [ "$ARCH" = "i386" ]
88
export IMAGETARGET=official_images
90
export IMAGETARGET=bin-official_images
94
if [ ! "$OUT" ];then echo Error on the config;exit 1;fi
96
if [ "$INSTALLER_CD" = "1" ];then export OFFICIAL="Official BusinessCard Snapshot";fi
97
if [ "$INSTALLER_CD" = "2" ];then export OFFICIAL="Official NetInst Snapshot";fi
99
export LOG="`pwd`/../log/"
105
overview_log="$LOG/overview"
107
if [ -e $overview_log ]; then
108
grep -v " $1 " $overview_log > $overview_log.new
109
mv $overview_log.new $overview_log
111
LANG=C echo "$(dpkg --print-architecture) ($(date)) $(whoami)@$(hostname | cut -d . -f 1) $1 $2" >> $overview_log
114
# Upgrade sarge's debian-installer task file
115
# changed this old line into the new one so that amd64 doesn't break
116
# cd tasks && ../tools/generate_di_list && ../tools/generate_di+k_list && cd .. || exit 1
117
cd tasks && ../tools/generate_di_list ; ../tools/generate_di+k_list ; cd ..
118
DEBOOTUDEB=`/bin/sed -n \
119
's/Filename: \(pool\/main\/d\/debootstrap\/debootstrap-udeb.*udeb\)$/\1/p' \
120
$MIRROR/dists/$DI_CODENAME/main/debian-installer/binary-$ARCH/Packages`
121
if [ -z "$DEBOOTUDEB" ];then exit 1;fi
122
echo "$CALC" >"$LOG/$INSTALLER_CD$DI$ARCH"
123
echo Using ${DEBOOTUDEB##*/} to get packages used by d-i. >>"$LOG/$INSTALLER_CD$DI$ARCH"
124
rm -rf ../debootstrap
125
dpkg -x "$MIRROR/$DEBOOTUDEB" ../debootstrap
127
# Do the actual building
128
if ./build.sh $ARCH >>"$LOG/$INSTALLER_CD$DI$ARCH" 2>&1;then
130
# if it went ok get things ready for publishing
132
# we treat the netinst images in a different way
134
if [ "$INSTALLER_CD" = "1" -o "$INSTALLER_CD" = "2" ]
137
# NETINST STUFF (ISO ONLY)
139
# make the dirs we'll use to publish things
140
mkdir -p "$OUT"/$ARCH
141
# rename the isos from .raw to .iso and put them in their place
142
for i in "$OUT"/*-1.raw
145
if [ "$INSTALLER_CD" = "1" ];then
146
NETINSTNAME=${I%-binary-1.raw}-businesscard.iso
148
NETINSTNAME=${I%-binary-1.raw}-netinst.iso
150
mv $i "$OUT"/$ARCH/$NETINSTNAME
152
# change images names from raw to iso on the MD5SUMS
153
sed "s/[^ ]*-1.raw$/$NETINSTNAME/" "$OUT"/MD5SUMS >>"$OUT"/$ARCH/MD5SUMS
154
# Publish the new version
155
mkdir -p "$PUBDIRISO"/$ARCH/$DATE
156
if [ -e "$PUBDIRISO"/$ARCH/$DATE/MD5SUMS ];then
157
grep -v $NETINSTNAME "$PUBDIRISO"/$ARCH/$DATE/MD5SUMS > "$PUBDIRISO"/$ARCH/$DATE/MD5SUMS.tmp
159
cat "$OUT"/$ARCH/MD5SUMS >> "$PUBDIRISO"/$ARCH/$DATE/MD5SUMS.tmp
160
mv "$PUBDIRISO"/$ARCH/$DATE/MD5SUMS.tmp "$PUBDIRISO"/$ARCH/$DATE/MD5SUMS
161
mv "$OUT"/$ARCH/$NETINSTNAME "$PUBDIRISO"/$ARCH/$DATE/
162
rm -f "$PUBDIRISO"/$ARCH/current
163
ln -s $DATE "$PUBDIRISO"/$ARCH/current
164
# Remove the oldest daily builds, leave only the last 3
165
NUM=`/bin/ls -d "$PUBDIRISO"/$ARCH/20*/|wc -l`
167
/bin/ls -d "$PUBDIRISO"/$ARCH/20*/|head -n $NUM|tr '\012' '\000'|xargs -0 /bin/rm -rf --
171
# NORMAL STUFF, IE NORMAL ISO and JIGDO
175
if [ "$DOJIGDO" != 2 ]
177
# make the dirs we'll use to publish things
178
mkdir -p "$OUT"/isos/$ARCH
179
# rename the isos from .raw to .iso and put them in their place
180
for i in "$OUT"/*.raw
183
mv $i "$OUT"/isos/$ARCH/${I%.raw}.iso
185
# change images names from raw to iso on the MD5SUMS
186
sed 's/raw$/iso/' "$OUT"/MD5SUMS >"$OUT"/isos/$ARCH/MD5SUMS
187
# Remove the old version and publish the new one
188
rm -rf "$PUBDIRISO"/isos/$ARCH/
189
mkdir -p "$PUBDIRISO"/isos/
190
mv "$OUT"/isos/$ARCH/ "$PUBDIRISO"/isos/$ARCH/
195
if [ "$DOJIGDO" != 0 ]
197
# make the dirs we'll use to publish things
198
mkdir -p "$OUT"/jigdo-area/$ARCH/jigdotemplates
199
# change images names from raw to iso on the MD5SUMS
200
sed 's/raw$/iso/' "$OUT"/MD5SUMS >"$OUT"/jigdo-area/$ARCH/MD5SUMS
201
# put the templates aside
202
mv "$OUT"/*.template "$OUT"/jigdo-area/$ARCH/jigdotemplates
203
# finish up the jigdos (compress & move them)
204
gzip --best --no-name "$OUT"/*.jigdo
205
for i in "$OUT"/*.jigdo.gz;do mv $i ${i%.gz};done
206
mv "$OUT"/*.jigdo "$OUT"/jigdo-area/$ARCH/
207
# Remove the old version and publish the new one
208
if [ "$IMAGETARGET" = "official_images" ]
210
rm -rf "$PUBDIRJIG"/jigdo-area/source/
211
mkdir -p "$PUBDIRJIG"/jigdo-area/source/jigdotemplates/
212
mv "$OUT"/jigdo-area/$ARCH/*-source-*.jigdo "$PUBDIRJIG"/jigdo-area/source/
213
grep "source-.*.iso$" "$OUT"/jigdo-area/$ARCH/MD5SUMS > "$PUBDIRJIG"/jigdo-area/source/MD5SUMS
214
mv "$OUT"/jigdo-area/$ARCH/jigdotemplates/*-source-*.template "$PUBDIRJIG"/jigdo-area/source/jigdotemplates/
215
grep -v "source-.*.iso$" "$OUT"/jigdo-area/$ARCH/MD5SUMS > "$OUT"/jigdo-area/$ARCH/MD5SUMS.new
216
mv "$OUT"/jigdo-area/$ARCH/MD5SUMS.new "$OUT"/jigdo-area/$ARCH/MD5SUMS
218
rm -rf "$PUBDIRJIG"/jigdo-area/$ARCH/
219
mkdir -p "$PUBDIRJIG"/jigdo-area/
220
mv "$OUT"/jigdo-area/$ARCH/ "$PUBDIRJIG"/jigdo-area/$ARCH/
221
# Calculate snapshot path, remove the old snapshot and publish the new one
222
# SNAP=${JIGDOFALLBACKURLS##Debian=http://us.cdimage.debian.org/cdimage/}
223
# SNAP=${PUBDIRJIG%%testing*}${SNAP%%/Debian*}
225
# mv "$OUT"/snapshot/* "$SNAP"
226
# Remove the oldest snapshots, leave only the last 2
227
# NUM=`/bin/ls -d "${SNAP%%/$DATE}"/20*/|wc -l`
229
# /bin/ls -d "${SNAP%%/$DATE}"/20*/|head -n $NUM|tr '\012' '\000'|xargs -0 /bin/rm -rf --
234
# Mail the cd sizes of the cds
235
if [ -e "../.debian-cd.mail" ]
237
MYEMAIL=`grep -v "^#" "../.debian-cd.mail"`
243
grep "extents written" "$LOG/$INSTALLER_CD$DI$ARCH"|mail -s "testingcds $INSTALLER_CD$DI$ARCH went ok" "$i"
245
overview "$INSTALLER_CD$DI$ARCH" success
247
if [ -e "../.debian-cd.mail" ]
249
MYEMAIL=`grep -v "^#" "../.debian-cd.mail"`
255
echo Error when trying to create cds for $INSTALLER_CD$DI$ARCH|mail -s "testingcds $INSTALLER_CD$DI$ARCH has failed" "$i"
257
overview "$INSTALLER_CD$DI$ARCH" failed