~persia/debian-cd/mid.seed-cleanup

« back to all changes in this revision

Viewing changes to contrib/testingcds

  • Committer: Colin Watson
  • Date: 2005-11-06 15:29:16 UTC
  • mfrom: (unknown (missing))
  • Revision ID: Arch-1:colin.watson@canonical.com--2005%debian-cd--ubuntu--0--patch-209
merge from upstream up to patch-787 (Debian 2.2.22)
Patches applied:

 * debian-cd@arch.ubuntu.com/debian-cd--MAIN--0--patch-782
   More fixes for the tasks branching.

 * debian-cd@arch.ubuntu.com/debian-cd--MAIN--0--patch-783
   Fixes for task branching coherency.

 * debian-cd@arch.ubuntu.com/debian-cd--MAIN--0--patch-784
   Allow the usage of a local mirror of the daily d-i buil...

 * debian-cd@arch.ubuntu.com/debian-cd--MAIN--0--patch-785
   Added example "testingcds" script, as used to create th...

 * debian-cd@arch.ubuntu.com/debian-cd--MAIN--0--patch-786
   Updated tasks files to match the latest testing CD/DVD build

 * debian-cd@arch.ubuntu.com/debian-cd--MAIN--0--patch-787
   Ready for version 2.2.22 and a sarge release!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#
 
3
# testingcds (c) 2005 Santiago Garcia Mantinan <manty@manty.net>
 
4
#
 
5
# GPL v2
 
6
#
 
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.
 
12
#
 
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
 
21
#
 
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
 
31
 
 
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"
 
36
 
 
37
 
 
38
# Set up and cleaning
 
39
if [ $# -lt 1 ]
 
40
then
 
41
  echo $0 \$ARCH
 
42
  echo "variables: PUBDIR[ISO|JIG]"
 
43
  exit 1
 
44
fi
 
45
 
 
46
if [ ! "$DATE" ];then DATE=`/bin/date -u +%Y%m%d`;fi
 
47
 
 
48
export ARCH=$1
 
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/"
 
55
   else
 
56
     export JIGDOFALLBACKURLS="Debian=http://us.cdimage.debian.org/cdimage/snapshot/Debian/"
 
57
   fi
 
58
fi
 
59
# $DI is used to set DI_CODENAME and also to specify the directory for images
 
60
if [ "$DI" ];then
 
61
  export DI_CODENAME="$DI"
 
62
  PUBDIRJIG="$PUBDIRJIG"/"$DI"_d-i
 
63
  PUBDIRISO="$PUBDIRISO"/"$DI"_d-i  
 
64
fi
 
65
 
 
66
CALC="Using previous sizes estimations."
 
67
if [ "$INSTALLER_CD" = "1" -o "$INSTALLER_CD" = "2" ]
 
68
then
 
69
  # Do a tradicional build for the ISOs of the small cds
 
70
  cd /org/cdimage.debian.org/setup/debian-cd &&
 
71
    . ../CONF.sh
 
72
    # this is for build.sh
 
73
    export CF=../CONF.sh
 
74
    export IMAGETARGET=bin-official_images
 
75
    # to save some time
 
76
    export SKIPMIRRORCHECK=yes
 
77
else
 
78
  # Do the size stimation and a JTE build for jigdos
 
79
  cd /org/cdimage.debian.org/setup/debian-cd-jte &&
 
80
    . ../CONF.sh &&
 
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" ]
 
87
    then
 
88
      export IMAGETARGET=official_images
 
89
    else
 
90
      export IMAGETARGET=bin-official_images
 
91
    fi
 
92
fi
 
93
 
 
94
if [ ! "$OUT" ];then echo Error on the config;exit 1;fi
 
95
 
 
96
if [ "$INSTALLER_CD" = "1" ];then export OFFICIAL="Official BusinessCard Snapshot";fi
 
97
if [ "$INSTALLER_CD" = "2" ];then export OFFICIAL="Official NetInst Snapshot";fi
 
98
 
 
99
export LOG="`pwd`/../log/"
 
100
 
 
101
rm -rf "$OUT"
 
102
mkdir -p "$OUT"
 
103
mkdir -p "$LOG"
 
104
 
 
105
overview_log="$LOG/overview"
 
106
overview () {
 
107
    if [ -e $overview_log ]; then
 
108
        grep -v " $1 " $overview_log > $overview_log.new
 
109
        mv $overview_log.new $overview_log
 
110
    fi
 
111
    LANG=C echo "$(dpkg --print-architecture) ($(date)) $(whoami)@$(hostname | cut -d . -f 1) $1 $2" >> $overview_log
 
112
}
 
113
 
 
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
 
126
 
 
127
# Do the actual building
 
128
if ./build.sh $ARCH >>"$LOG/$INSTALLER_CD$DI$ARCH" 2>&1;then
 
129
 
 
130
# if it went ok get things ready for publishing
 
131
 
 
132
# we treat the netinst images in a different way
 
133
 
 
134
if [ "$INSTALLER_CD" = "1" -o "$INSTALLER_CD" = "2" ]
 
135
then
 
136
 
 
137
# NETINST STUFF (ISO ONLY)
 
138
 
 
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
 
143
  do
 
144
    I=${i##*/}
 
145
    if [ "$INSTALLER_CD" = "1" ];then
 
146
      NETINSTNAME=${I%-binary-1.raw}-businesscard.iso
 
147
    else
 
148
      NETINSTNAME=${I%-binary-1.raw}-netinst.iso
 
149
    fi
 
150
    mv $i "$OUT"/$ARCH/$NETINSTNAME
 
151
  done
 
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
 
158
  fi
 
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`
 
166
  NUM=$(($NUM-3))
 
167
  /bin/ls -d "$PUBDIRISO"/$ARCH/20*/|head -n $NUM|tr '\012' '\000'|xargs -0 /bin/rm -rf --
 
168
 
 
169
else 
 
170
 
 
171
# NORMAL STUFF, IE NORMAL ISO and JIGDO
 
172
 
 
173
# ISO STUFF
 
174
 
 
175
if [ "$DOJIGDO" != 2 ]
 
176
then
 
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
 
181
  do
 
182
    I=${i##*/}
 
183
    mv $i "$OUT"/isos/$ARCH/${I%.raw}.iso
 
184
  done
 
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/
 
191
fi
 
192
 
 
193
# JIGDO STUFF
 
194
 
 
195
if [ "$DOJIGDO" != 0 ]
 
196
then
 
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" ]
 
209
  then
 
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
 
217
  fi
 
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*}
 
224
#  mkdir -p "$SNAP"
 
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`
 
228
#  NUM=$(($NUM-2))
 
229
#  /bin/ls -d "${SNAP%%/$DATE}"/20*/|head -n $NUM|tr '\012' '\000'|xargs -0 /bin/rm -rf --
 
230
fi
 
231
 
 
232
fi
 
233
 
 
234
# Mail the cd sizes of the cds
 
235
if [ -e "../.debian-cd.mail" ]
 
236
then
 
237
  MYEMAIL=`grep -v "^#" "../.debian-cd.mail"`
 
238
else
 
239
  MYEMAIL=`whoami`
 
240
fi
 
241
  for i in $MYEMAIL
 
242
  do
 
243
    grep "extents written" "$LOG/$INSTALLER_CD$DI$ARCH"|mail -s "testingcds $INSTALLER_CD$DI$ARCH went ok" "$i"
 
244
  done
 
245
  overview "$INSTALLER_CD$DI$ARCH" success
 
246
else
 
247
if [ -e "../.debian-cd.mail" ]
 
248
then
 
249
  MYEMAIL=`grep -v "^#" "../.debian-cd.mail"`
 
250
else
 
251
  MYEMAIL=`whoami`
 
252
fi
 
253
  for i in $MYEMAIL
 
254
  do
 
255
    echo Error when trying to create cds for $INSTALLER_CD$DI$ARCH|mail -s "testingcds $INSTALLER_CD$DI$ARCH has failed" "$i"
 
256
  done
 
257
  overview "$INSTALLER_CD$DI$ARCH" failed
 
258
fi