Debian Codegraph @

tools/start_new_disc

raw
1 #!/bin/bash
2 #
3 # start_new_disc
4 #
5 # Start a new temporary disc tree, including all the basic metadata
6 # needed
7
8 set -e
9 #set -x
10
11 BASEDIR=$1
12 MIRROR=$2
13 TDIR=$3
14 CODENAME=$4
15 ARCHES="$5"
16 DISKNUM=$6
17 SOURCEDISK=0
18 BINARYDISK=0
19
20 BDIR=$TDIR/$CODENAME
21 CDDIR=$BDIR/CD${DISKNUM}
22 DATE=`cat $BDIR/DATE`
23 DI_DATA_DIR=$BASEDIR/data/$DI_CODENAME
24
25 CAPCODENAME=`perl -e "print ucfirst('$CODENAME')"`
26
27 NUM_ARCHES=`echo $ARCHES | wc -w`
28 case "$ARCHES" in
29 *kfreebsd*) DEBIAN_KERNEL="GNU/kFreeBSD";;
30 *hurd*) DEBIAN_KERNEL="GNU/Hurd";;
31 *) DEBIAN_KERNEL="GNU/Linux";;
32 esac
33 export DEBIAN_KERNEL
34
35 if [ "$VOLID_BASE"x = ""x ] ; then
36 VOLID_BASE="Debian $DEBVERSION"
37 fi
38
39 # Shorten the VOLID if we can - maximum length is 32 characters...
40 VOLID_BASE=$(echo $VOLID_BASE | sed 's/alpha/a/gi;s/beta/b/gi;')
41
42 if [ "$DISKINFO_DISTRO"x = ""x ] ; then
43 DISKINFO_DISTRO="Debian"
44 fi
45 export DISKINFO_DISTRO
46
47 if [ "$FORCE_FIRMWARE"x = "1"x ] ; then
48 FIRMWARE_TEXT=" with firmware"
49 else
50 FIRMWARE_TEXT=""
51 fi
52
53 if [ $NUM_ARCHES = 1 ] ; then
54 case $ARCHES in
55 source)
56 SOURCEDISK=1
57 export DISKINFO="$DISKINFO_DISTRO $DEBVERSION \"$CAPCODENAME\" - $OFFICIAL $DISKTYPE Source-$DISKNUM $BUILD_DATE"
58 export VOLID="$VOLID_BASE Source $DISKNUM"
59 export SOURCEONLY=yes
60 ;;
61 *)
62 BINARYDISK=1
63 DISKNUMSTRING="$DISKNUM"
64 export DISKINFO="$DISKINFO_DISTRO ${DEBIAN_KERNEL} $DEBVERSION \"$CAPCODENAME\" - $OFFICIAL $ARCHES $DISKTYPE Binary-${DISKNUM}${FIRMWARE_TEXT} $BUILD_DATE"
65 if [ $DISKTYPE = NETINST ]; then
66 # Use "n" as a "disknum" here, #858031
67 DISKNUMSTRING="n"
68 # Don't need a disknum here - only one netinst
69 export DISKINFO="$DISKINFO_DISTRO ${DEBIAN_KERNEL} $DEBVERSION \"$CAPCODENAME\" - $OFFICIAL $ARCHES $DISKTYPE${FIRMWARE_TEXT} $BUILD_DATE"
70 fi
71 case "$ARCHES" in
72 ppc64el)
73 export VOLID="$VOLID_BASE p64el $DISKNUMSTRING" ;;
74 powerpc)
75 export VOLID="$VOLID_BASE ppc $DISKNUMSTRING" ;;
76 mips64el)
77 export VOLID="$VOLID_BASE m64el $DISKNUMSTRING" ;;
78 kfreebsd-i386)
79 export VOLID="$VOLID_BASE f-i386 $DISKNUMSTRING" ;;
80 kfreebsd-amd64)
81 export VOLID="$VOLID_BASE f-amd64 $DISKNUMSTRING" ;;
82 hurd-i386)
83 export VOLID="$VOLID_BASE h-i386 $DISKNUMSTRING" ;;
84 hurd-amd64)
85 export VOLID="$VOLID_BASE h-amd64 $DISKNUMSTRING" ;;
86 *)
87 export VOLID="$VOLID_BASE $ARCHES $DISKNUMSTRING" ;;
88 esac
89 ;;
90 esac
91 export ARCHDEF=$ARCHES
92 else
93 BINARYDISK=1
94 case "$ARCHES" in
95 *source*) SOURCEDISK=1;;
96 esac
97 export ARCHDEF=`echo $ARCHES | sed 's? ?/?g'`
98 export DISKINFO="$DISKINFO_DISTRO ${DEBIAN_KERNEL} $DEBVERSION \"$CAPCODENAME\" - $OFFICIAL Multi-architecture $ARCHDEF $DISKTYPE${FIRMWARE_TEXT} #$DISKNUM $BUILD_DATE"
99 export VOLID="$VOLID_BASE M-A $DISKNUM"
100 fi
101
102 merge_include_exclude () {
103 OUT="$1"
104 TYPE="$2"
105 LIST="$3"
106 WRITE=0 # Don't create empty files
107
108 # Check to see if any file specified actually exist
109 for FILE in $LIST ; do
110 if [ -r "$FILE" ] ; then
111 WRITE=1
112 else
113 echo "WARNING: Unable to read $TYPE file $FILE"
114 fi
115 done
116
117 # If we have any files, merge and write them out
118 if [ "$WRITE" = 1 ] ; then
119 sort -u $LIST > "$OUT"
120 fi
121 }
122
123 mkdir -p $CDDIR
124 echo " Adding the required directories"
125
126 if [ ! -e $CDDIR/debian ] ; then
127 ln -sf . $CDDIR/debian
128 fi
129
130 if [ ! -d $CDDIR/dists/$CODENAME ] ; then
131 mkdir -p $CDDIR/dists/$CODENAME
132 fi
133 if [ "$BACKPORTS"x != ""x ] ; then
134 if [ ! -d $CDDIR/dists/$CODENAME-backports ] ; then
135 mkdir -p $CDDIR/dists/$CODENAME-backports
136 fi
137 fi
138
139 if [ ! -d $CDDIR/.disk ] ; then
140 mkdir $CDDIR/.disk
141 fi
142
143 if [ "$DISC_START_HOOK"x != ""x ] ; then
144 echo " Calling start hook: $DISC_START_HOOK"
145 $DISC_START_HOOK $TDIR $MIRROR $DISKNUM $CDDIR "$ARCHES"
146 fi
147
148 echo " Generating the image label and volume id"
149 echo -n $DISKINFO > $CDDIR/.disk/info
150 echo -n "$DISKINFO ($DATE)" > $BDIR/$DISKNUM.diskinfo
151 echo '#define DISKNAME ' $DISKINFO > $CDDIR/README.diskdefines
152 echo '#define ARCH ' $ARCHDEF >> $CDDIR/README.diskdefines
153 for ARCH in $ARCHES
154 do
155 echo '#define ARCH'$ARCH ' 1' >> $CDDIR/README.diskdefines
156 done
157 echo '#define DISKNUM ' $DISKNUM >> $CDDIR/README.diskdefines
158 echo '#define DISKNUM'$DISKNUM ' 1' >> $CDDIR/README.diskdefines
159 echo -n $VOLID > $BDIR/$DISKNUM.volid
160
161 if [ $BINARYDISK = 1 ] ; then
162 echo '#define TYPEbinary 1' >> $CDDIR/README.diskdefines
163 $BASEDIR/tools/set_mkisofs_opts bin $DISKNUM >> $BDIR/$DISKNUM.mkisofs_opts
164 fi
165 if [ $SOURCEDISK = 1 ] ; then
166 echo '#define TYPEsource 1' >> $CDDIR/README.diskdefines
167 $BASEDIR/tools/set_mkisofs_opts src $DISKNUM >> $BDIR/$DISKNUM.mkisofs_opts
168 fi
169
170 if [ $DISKNUM = 1 ] ; then
171 if [ "$OMIT_DOC_TOOLS" != "1" ]; then
172 if [ ! -e $MIRROR/doc ]; then
173 echo "You need a Debian mirror with the doc directory!"
174 exit 1
175 fi
176 fi
177
178 echo " Adding .disk/base_components"
179 echo "main" > $CDDIR/.disk/base_components
180 if [ -n "$LOCAL" ] ; then
181 # This might be reverted by finish_disc in the end:
182 echo "local" >> $CDDIR/.disk/base_components
183 fi
184
185 echo " Adding .disk/cd_type"
186 if [ "$COMPLETE"x = "1"x ]; then
187 if [ $DISKTYPE = DVD ] || [ $DISKTYPE = DLDVD ]; then
188 if [ "$MAXCDS"x = "1"x ]; then
189 echo "dvd/single" > $CDDIR/.disk/cd_type
190 else
191 echo "dvd" > $CDDIR/.disk/cd_type
192 fi
193 elif [ $DISKTYPE = BD ] || [ $DISKTYPE = DLBD ]; then
194 if [ "$MAXCDS"x = "1"x ]; then
195 echo "bluray/single" > $CDDIR/.disk/cd_type
196 else
197 echo "bluray" > $CDDIR/.disk/cd_type
198 fi
199 else
200 if [ "$MAXCDS"x = "1"x ]; then
201 echo "full_cd/single" > $CDDIR/.disk/cd_type
202 else
203 echo "full_cd" > $CDDIR/.disk/cd_type
204 fi
205 fi
206 else
207 if [ $DISKTYPE = BD ] ; then
208 echo "bluray/not_complete" > $CDDIR/.disk/cd_type
209 else
210 echo "not_complete" > $CDDIR/.disk/cd_type
211 fi
212 fi
213
214 if [ $NUM_ARCHES -gt 1 ]; then
215 echo " Adding .disk/multi_arch"
216 touch $CDDIR/.disk/multi_arch
217 fi
218
219 echo " Adding udeb/base includes/excludes"
220
221 for ARCH in $ARCHES
222 do
223 if [ $ARCH != source ] ; then
224 # Netinst/businesscard CD have different
225 # udeb_include and udeb_exclude files
226 if [ -z "$UDEB_INCLUDE" ] ; then
227 case "$DISKTYPE"x in
228 "BC"x)
229 UDEB_INCLUDE=$DI_DATA_DIR/"$ARCH"_businesscard_udeb_include;;
230 "NETINST"x)
231 UDEB_INCLUDE=$DI_DATA_DIR/"$ARCH"_netinst_udeb_include;;
232 *)
233 UDEB_INCLUDE=$DI_DATA_DIR/"$ARCH"_udeb_include;;
234 esac
235 fi
236
237 if [ -z "$UDEB_EXCLUDE" ] ; then
238 case "$DISKTYPE"x in
239 "BC"x)
240 UDEB_EXCLUDE=$DI_DATA_DIR/"$ARCH"_businesscard_udeb_exclude;;
241 "NETINST"x)
242 UDEB_EXCLUDE=$DI_DATA_DIR/"$ARCH"_netinst_udeb_exclude;;
243 *)
244 UDEB_EXCLUDE=$DI_DATA_DIR/"$ARCH"_udeb_exclude;;
245 esac
246 fi
247
248 UDEB_INCLUDES="$UDEB_INCLUDES $UDEB_INCLUDE"
249 UDEB_EXCLUDES="$UDEB_EXCLUDES $UDEB_EXCLUDE"
250 BASE_INCLUDES="$BASE_INCLUDES $BASE_INCLUDE"
251 BASE_EXCLUDES="$BASE_EXCLUDES $BASE_EXCLUDE"
252 fi
253 done
254
255 # Sort and merge the the include and exclude files as necessary
256 merge_include_exclude "$CDDIR/.disk/udeb_include" UDEB_INCLUDE "$UDEB_INCLUDES"
257 merge_include_exclude "$CDDIR/.disk/udeb_exclude" UDEB_EXCLUDE "$UDEB_EXCLUDES"
258 merge_include_exclude "$CDDIR/.disk/base_include" BASE_INCLUDE "$BASE_INCLUDES"
259 merge_include_exclude "$CDDIR/.disk/base_exclude" BASE_EXCLUDE "$BASE_EXCLUDES"
260
261 if [ "$OMIT_DOC_TOOLS" != "1" ]; then
262 echo " Adding docs to CD1"
263 $BASEDIR/tools/add_files $CDDIR $MIRROR doc
264
265 echo " Removing old dedications"
266 DEBMAINVER="`echo $DEBVERSION | sed -e 's/[ _r].*//;s/\..*//'`"
267 find $CDDIR/doc -name "dedication-*" | grep -v "$DEBMAINVER" | xargs rm -vf
268 find $CDDIR/doc -name "debian-keyring.tar.gz" | xargs rm -f
269
270 if [ ! -e $CDDIR/doc/FAQ/html ] ; then
271 echo " Extracting FAQ on CD1"
272 mkdir $CDDIR/doc/FAQ/html
273 cd $CDDIR/doc/FAQ/html
274 if [ -e "../debian-faq.en.html.tar.gz" ] ; then
275 tar xzf ../debian-faq.en.html.tar.gz
276 else
277 tar xzf ../debian-faq.html.tar.gz
278 fi
279 fi
280 fi
281
282 # Installtools
283 mkdir $CDDIR/install
284 if [ -x "$BASEDIR/tools/$CODENAME/installtools.sh" ] ; then
285 echo " Adding installtools"
286 $BASEDIR/tools/$CODENAME/installtools.sh $CDDIR "$ARCHES"
287 fi
288
289 # See if we had to remove anything because it was too big. Warn the user.
290 if [ -s $BDIR/sourcetoobig ] ; then
291 echo " Adding README.excluded (some source files were too big)"
292 echo "For size reasons, the following source packages were excluded from this disc set:" >> $CDDIR/README.excluded
293 echo >> $CDDIR/README.excluded
294 cat $BDIR/sourcetoobig >> $CDDIR/README.excluded
295 if [ -s $BDIR/sourcetoobig-deps ] ; then
296 echo "and that caused the following packages to be also excluded because" >> $CDDIR/README.excluded
297 echo "of dependencies:" >> $CDDIR/README.excluded
298 echo >> $CDDIR/README.excluded
299 cat $BDIR/sourcetoobig-deps >> $CDDIR/README.excluded
300 echo >> $CDDIR/README.excluded
301 echo "Beware that this may break dependencies in this disc set." >> $CDDIR/README.excluded
302 fi
303 echo >> $CDDIR/README.excluded
304 fi
305
306 # Stop the greps below from complaining
307 touch $BDIR/sort_deps_dummy.log
308
309 grep "refused because of toobig" $BDIR/sort_deps*.log | sort -u | awk '{print $1}' > $BDIR/toobig
310 if [ -s $BDIR/toobig ] ; then
311 echo " Adding README.excluded (some package files were too big)"
312 echo "For size reasons, the following packages were excluded from this disc set:" >> $CDDIR/README.excluded
313 echo >> $CDDIR/README.excluded
314 cat $BDIR/toobig >> $CDDIR/README.excluded
315 grep "Can't add.*toobig" $BDIR/sort_deps*.log | sort -u | awk '{print $3}' > $BDIR/toobig-deps
316 if [ -s $BDIR/toobig-deps ] ; then
317 echo >> $CDDIR/README.excluded
318 echo "and that caused the following packages to be also excluded because" >> $CDDIR/README.excluded
319 echo "of dependencies:" >> $CDDIR/README.excluded
320 echo >> $CDDIR/README.excluded
321 cat $BDIR/toobig-deps >> $CDDIR/README.excluded
322 fi
323 fi
324 fi
325
326 # Create an empty dirs file; will be appended to later if needed
327 > $BDIR/$DISKNUM.mkisofs_dirs
328
329 echo " Adding common docs on CD$DISKNUM"
330 $BASEDIR/tools/add-bin-doc $DISKNUM "$ARCHES"
331
332 # Common stuff for all disks in the set
333 if [ "$SOURCEONLY"x = "yes"x ] ; then
334 echo -n "-J -joliet-long" >> $BDIR/$DISKNUM.mkisofs_opts
335 fi
336
337 echo " Adding Release files"
338 # Release files
339 cd $CDDIR
340
341 SECTIONS="main"
342 if [ "${NONFREE:-0}" != "0" -o "${EXTRANONFREE:-0}" != "0" ] ; then
343 SECTIONS="${SECTIONS} $NONFREE_COMPONENTS"
344 fi
345 if [ "${CONTRIB:-0}" != "0" ] ; then
346 SECTIONS="${SECTIONS} contrib"
347 fi
348
349 if [ -n "$LOCAL" ] ; then
350 SECTIONS="$SECTIONS local"
351 fi
352
353 # these two lines can be inserted below the "Architectures" line below,
354 # to sort out broken Release files just after the testing --> stable
355 # transition
356 # sed -e "s/^Suite: .*$/Suite: stable/" | \
357 # sed -e "s/^Description: .*$/Description: Debian $DEBVERSION/" | \
358
359 if [ -e "$MIRROR/dists/$CODENAME/Release" ] ; then
360 # Strip the MD5Sum and SHA1 fields
361 # Update some other information as well
362 sed -e "s/^Architectures: .*$/Architectures: $ARCHES/" \
363 $MIRROR/dists/$CODENAME/Release | \
364 sed -e "s|^Components: .*$|Components: $SECTIONS|" | \
365 perl -ne 'if (/^(MD5Sum|SHA1|SHA256|SHA512):/i) { $f=1; next }
366 if ($f) {
367 unless (/^ /) { print; $f=0 }
368 } else { print }' > dists/$CODENAME/Release
369 if [ "$EARLY_BUILD_HACK"x = "1"x ] ; then
370 RDATE=`awk '/^Date:/ { print $2,$3,$4,$5}' dists/$CODENAME/Release`
371 sed -i -e "s/^Suite: .*$/Suite: stable/" dists/$CODENAME/Release
372 sed -i -e "s/^Description: .*$/Description: Debian $DEBVERSION Released $RDATE/" dists/$CODENAME/Release
373 fi
374
375 # Create the suite symlink
376 SUITE=$(sed -n "/^Suite:/ s/.*: //p" dists/$CODENAME/Release)
377 if [ -n "$SUITE" ] && [ x"$SUITE" != x"$CODENAME" ]; then
378 ln -sf $CODENAME dists/$SUITE
379 fi
380 else
381 echo "ERROR: Release file ($MIRROR/dists/$CODENAME/Release) is missing !"
382 exit 1
383 fi
384
385 if [ "$BACKPORTS"x != ""x ]; then
386 if [ -e "$MIRROR/dists/$CODENAME-backports/Release" ] ; then
387 # Strip the MD5Sum and SHA1 fields
388 # Update some other information as well
389 sed -e "s/^Architectures: .*$/Architectures: $ARCHES/" \
390 $MIRROR/dists/$CODENAME-backports/Release | \
391 sed -e "s|^Components: .*$|Components: $SECTIONS|" | \
392 perl -ne 'if (/^(MD5Sum|SHA1|SHA256|SHA512):/i) { $f=1; next }
393 if ($f) {
394 unless (/^ /) { print; $f=0 }
395 } else { print }' > dists/$CODENAME-backports/Release
396 if [ "$EARLY_BUILD_HACK"x = "1"x ] ; then
397 RDATE=`awk '/^Date:/ { print $2,$3,$4,$5}' dists/$CODENAME-backports/Release`
398 sed -i -e "s/^Suite: .*$/Suite: stable/" dists/$CODENAME-backports/Release
399 sed -i -e "s/^Description: .*$/Description: Debian $DEBVERSION Released $RDATE/" dists/$CODENAME-backports/Release
400 fi
401
402 # Create the suite symlink
403 SUITE=$(sed -n "/^Suite:/ s/.*: //p" dists/$CODENAME-backports/Release)
404 if [ -n "$SUITE" ] && [ x"$SUITE" != x"$CODENAME-backports" ]; then
405 ln -sf $CODENAME-backports dists/$SUITE
406 fi
407 else
408 echo "ERROR: Release file ($MIRROR/dists/$CODENAME-backports/Release) is missing !"
409 exit 1
410 fi
411 fi
412
413 # Copying individual release files
414 for ARCH in $ARCHES
415 do
416 for SECT in $SECTIONS
417 do
418 # Install the release files
419 if [ -e "$MIRROR/dists/$CODENAME/$SECT/binary-$ARCH/Release" ] ; then
420 mkdir -p dists/$CODENAME/$SECT/binary-$ARCH
421 cp $MIRROR/dists/$CODENAME/$SECT/binary-$ARCH/Release \
422 dists/$CODENAME/$SECT/binary-$ARCH/
423 if [ "$DEBVERSION" != "testing" ] ; then
424 sed -i "s/^Archive:.*$/Archive: stable/" dists/$CODENAME/$SECT/binary-$ARCH/Release
425 fi
426 fi
427 if [ -n "$NONUS" -a -e "$NONUS/dists/$CODENAME/non-US/$SECT/binary-$ARCH/Release" ] ; then
428 mkdir -p dists/$CODENAME/non-US/$SECT/binary-$ARCH
429 cp $NONUS/dists/$CODENAME/non-US/$SECT/binary-$ARCH/Release \
430 dists/$CODENAME/non-US/$SECT/binary-$ARCH/
431 if [ "$DEBVERSION" != "testing" ] ; then
432 sed -i "s/^Archive:.*$/Archive: stable/" dists/$CODENAME/non-US/$SECT/binary-$ARCH/Release
433 fi
434 fi
435 done
436
437 if [ -n "$LOCALDEBS" -a -n "$LOCAL" ] ; then
438 if [ -e $LOCALDEBS/dists/$CODENAME/local/binary-$ARCH/Release ] ; then
439 mkdir -p dists/$CODENAME/local/binary-$ARCH
440 cp $LOCALDEBS/dists/$CODENAME/local/binary-$ARCH/Release \
441 dists/$CODENAME/local/binary-$ARCH/
442 fi
443 fi
444
445 if [ -e "$MIRROR/dists/$DI_CODENAME/main/debian-installer/binary-$ARCH/Release" ] ; then
446 mkdir -p dists/$CODENAME/main/debian-installer/binary-$ARCH
447 cp $MIRROR/dists/$DI_CODENAME/main/debian-installer/binary-$ARCH/Release \
448 dists/$CODENAME/main/debian-installer/binary-$ARCH/
449 if [ "$DEBVERSION" != "testing" ] ; then
450 sed -i "s/^Archive:.*$/Archive: stable/" dists/$CODENAME/main/debian-installer/binary-$ARCH/Release
451 fi
452 fi
453
454 if [ -n "$LOCAL" -a -e "${LOCALDEBS:-$MIRROR}/dists/$DI_CODENAME/local/debian-installer/binary-$ARCH/Release" ] ; then
455 mkdir -p dists/$CODENAME/local/debian-installer/binary-$ARCH
456 cp "${LOCALDEBS:-$MIRROR}/dists/$DI_CODENAME/local/debian-installer/binary-$ARCH/Release" \
457 dists/$CODENAME/local/debian-installer/binary-$ARCH/
458 fi
459 done
460
461 # Copying individual release files for backports
462 if [ "$BACKPORTS"x != ""x ]; then
463 for ARCH in $ARCHES
464 do
465 for SECT in $SECTIONS
466 do
467 # Install the release files
468 if [ -e "$MIRROR/dists/$CODENAME-backports/$SECT/binary-$ARCH/Release" ] ; then
469 mkdir -p dists/$CODENAME-backports/$SECT/binary-$ARCH
470 cp $MIRROR/dists/$CODENAME-backports/$SECT/binary-$ARCH/Release \
471 dists/$CODENAME-backports/$SECT/binary-$ARCH/
472 if [ "$DEBVERSION" != "testing" ] ; then
473 sed -i "s/^Archive:.*$/Archive: stable/" dists/$CODENAME-backports/$SECT/binary-$ARCH/Release
474 fi
475 fi
476 if [ -n "$NONUS" -a -e "$NONUS/dists/$CODENAME-backports/non-US/$SECT/binary-$ARCH/Release" ] ; then
477 mkdir -p dists/$CODENAME-backports/non-US/$SECT/binary-$ARCH
478 cp $NONUS/dists/$CODENAME-backports/non-US/$SECT/binary-$ARCH/Release \
479 dists/$CODENAME-backports/non-US/$SECT/binary-$ARCH/
480 if [ "$DEBVERSION" != "testing" ] ; then
481 sed -i "s/^Archive:.*$/Archive: stable/" dists/$CODENAME-backports/non-US/$SECT/binary-$ARCH/Release
482 fi
483 fi
484 done
485
486 if [ -n "$LOCALDEBS" -a -n "$LOCAL" ] ; then
487 if [ -e $LOCALDEBS/dists/$CODENAME-backports/local/binary-$ARCH/Release ] ; then
488 mkdir -p dists/$CODENAME-backports/local/binary-$ARCH
489 cp $LOCALDEBS/dists/$CODENAME-backports/local/binary-$ARCH/Release \
490 dists/$CODENAME-backports/local/binary-$ARCH/
491 fi
492 fi
493
494 if [ -e "$MIRROR/dists/$DI_CODENAME/main/debian-installer/binary-$ARCH/Release" ] ; then
495 mkdir -p dists/$CODENAME-backports/main/debian-installer/binary-$ARCH
496 cp $MIRROR/dists/$DI_CODENAME/main/debian-installer/binary-$ARCH/Release \
497 dists/$CODENAME-backports/main/debian-installer/binary-$ARCH/
498 if [ "$DEBVERSION" != "testing" ] ; then
499 sed -i "s/^Archive:.*$/Archive: stable/" dists/$CODENAME-backports/main/debian-installer/binary-$ARCH/Release
500 fi
501 fi
502 done
503 fi
504
505 # Upgrade packages / kernels
506 if [ "$SOURCEONLY"x != "yes"x ] ; then
507 echo " Trying to add upgrade* directories"
508 if [ -x "$BASEDIR/tools/$CODENAME/upgrade.sh" ] ; then
509 $BASEDIR/tools/$CODENAME/upgrade.sh
510 fi
511 fi
512
513 for ARCH in $ARCHES
514 do
515 export ARCH=$ARCH
516 if [ $ARCH != source ] ; then
517 if [ -x "$BASEDIR/tools/$CODENAME/upgrade-$ARCH.sh" ] ; then
518 $BASEDIR/tools/$CODENAME/upgrade-$ARCH.sh $DISKNUM $CDDIR
519 fi
520
521 echo " (Optionally) making the image bootable for $ARCH:"
522 if [ -f $BASEDIR/tools/boot/$DI_CODENAME/boot-$ARCH ] ; then
523 cd $TDIR
524 echo " Running tools/boot/$DI_CODENAME/boot-$ARCH $DISKNUM $CDDIR"
525 $BASEDIR/tools/boot/$DI_CODENAME/boot-$ARCH $DISKNUM $CDDIR || booterror=$?
526 if [ "$booterror"x != ""x ] ; then
527 echo " FAILED: error $booterror"
528 exit $booterror
529 fi
530 else
531 if [ "${IGNORE_MISSING_BOOT_SCRIPT:-0}" = "0" ] ; then
532 echo " No script to make CDs bootable for $ARCH"
533 echo " We've not been asked to ignore this. Aborting."
534 exit 1
535 fi
536 fi
537 fi
538 done
539
540 # If we've had to extract any files from packages to put them onto the
541 # CD (e.g. bootloader files), then we will have listed them in
542 # $BDIR/$DISKNUM.pkgs_extracted. If that file exists, add a README.source
543 # to the root of the CD
544 if [ -e $BDIR/$DISKNUM.pkgs_extracted ] && \
545 [ ""x != "$ARCHIVE_EXTRACTED_SOURCES"x ] ; then
546 echo " Adding README.source"
547 cat > $CDDIR/README.source <<EOF
548 Creation of this disk image included extracting files from some Debian
549 packages. In case you do not have those packages already, both the
550 binary and source packages are archived at
551
552 EOF
553 echo "$ARCHIVE_EXTRACTED_SOURCES" >> $CDDIR/README.source
554 echo "" >> $CDDIR/README.source
555 echo "The following binary/source packages were used:" >> $CDDIR/README.source
556 sort $BDIR/$DISKNUM.pkgs_extracted | uniq | \
557 xargs -n1 basename >> $CDDIR/README.source
558 fi
559
560 if [ "$DISC_PKG_HOOK"x != ""x ] ; then
561 echo " Calling pkg hook: $DISC_PKG_HOOK"
562 $DISC_PKG_HOOK $TDIR $MIRROR $DISKNUM $CDDIR "$ARCHES"
563 fi
564
565 exit 0