~tsimonq2/debian-cd/lubuntu-cosmic-changes

« back to all changes in this revision

Viewing changes to slink_cd

  • Committer: Arch Librarian
  • Date: 2005-03-22 00:35:34 UTC
  • Revision ID: Arch-1:debian-cd@arch.ubuntu.com%debian-cd--MAIN--0--base-0
Initial revision
Author: 93sam
Date: 1999-04-01 06:58:03 GMT
Initial revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
# slink_cd v 1.13 (c) Steve McIntyre <stevem@chiark.greenend.org.uk>
 
3
# Released under GPL 31 Mar 1999
 
4
# See the file COPYING for license details
 
5
# Greatly influenced by the older Makefile system in the Hamm debian-cd package
 
6
#
 
7
##############################################################################
 
8
#
 
9
#  Read the README! IMPORTANT STUFF HERE!
 
10
#
 
11
##############################################################################
 
12
 
 
13
# Version number, to be used later
 
14
SLINKCD_VERSION=1.13
 
15
SLINKCD_SITE="http://www.chiark.greenend.org.uk/~stevem/DebianCD/"
 
16
 
 
17
###########################################################################
 
18
# Default options - we check for these in the environment first, so it
 
19
# is possible to drive this script entirely without changing these if
 
20
# you so desire. Where this really comes into its own is in automating
 
21
# the process for multiple architectures - try a script that sets the
 
22
# environment appropriately, then calls this for each architecture,
 
23
# something like:
 
24
 
25
# ARCH=i386 TDIR=~/i386-tmp OUT=~/i386-out ./slink_cd <options>
 
26
# ARCH=m68k TDIR=~/m68k-tmp OUT=~/m68k-out ./slink_cd <options>
 
27
# ARCH=alpha TDIR=~/alpha-tmp OUT=~/alpha-out ./slink_cd <options>
 
28
# ARCH=sparc TDIR=~/sparc-tmp OUT=~/sparc-out ./slink_cd <options>
 
29
#
 
30
# It's not pretty but it should work... (TM) :-) - look at the included 
 
31
# "arch" script for an example.
 
32
###########################################################################
 
33
 
 
34
# Grab current directory for later use. Can be over-ridden by $BASEDIR
 
35
# in the environment
 
36
BASEDIR=${BASEDIR:-$PWD}
 
37
 
 
38
# Architecture to build images for (i386, alpha, m68k, sparc, powerpc so far).
 
39
# Default, will be overridden by other options - use m68k, alpha or i386 on 
 
40
# commandline to change
 
41
ARCH=${ARCH:-i386}
 
42
 
 
43
# Top level location of Debian mirror
 
44
MIRROR=${MIRROR:-/home/ftp/debian}
 
45
 
 
46
# Location of non-US mirror
 
47
NONUS=${NONUS:-$MIRROR/non-US}
 
48
 
 
49
# Path to use with mkisofs/mkhybrid
 
50
MKISOFS=${MKISOFS:-"mkhybrid"}
 
51
 
 
52
# Options to use with mkisofs/mkhybrid - one of these should do you
 
53
# If you're using i386 then -J will be added later to add Joliet stuff
 
54
# * Why can't Windows read RockRidge like any sensible OS? *
 
55
#MKISOFS_OPTS=${MKISOFS_OPTS:-"-a -r -T"} # For normal users
 
56
 
 
57
MKISOFS_OPTS=${MKISOFS_OPTS:-"-a -r -F -T"} # For sym-link farmers. 
 
58
# Also make sure you have a patched mkhybrid - read the README
 
59
 
 
60
# TDIR must be on the same partition as the mirror for hard links trick 
 
61
# to work
 
62
TDIR=${TDIR:-~stevem/slinkcd}
 
63
 
 
64
# Target directory for output ISO images
 
65
OUT=${OUT:-$MIRROR/local/images}
 
66
 
 
67
# Sparc (maybe other?) boot directory from where to grab the SILO boot loader
 
68
BOOTDIR=${BOOTDIR:-/boot}
 
69
 
 
70
. $BASEDIR/vecho # Local definitions for vecho, vvecho, vvvecho
 
71
 
 
72
# Default debug level
 
73
VERBOSE=0
 
74
DATE=`date +%Y%m%d`
 
75
 
 
76
# Parse options
 
77
 
 
78
if [ $# -gt 0 ] ; then
 
79
    while [ $# -gt 0 ] 
 
80
    do
 
81
        case "$1"x in 
 
82
          "-v"x)
 
83
              VERBOSE=$[ $VERBOSE + 1 ]
 
84
              shift 1
 
85
          ;;
 
86
          "clean"x)
 
87
              CLEAN=1
 
88
              shift 1
 
89
          ;;
 
90
          "genlist"x)
 
91
              GENLIST=1
 
92
              shift 1
 
93
          ;;
 
94
          "tree"x)
 
95
              TREE=1
 
96
              shift 1
 
97
          ;;
 
98
          "genlinks"x)
 
99
              GENLINKS=1
 
100
              shift 1
 
101
          ;;
 
102
          "flatten"x)
 
103
              FLATTEN=1
 
104
              shift 1
 
105
          ;;
 
106
          "md5check"x)
 
107
              MD5CHECK=1
 
108
              shift 1
 
109
          ;;
 
110
          "packages"x)
 
111
              PACKAGES=1
 
112
              shift 1
 
113
          ;;
 
114
          "boot"x)
 
115
              BOOT=1
 
116
              shift 1
 
117
          ;;
 
118
          "extras"x)
 
119
              EXTRAS=1
 
120
              shift 1
 
121
          ;;
 
122
          "md5list"x)
 
123
              MD5LIST=1
 
124
              shift 1
 
125
          ;;
 
126
          "images"x)
 
127
              IMAGES=1
 
128
              IMAGE1=1
 
129
              IMAGE2=1
 
130
              IMAGE3=1
 
131
              IMAGE4=1
 
132
              IMAGESMADE=1
 
133
              shift 1
 
134
          ;;
 
135
          "image1"x)
 
136
              IMAGE1=1
 
137
              IMAGESMADE=1
 
138
              shift 1
 
139
          ;;
 
140
          "image2"x)
 
141
              IMAGE2=1
 
142
              IMAGESMADE=1
 
143
              shift 1
 
144
          ;;
 
145
          "image3"x)
 
146
              IMAGE3=1
 
147
              IMAGESMADE=1
 
148
              shift 1
 
149
          ;;
 
150
          "image4"x)
 
151
              IMAGE4=1
 
152
              IMAGESMADE=1
 
153
              shift 1
 
154
          ;;
 
155
          "image5"x)
 
156
              IMAGE5=1
 
157
              IMAGESMADE=1
 
158
              shift 1
 
159
          ;;
 
160
          "imagesums"x)
 
161
              IMAGESUMS=1
 
162
              shift 1
 
163
          ;;
 
164
          "alpha"x)
 
165
              ARCH=alpha
 
166
              shift 1
 
167
          ;;
 
168
          "sparc"x)
 
169
              ARCH=sparc
 
170
              shift 1
 
171
          ;;
 
172
          "powerpc"x)
 
173
              ARCH=powerpc
 
174
              shift 1
 
175
          ;;
 
176
          "m68k"x)
 
177
              ARCH=m68k
 
178
              shift 1
 
179
          ;;
 
180
          "i386"x)
 
181
              ARCH=i386
 
182
              shift 1
 
183
          ;;
 
184
          "single_disk"x)
 
185
              SINGLE_DISK=1
 
186
              shift 1
 
187
          ;;
 
188
          "force_deps"x)
 
189
              FORCE_DEPENDS=1
 
190
              shift 1
 
191
          ;;
 
192
          "non-US"x|"non-us"x)
 
193
              # Only set this if we have a location for it...
 
194
              if [ "$NONUS"x != ""x ] ; then
 
195
                NU=1
 
196
              fi
 
197
              shift 1
 
198
          ;;
 
199
          "non-free"x)
 
200
              NF=1
 
201
              shift 1
 
202
          ;;
 
203
          *)
 
204
              echo \"$1\": invalid option.
 
205
              exit 1
 
206
          ;;    
 
207
        esac
 
208
    done                        
 
209
else
 
210
    CLEAN=1
 
211
    GENLIST=1
 
212
    TREE=1
 
213
    GENLINKS=0
 
214
    FLATTEN=1
 
215
    MD5CHECK=1
 
216
    PACKAGES=1
 
217
    BOOT=1
 
218
    EXTRAS=1
 
219
    MD5LIST=1
 
220
    IMAGE1=0
 
221
    IMAGE2=0
 
222
    IMAGE3=0
 
223
    IMAGE4=0
 
224
    IMAGE5=0
 
225
        IMAGESUMS=0
 
226
    NU=0
 
227
    NF=0
 
228
        SINGLE_DISK=0
 
229
fi
 
230
 
 
231
if [ "$IMAGES"x = "1"x -a "$NF"x = "1"x ] ; then
 
232
        IMAGE5=1
 
233
fi
 
234
 
 
235
error=0
 
236
vecho VERBOSE=$VERBOSE
 
237
vecho CLEAN=$CLEAN
 
238
vecho GENLIST=$GENLIST
 
239
vecho TREE=$TREE
 
240
vecho GENLINKS=$GENLINKS
 
241
vecho FLATTEN=$FLATTEN
 
242
vecho MD5CHECK=$MD5CHECK
 
243
vecho PACKAGES=$PACKAGES
 
244
vecho BOOT=$BOOT
 
245
vecho EXTRAS=$EXTRAS
 
246
vecho MD5LIST=$MD5LIST
 
247
vecho IMAGES=$IMAGES
 
248
vecho IMAGE1=$IMAGE1 
 
249
vecho IMAGE2=$IMAGE2
 
250
vecho IMAGE3=$IMAGE3 
 
251
vecho IMAGE4=$IMAGE4 
 
252
vecho IMAGE5=$IMAGE5 
 
253
vecho IMAGESUMS=$IMAGESUMS
 
254
vecho ARCH=$ARCH
 
255
vecho MIRROR=$MIRROR
 
256
vecho NONUS=$NONUS
 
257
vecho MKISOFS=$MKISOFS
 
258
vecho TDIR=$TDIR
 
259
vecho OUT=$OUT
 
260
vecho BASEDIR=$BASEDIR
 
261
vecho NU=$NU
 
262
vecho NF=$NF
 
263
vecho SINGLE_DISK=$SINGLE_DISK
 
264
 
 
265
# Sort out non-US link - this should be done better...
 
266
if [ "$NU"x = "1"x ] ; then
 
267
        vecho Checking for non-US link in $MIRROR/dists/slink
 
268
    if [ ! -L $MIRROR/dists/slink/non-US -a ! -d $MIRROR/dists/slink/non-US ] ; then
 
269
                vecho "Does not exist; trying to make one"
 
270
        (cd $MIRROR/dists/slink && ln -s $NONUS/dists/slink/non-US >/dev/null 2>&1 ) # Redirect errors - people may have a read-only mirror...
 
271
    fi
 
272
fi
 
273
 
 
274
# Cope with relative paths; some people insist on using them.
 
275
vecho Checking TDIR is set OK
 
276
# Does it exist?
 
277
if [ ! -e $TDIR ] ; then
 
278
        vecho "$TDIR does not exist - making it"
 
279
        mkdir $TDIR
 
280
        if [ $? -gt 0 ] ; then
 
281
                echo "Temporary directory $TDIR does not exist and we cannot create it."
 
282
                echo "Exit."
 
283
                exit 1
 
284
        fi
 
285
fi
 
286
pushd $TDIR >/dev/null
 
287
if [ $? -gt 0 ] ; then
 
288
        echo "Error in directory $TDIR"
 
289
        echo "Exit."
 
290
        exit 1
 
291
fi
 
292
TDIR=$PWD
 
293
popd >/dev/null
 
294
vecho TDIR is now $TDIR
 
295
 
 
296
vecho Checking MIRROR is set OK
 
297
# Does it exist?
 
298
if [ ! -e $MIRROR ] ; then
 
299
        echo "Mirror directory $MIRROR does not exist"
 
300
        echo "Exit."
 
301
        exit 1
 
302
fi
 
303
 
 
304
if [ "$NU"x = "1"x ] ; then
 
305
        vecho Checking NONUS is set OK
 
306
        # Does it exist?
 
307
        if [ ! -e $NONUS ] ; then
 
308
                echo "non-US Mirror directory $NONUS does not exist"
 
309
                echo "Exit."
 
310
                exit 1
 
311
        fi
 
312
fi
 
313
 
 
314
vecho Checking OUT is set OK
 
315
# Does it exist?
 
316
if [ ! -e $OUT ] ; then
 
317
        vecho "$OUT does not exist - making it"
 
318
        mkdir $OUT
 
319
        if [ $? -gt 0 ] ; then
 
320
                echo "Image directory $OUT does not exist and we cannot create it."
 
321
                echo "Exit."
 
322
                exit 1
 
323
        fi
 
324
fi
 
325
pushd $OUT >/dev/null
 
326
if [ $? -gt 0 ] ; then
 
327
        echo "Error in directory $OUT"
 
328
        echo "Exit."
 
329
        exit 1
 
330
fi
 
331
OUT=$PWD
 
332
popd >/dev/null
 
333
vecho OUT is now $OUT
 
334
 
 
335
# Check the user has done as told - make sure we're on the same
 
336
# partition as the mirror unless we have been told to "genlinks"
 
337
 
 
338
if [ "$GENLINKS"x != "1"x -a "$TREE"x = "1"x ] ; then
 
339
        vecho Checking that TDIR is on the same partition as the mirror.
 
340
        MIRRORPART=`df $MIRROR | grep -v ilesystem | awk '{print $1}'`
 
341
                vvecho MIRROR is on $MIRRORPART
 
342
        TMPPART=`df $TDIR | grep -v ilesystem | awk '{print $1}'`
 
343
                vvecho TDIR is on $TMPPART
 
344
        if [ "$MIRRORPART"x = "$TMPPART"x ] ; then
 
345
                vecho "Good - they match."
 
346
        else
 
347
                echo "Read the instructions, the temporary dir specified must be on the" 
 
348
                echo "same partition as the mirror unless you specify \"genlinks\" to make a sym-link"
 
349
                echo "farm"
 
350
                echo "$TMPPART != $MIRRORPART"
 
351
                exit 1
 
352
        fi
 
353
fi
 
354
 
 
355
# Check to see if we're being asked to create md5sums for non-existent images
 
356
if [ "$IMAGESMADE"x != "1"x -a "$IMAGESUMS"x = "1"x ] ; then
 
357
        echo "To create md5sums of CD images you first need to create the images!"
 
358
        echo "Try again, either adding an image creation option (image[12345x])"
 
359
        echo "or removing the \"imagesums\" option"
 
360
        echo "Exit."
 
361
        exit 1
 
362
fi
 
363
 
 
364
# If we're doing genlinks then check we have the required -F option
 
365
# for mkhybrid
 
366
if [ "$GENLINKS"x = "1"x ] ; then
 
367
        if ! (echo "$MKISOFS_OPTS" | grep -q \\-F ) ; then
 
368
                echo "If you are using the \"genlinks\" option then you also need to use a patched"
 
369
                echo "mkhybrid/mkisofs and add the \"-F\" flag to the command line for it. See the"
 
370
                echo "README file for more details."
 
371
                echo "Exit."
 
372
                exit 1
 
373
        fi
 
374
fi
 
375
 
 
376
# Set up for later; non-free and non-US will be added as necessary
 
377
SECTLIST="main"       # List of sections
 
378
DISKLIST="1 2 3 4"    # List of all disks
 
379
BINLIST="1 2"         # List of disks containing binaries
 
380
 
 
381
if [ "$SINGLE_DISK"x = "1"x ] ; then
 
382
        # Sanity check...
 
383
        if [ "$NU"x = "1"x -o "$NF"x = "1"x ] ; then
 
384
                echo 'single_disk option is not compatible with either non-free or non-US.' 
 
385
                echo Exit.
 
386
                exit 1
 
387
        fi
 
388
        if [ "$IMAGE2"x = "1"x -o "$IMAGE3"x = "1"x -o "$IMAGE3" = "1"x -o "$IMAGE4"x = "1"x ] ; then
 
389
                echo 'single_disk option is not compatible with creation of CD images other than #1.' 
 
390
                echo Exit.
 
391
                exit 1
 
392
        fi
 
393
        DISKLIST="1"
 
394
        BINLIST="1"
 
395
else
 
396
        SECTLIST="$SECTLIST contrib"
 
397
fi
 
398
 
 
399
if [ "$NU"x = "1"x ] ; then
 
400
    SECTLIST="$SECTLIST non-US"
 
401
fi
 
402
 
 
403
if [ "$NF"x = "1"x ] ; then
 
404
    SECTLIST="$SECTLIST non-free"
 
405
    DISKLIST="$DISKLIST 5"
 
406
        BINLIST="$BINLIST 5"
 
407
fi
 
408
 
 
409
vecho "About to run to create disk(s) $DISKLIST and section(s) $SECTLIST"
 
410
 
 
411
# Sanity check for combinations of options - creating sym-links then
 
412
# flattening them isn't just silly, it's stupid...
 
413
 
 
414
if [ "$GENLINKS"x = "1"x -a "$FLATTEN"x = "1"x ] ; then
 
415
        echo "The \"genlinks\" and \"flatten\" options are incompatible."
 
416
        echo "Exit."
 
417
        exit 1
 
418
fi
 
419
 
 
420
if [ $error -eq 0 ] ; then
 
421
    if [ "$CLEAN"x = "1"x ] ; then
 
422
                echo CLEAN:
 
423
                vecho Removing old directories
 
424
                if [ "$VERBOSE" -gt 1 ] ; then
 
425
                        rm -rvf $TDIR
 
426
                else
 
427
                        rm -rf $TDIR
 
428
                fi
 
429
                mkdir $TDIR
 
430
        fi
 
431
fi      
 
432
 
 
433
vecho "Making working copies of config files, converting ARCH to $ARCH"
 
434
if [ -e $TDIR/slink1.list ] ; then
 
435
    vecho "You already appear to have them. I therefore assume the ones in"
 
436
    vecho "$TDIR are correct and I will leave them alone. If you"
 
437
    vecho "want to generate new ones, delete the file \"slink1.list\" in"
 
438
    vecho "$TDIR and try again."
 
439
else
 
440
    for i in $DISKLIST
 
441
    do
 
442
        for TYPE in list info volid extras optional
 
443
        do
 
444
                        if [ -e slink$i.$TYPE ] ; then
 
445
                                vecho "    slink$i.$TYPE"
 
446
                                cat slink$i.$TYPE | sed "s/ARCH/$ARCH/g" >$TDIR/slink$i.$TYPE
 
447
                        fi
 
448
        done
 
449
    done
 
450
        vecho "    mkisofsrc"
 
451
        cat mkisofsrc | sed "s/ARCH/$ARCH/g" >$TDIR/.mkisofs
 
452
        ln -s .mkisofs $TDIR/.mkisofsrc
 
453
        vecho "    slink1.needed" 
 
454
        slice master
 
455
        if [ $? -gt 0 ] ; then
 
456
                echo "\"slice master\" failed - do you have the slice package installed?"
 
457
                echo Exit.
 
458
                exit 1
 
459
        fi
 
460
        echo "# Do not edit this file - it is automatically generated." >$TDIR/slink1.needed
 
461
        echo "# Edit \"master\" instead." >>$TDIR/slink1.needed
 
462
        cat master.$ARCH | awk -F':' '
 
463
        /Packages:/ {packages++; next} 
 
464
        /.+.+/      {if(packages) {print $1}}
 
465
        ' |sort |uniq >>$TDIR/slink1.needed
 
466
        rm master.*
 
467
 
 
468
        vecho "    slink1.useful" 
 
469
        slice useful
 
470
        if [ $? -gt 0 ] ; then
 
471
                echo "\"slice useful\" failed - do you have the slice package installed?"
 
472
                echo Exit.
 
473
                exit 1
 
474
        fi
 
475
        echo "# Do not edit this file - it is automatically generated." >$TDIR/slink1.useful
 
476
        echo "# Edit \"useful\" instead." >>$TDIR/slink1.useful
 
477
        cat useful.$ARCH | awk -F':' '
 
478
        /.+.+/      {print $1}
 
479
        ' |sort |uniq >>$TDIR/slink1.useful
 
480
        rm useful.*
 
481
 
 
482
        # Check for non-US entries in these files - if we mention it then fix it...
 
483
        if [ "$NU"x != "1"x ] ; then
 
484
                vecho "non-US option not given, so removing non-US references from file lists"
 
485
                for file in $TDIR/slink*.list
 
486
                do
 
487
                        mv $file $file.1
 
488
                        vecho "    $file"
 
489
                        grep -v non-US $file.1 >$file
 
490
                done
 
491
        fi
 
492
fi
 
493
 
 
494
if [ $error -eq 0 ] ; then
 
495
    if [ "$GENLIST"x = "1"x ] ; then
 
496
                echo GENLIST:
 
497
        $BASEDIR/mklist "$MIRROR" "$BASEDIR" "$TDIR" "$ARCH" "$VERBOSE"
 
498
        
 
499
        cd $TDIR
 
500
 
 
501
        # Now combine the lists
 
502
                if [ ! -e slink1.list ] ; then
 
503
                        echo mklist step failed - $TDIR/slink1.list not found
 
504
                        echo Exit.
 
505
                        exit 1
 
506
                fi
 
507
                if [ ! -e list/OUT1 ] ; then
 
508
                        echo mklist step failed - $TDIR/list/OUT1 not found
 
509
                        echo Exit.
 
510
                        exit 1
 
511
                fi
 
512
        mv slink1.list slink1.list.orig
 
513
        cat slink1.list.orig | grep -v main/binary- >slink1.list
 
514
        cat list/OUT1 | sed 's/dists\/frozen/dists\/slink/g;s/dists\/stable/dists\/slink/g' >>slink1.list
 
515
        rm slink1.list.orig
 
516
 
 
517
                if [ "$SINGLE_DISK"x != "1"x ] ; then
 
518
                        # Now combine the lists
 
519
                        if [ ! -e slink2.list ] ; then
 
520
                                echo mklist step failed - $TDIR/slink2.list not found
 
521
                                echo Exit.
 
522
                                exit 1
 
523
                        fi
 
524
                        if [ ! -e list/OUT2 ] ; then
 
525
                                echo mklist step failed - $TDIR/list/OUT2 not found
 
526
                                echo Exit.
 
527
                                exit 1
 
528
                        fi
 
529
                        mv slink2.list slink2.list.orig
 
530
                        cat slink2.list.orig | grep -v main/binary- >slink2.list
 
531
                        cat list/OUT2 | sed 's/dists\/frozen/dists\/slink/g;s/dists\/stable/dists\/slink/g' >>slink2.list
 
532
                        rm slink2.list.orig
 
533
            fi
 
534
    fi
 
535
fi      
 
536
 
 
537
# Make sym-link farm for those people that need it...
 
538
if [ $error -eq 0 ] ; then
 
539
    if [ "$GENLINKS"x = "1"x ] ; then
 
540
                echo GENLINKS:
 
541
                vecho Making sym-link farm of parts of $MIRROR under $TDIR/tmp-mirror
 
542
        cd $TDIR
 
543
                mkdir tmp-mirror
 
544
                cd tmp-mirror
 
545
                cp -pRs $MIRROR/dists $MIRROR/doc $MIRROR/README* $MIRROR/hamm $MIRROR/indices $MIRROR/ls* $MIRROR/project $MIRROR/tools .
 
546
 
 
547
                # Copy non-US separately if necessary...
 
548
                if [ -L $MIRROR/dists/slink/non-US ] ; then
 
549
                        vecho Adding non-US
 
550
                        rm dists/slink/non-US
 
551
                        mkdir dists/slink/non-US
 
552
                        cp -dpRs $NONUS/slink/* dists/slink/non-US
 
553
                fi
 
554
 
 
555
                cd dists/slink
 
556
                vecho Putting binary-all links in
 
557
                find . | $BASEDIR/mklinks $VERBOSE
 
558
                MIRROR=$TDIR/tmp-mirror
 
559
        fi
 
560
fi
 
561
 
 
562
# Make initial tree(s)
 
563
if [ $error -eq 0 ] ; then
 
564
    if [ "$TREE"x = "1"x ] ; then
 
565
                echo TREE:
 
566
        cd $TDIR
 
567
 
 
568
                # First of all the general stuff to go on all disks.
 
569
        for i in $DISKLIST
 
570
        do
 
571
                        vecho Disk $i
 
572
                        vecho "   Make directories"
 
573
                        mkdir -p $TDIR/slink$i/dists/slink
 
574
                        mkdir -p $TDIR/slink$i/.disk
 
575
 
 
576
                        # Oops. We're copying the dists stuff into the root
 
577
                        # directory, the boot-floppies install stuff wants it in
 
578
                        # /debian. Simple fix...
 
579
                        cd $TDIR/slink$i
 
580
                        ln -s . debian 
 
581
 
 
582
                        # Set up symlinks so things may work.
 
583
                        cd dists 
 
584
                        ln -s slink stable 
 
585
#           Frozen no longer needed
 
586
#                       ln -s slink frozen
 
587
 
 
588
                        cd stable 
 
589
 
 
590
                        cd $TDIR                        
 
591
                        vecho "   Copy info file"
 
592
                        (cat slink$i.info | awk '{printf("%s",$0)}'; echo $DATE) \
 
593
                                        >slink$i/.disk/info
 
594
                        vecho "   Copy release notes"
 
595
                        cp $MIRROR/dists/slink/main/Release-Notes slink$i
 
596
                        vecho "   Copy README.1ST"
 
597
                        echo "This Debian CD was created by slink_cd version $SLINKCD_VERSION on $DATE" >slink$i/README.1ST
 
598
                        echo "slink_cd is available from $SLINKCD_SITE">>slink$i/README.1ST
 
599
                        echo "This disc is labelled" >>slink$i/README.1ST
 
600
                        echo "" >>slink$i/README.1ST
 
601
                        cat slink$i/.disk/info >>slink$i/README.1ST
 
602
                        if [ -e $BASEDIR/README.multicd ] ; then
 
603
                                vecho "   Copy README.multicd"
 
604
                                cat $BASEDIR/README.multicd >>slink$i/README.multicd
 
605
                        fi
 
606
                        todos slink$i/README.1ST
 
607
                        cd $MIRROR
 
608
                        vecho "   Create tree"
 
609
                        for file in `cat $TDIR/slink$i.list`
 
610
                        do 
 
611
                                cp -dpRPl $file $TDIR/slink$i
 
612
                        done
 
613
        done
 
614
 
 
615
                cd $TDIR                        
 
616
 
 
617
                # And now the arch-specific stuff, NOT to go on the source disks.
 
618
        for i in $BINLIST
 
619
        do
 
620
                        vecho Disk $i
 
621
                        vecho "   Make binary directories"
 
622
                        for SECT in $SECTLIST
 
623
                        do
 
624
                                mkdir -p slink$i/dists/slink/$SECT/binary-$ARCH
 
625
                                mkdir -p slink$i/dists/slink/$SECT/binary-all
 
626
                        done
 
627
                        vecho "   Finish README.1ST"
 
628
                        echo "" >>slink$i/README.1ST
 
629
                        if [ -e $BASEDIR/README.1ST.$ARCH ] ; then
 
630
                                cat $BASEDIR/README.1ST.$ARCH >>slink$i/README.1ST
 
631
                        fi
 
632
                        if [ -e $BASEDIR/README.$ARCH ] ; then
 
633
                                vecho "   Copy README.$ARCH"
 
634
                                cat $BASEDIR/README.$ARCH >>slink$i/README.$ARCH
 
635
                        fi
 
636
        done
 
637
 
 
638
                # Add the Release files, munging if necessary
 
639
        for i in $BINLIST
 
640
        do
 
641
                        vecho Disk $i
 
642
                        vecho "   add Release files"
 
643
                        for SECT in $SECTLIST
 
644
                        do
 
645
                                if [ -e slink$i/dists/slink/$SECT/binary-$ARCH/Release ] ; then
 
646
                                        rm -f slink$i/dists/slink/$SECT/binary-$ARCH/Release
 
647
                                fi
 
648
                                
 
649
                                if [ -d slink$i/dists/slink/$SECT/binary-$ARCH ] ; then
 
650
                                        if [ -e slink$i/dists/slink/$SECT/binary-$ARCH/Release ] ; then
 
651
                                                cat $MIRROR/dists/slink/$SECT/binary-$ARCH/Release \
 
652
                                                        | sed 's/frozen/stable/g' \
 
653
                                                        > slink$i/dists/slink/$SECT/binary-$ARCH/Release
 
654
                                        fi
 
655
                                fi
 
656
                        done
 
657
        done            
 
658
                
 
659
                # Add sym-links for the upgrade stuff if we have it.
 
660
                if [ "$ARCH"x = "i386"x ] ; then
 
661
                        vecho "Disk 1"
 
662
                        vecho "   upgrade-2.0-i386"
 
663
                        (cd $TDIR/slink1 && ln -s dists/stable/main/upgrade-2.0-i386)
 
664
                        vecho "   upgrade-older-i386"
 
665
                        (cd $TDIR/slink1 && ln -s dists/stable/main/upgrade-older-i386)
 
666
                fi
 
667
    fi
 
668
fi
 
669
 
 
670
# Fix the crypt++el_2.84-2.deb brokenness in non-US - temporary workaround...
 
671
if [ "$NU"x = "1"x ] ; then
 
672
        vecho "Looking for broken crypt++el_2.84-2.deb link in non-US..."
 
673
    cd $TDIR/slink2/dists/slink/non-US/binary-$ARCH
 
674
        if [ -L crypt++el_2.84-2.deb ] ; then
 
675
            link=`ls -l crypt++el_2.84-2.deb | awk '{print $11}'`
 
676
                if [ "$link"x != "../binary-all/crypt++el_2.84-2.deb"x ] ; then
 
677
                        vecho "Fixing it"
 
678
                        vecho rm crypt++el_2.84-2.deb
 
679
                        rm crypt++el_2.84-2.deb
 
680
                        vecho ln -s ../binary-all/crypt++el_2.84-2.deb
 
681
                        ln -s ../binary-all/crypt++el_2.84-2.deb
 
682
                        vecho cd ../binary-all
 
683
                        cd ../binary-all
 
684
                        vecho ln -s $NONUS/hamm/binary-all/crypt++el_2.84-2.deb
 
685
                        ln -s $NONUS/hamm/binary-all/crypt++el_2.84-2.deb
 
686
                else
 
687
                        vecho "You do not have it - good"
 
688
                fi
 
689
    fi
 
690
fi
 
691
 
 
692
# Generate the list of files we have
 
693
cd $TDIR
 
694
rm -f binary targz diffgz dsc
 
695
 
 
696
vecho Generating file list:
 
697
 
 
698
vecho '   *.deb'
 
699
for i in $BINLIST
 
700
do
 
701
        vecho "      slink$i"
 
702
        find slink$i -name *.deb >>binary
 
703
done
 
704
 
 
705
vecho '   *.tar.gz'
 
706
for i in $DISKLIST
 
707
do
 
708
        vecho "      slink$i"
 
709
        find slink$i -name *.tar.gz >>targz
 
710
done
 
711
 
 
712
vecho '   *.diff.gz'
 
713
for i in $DISKLIST
 
714
do
 
715
        vecho "      slink$i"
 
716
        find slink$i -name *.diff.gz >>diffgz
 
717
done
 
718
 
 
719
vecho '   *.dsc'
 
720
for i in $DISKLIST
 
721
do
 
722
        vecho "      slink$i"
 
723
        find slink$i -name *.dsc >>dsc
 
724
done
 
725
 
 
726
# Now we need to flatten out links pointing outside the tree
 
727
if [ $error -eq 0 ] ; then
 
728
    if [ "$FLATTEN"x = "1"x ] ; then
 
729
                echo FLATTEN:
 
730
                vecho Flattening external symlinks
 
731
        # This is done in perl.
 
732
        cat binary targz diffgz dsc | $BASEDIR/flatten "$MIRROR" "$NONUS" "$VERBOSE"
 
733
    fi
 
734
fi
 
735
 
 
736
# Now do a check for the MD5 sums of all the packages before creating
 
737
# the CD images. To avoid the pain of coping with different paths,
 
738
# cheat and make sym-links to the real files and compare against
 
739
# munged pathnames from the Packages files
 
740
 
 
741
if [ $error -eq 0 ] ; then
 
742
    if [ "$MD5CHECK"x = "1"x ] ; then
 
743
                echo MD5CHECK:
 
744
        # First grab all the details from the appropriate Packages files
 
745
                vecho Creating MD5 list of packages for comparison
 
746
        cd $MIRROR/dists/slink
 
747
 
 
748
                # build the list of packages files to read (either compressed or not)
 
749
                for SECT in $SECTLIST
 
750
                do
 
751
                        dir=$SECT/binary-$ARCH
 
752
                        if [ -e $dir/Packages ] ; then
 
753
                                PFILES="$PFILES $dir/Packages"
 
754
                        elif [ -e $dir/Packages.gz ]; then
 
755
                                PFILES="$PFILES $dir/Packages.gz"
 
756
                        else
 
757
                                echo "WARNING: no Packages file(s) found for $dir."
 
758
                        fi
 
759
                done
 
760
 
 
761
                # -f on zcat allows uncompressed files to be processed as well
 
762
                # We find the local list of packages as otherwise the
 
763
                # single_disk hack will fail, because of missing files that
 
764
                # would have gone on other discs. Unfortunately this means we
 
765
                # won't be able to detect missing files... Suggestions?
 
766
 
 
767
                echo "   binary"
 
768
                (cat $TDIR/binary | sed 's/.*\///g;s/_.*//g' ; cat $BASEDIR/EOP; zcat -f $PFILES) \
 
769
                        | grep -v '^#' |awk '
 
770
                        /END_OF_PROCESSING/             { yes_done++ ; next }
 
771
                        /.*/    { if(!yes_done) { yes[$1]=1 ; next } }
 
772
                        /^Package:/     {package=$2}
 
773
                        /^Filename:/    {filename[package]=$2}
 
774
                        /^MD5sum:/      {md5sum[package]=$2;
 
775
                                gsub(".*/","",filename[package]);
 
776
                                if(yes[package])
 
777
                                {
 
778
                                        printf("%32.32s  %s\n",md5sum[package],filename[package])
 
779
                                }
 
780
                        }
 
781
                        ' >$TDIR/debcheck_disks.1
 
782
 
 
783
                cd $TDIR
 
784
 
 
785
        # Now the sym-links
 
786
                vecho Creating package sym-links
 
787
        rm -rf md5
 
788
        mkdir md5
 
789
        # Use the list we already generated earlier...
 
790
        for file in `cat binary`
 
791
        do
 
792
                        ln -sf ../$file md5
 
793
        done
 
794
 
 
795
        # Compare
 
796
        vecho Comparing sums
 
797
        cd md5
 
798
        md5sum -c ../debcheck_disks.1
 
799
                vecho Checking file sizes
 
800
                find . -follow -size 0 >../sizecheck_disks.1
 
801
                if [ -s ../sizecheck_disks.1 ] ; then
 
802
                        echo "   Awooga!"
 
803
                        echo "   Awooga!"
 
804
                        echo "   Awooga!"
 
805
                        echo "   The following files are of zero size:"
 
806
                        cat ../sizecheck_disks.1
 
807
                        echo "This is fatal. Exit."
 
808
                        exit 1
 
809
                fi
 
810
        cd ..
 
811
        rm -rf md5
 
812
 
 
813
                echo "   source"
 
814
        # Now check source - use the .dsc files
 
815
        vecho Creating MD5 list of source files for comparison
 
816
        cat `cat dsc` | awk '
 
817
                        /^-----BEGIN PGP SIGNATURE/ {in_list=0}
 
818
                        {
 
819
                        if(in_list) {printf("%32.32s  %s\n",$1,$3)}
 
820
                        }
 
821
                        /^Files:/       {in_list=1}
 
822
                        ' >$TDIR/debcheck_disks.2
 
823
 
 
824
        # Now the sym-links
 
825
        vecho Creating source file sym-links
 
826
        if [ -d md5 ] ; then 
 
827
                        rm -rf md5
 
828
        fi
 
829
        mkdir md5
 
830
        # Use the list we already generated earlier...
 
831
        for file in `cat targz diffgz`
 
832
        do
 
833
                        ln -sf ../$file md5
 
834
        done
 
835
 
 
836
        # Compare
 
837
        vecho Comparing sums
 
838
        cd md5
 
839
        md5sum -c ../debcheck_disks.2
 
840
                vecho Checking file sizes
 
841
                find . -follow -size 0 >../sizecheck_disks.2
 
842
                if [ -s ../sizecheck_disks.2 ] ; then
 
843
                        echo "   Awooga!"
 
844
                        echo "   Awooga!"
 
845
                        echo "   Awooga!"
 
846
                        echo "   The following files are of zero size:"
 
847
                        cat ../sizecheck_disks.2
 
848
                        echo "This is fatal. Exit."
 
849
                        exit 1
 
850
                fi
 
851
        cd ..
 
852
        rm -rf md5
 
853
 
 
854
        # Next we need to look at the boot-disks
 
855
 
 
856
        vecho Checking boot disks areas:
 
857
        for dir in `find $TDIR | grep disks-$ARCH$`
 
858
        do
 
859
                        cd $dir
 
860
                        vecho $dir...
 
861
                        for dir1 in *
 
862
                        do
 
863
                                cd $dir1
 
864
                                vecho $dir/$dir1...
 
865
                                if [ -e md5sum.txt ] ; then
 
866
                                        md5sum -c md5sum.txt 
 
867
                                else
 
868
                                        echo WARNING: no md5sum.txt file found in $dir/$dir1
 
869
                                fi
 
870
                                cd ..
 
871
                        done
 
872
        done
 
873
    fi
 
874
fi
 
875
 
 
876
if [ $error -eq 0 ] ; then
 
877
    if [ "$PACKAGES"x = "1"x ] ; then
 
878
                echo PACKAGES:
 
879
        cd $TDIR
 
880
        rm -vf Packages-{main,contrib,non-US,non-free}.[12345]
 
881
 
 
882
        # Create Packages and Packages.cd files to go on the CDs
 
883
        # First lists by section and CD
 
884
        for i in $BINLIST
 
885
        do
 
886
                        echo Creating Packages-main for disc $i
 
887
                        if [ ! -e $MIRROR/indices/override.slink.gz ] ; then
 
888
                                echo "Override file $MIRROR/indices/override.slink.gz not found. We cannot" 
 
889
                                echo "generate our Packages file(s) without this file. Check you are mirroring the"
 
890
                                echo "indices/ directory"
 
891
                                echo "Exit."
 
892
                                exit 1
 
893
                        fi
 
894
                        (cd $TDIR/slink$i/dists/stable/main && \
 
895
                                dpkg-scanpackages -m "`cat $TDIR/slink$i/.disk/info`" \
 
896
                                binary-$ARCH $MIRROR/indices/override.slink.gz \
 
897
                                dists/stable/main/ > $TDIR/Packages-main.$i)
 
898
 
 
899
                        if [ "$SINGLE_DISK"x != "1"x ] ; then
 
900
                                echo Creating Packages-contrib for disc $i
 
901
                                if [ ! -e $MIRROR/indices/override.slink.contrib.gz ] ; then
 
902
                                        echo "Override file $MIRROR/indices/override.slink.contrib.gz not found. We cannot" 
 
903
                                        echo "generate our Packages file(s) without this file. Check you are mirroring the"
 
904
                                        echo "indices/ directory"
 
905
                                        echo "Exit."
 
906
                                        exit 1
 
907
                                fi
 
908
                                (cd $TDIR/slink$i/dists/stable/contrib && \
 
909
                                        dpkg-scanpackages -m "`cat $TDIR/slink$i/.disk/info`" \
 
910
                                        binary-$ARCH $MIRROR/indices/override.slink.contrib.gz \
 
911
                                        dists/stable/contrib/ > $TDIR/Packages-contrib.$i)
 
912
                        fi
 
913
 
 
914
                        if [ "$NU"x = "1"x ] ; then
 
915
                                echo Creating Packages-non-US for disc $i
 
916
                                # Hmmm, we have a problem here. My non-US mirror has the
 
917
                                # override file in $NONUS/indices but open has it in
 
918
                                # $MIRROR/indices (and with a different filename!!!)
 
919
                                # Check for both in turn...
 
920
                                OVER_NU=/foo # default catch-all
 
921
                                if [ -e $NONUS/indices/override.slink.nonus ] ; then
 
922
                                        OVER_NU=$NONUS/indices/override.slink.nonus
 
923
                                elif [ -e $NONUS/indices/override.slink.nonus.gz ] ; then
 
924
                                        OVER_NU=$NONUS/indices/override.slink.nonus.gz
 
925
                                elif [ -e $MIRROR/indices/override.non-us.slink ] ; then
 
926
                                        OVER_NU=$MIRROR/indices/override.non-us.slink
 
927
                                elif [ -e $MIRROR/indices/override.non-us.slink.gz ] ; then
 
928
                                        OVER_NU=$MIRROR/indices/override.non-us.slink.gz
 
929
                                fi
 
930
                                if [ ! -e "$OVER_NU" ] ; then
 
931
                                        echo "Override file "$OVER_NU" not found. We cannot" 
 
932
                                        echo "generate our Packages file(s) without this file. Check you are mirroring the"
 
933
                                        echo "indices/ directory"
 
934
                                        echo "Exit."
 
935
                                        exit 1
 
936
                                fi
 
937
                                (cd $TDIR/slink$i/dists/stable/non-US && \
 
938
                                        dpkg-scanpackages -m "`cat $TDIR/slink$i/.disk/info`" \
 
939
                                        binary-$ARCH $OVER_NU \
 
940
                                        dists/stable/non-US/ > $TDIR/Packages-non-US.$i)
 
941
                        fi
 
942
 
 
943
                        if [ "$NF"x = "1"x ] ; then
 
944
                                echo Creating Packages-non-free for disc $i
 
945
                                if [ ! -e $MIRROR/indices/override.slink.non-free.gz ] ; then
 
946
                                        echo "Override file $MIRROR/indices/override.slink.non-free.gz not found. We cannot" 
 
947
                                        echo "generate our Packages file(s) without this file. Check you are mirroring the"
 
948
                                        echo "indices/ directory"
 
949
                                        echo "Exit."
 
950
                                        exit 1
 
951
                                fi
 
952
                                (cd $TDIR/slink$i/dists/stable/non-free && \
 
953
                                        dpkg-scanpackages -m "`cat $TDIR/slink$i/.disk/info`" \
 
954
                                        binary-$ARCH $MIRROR/indices/override.slink.non-free.gz \
 
955
                                        dists/stable/non-free/ > $TDIR/Packages-non-free.$i)
 
956
                        fi
 
957
        done
 
958
 
 
959
                echo "Checking dependencies"
 
960
                echo "   CD #1"
 
961
                >/tmp/foo
 
962
                $BASEDIR/pkg-order --nocheck-conflicts --nooutput-order --installed-packages /tmp/foo $TDIR/Packages-main.1 >$TDIR/pkg-order.1 2>&1 
 
963
                if [ $? -gt 0 ] ; then
 
964
                        echo "Dependencies of CD #1 cannot be met:"
 
965
                    cat $TDIR/pkg-order.1
 
966
                        if [ "$FORCE_DEPENDS"x != "1"x ] ; then
 
967
                                echo Exit.
 
968
                                exit 1
 
969
                        fi
 
970
                else
 
971
                        echo "      seems OK"
 
972
                fi
 
973
 
 
974
                if [ "$SINGLE_DISK"x != "1"x ] ; then
 
975
                        echo "   All CDs"
 
976
                        # Use sed here to fix broken package Depends: line
 
977
                        cat $TDIR/Packages* | sed 's/^Suggests:\ metro-motif-devel\ (2/Suggests:\ metro-motif-devel\ (=\ 2/g' >$TDIR/Packages-all
 
978
                        $BASEDIR/pkg-order --nocheck-conflicts --nooutput-order --check-recommends --installed-packages /tmp/foo $TDIR/Packages-all >$TDIR/pkg-order.2 2>&1 
 
979
                        if [ $? -gt 0 ] ; then
 
980
                                echo Dependencies of the CD set cannot be met:
 
981
                                if [ "$NF"x = 1 -a "$NU"x = 1 ] ; then
 
982
                                        echo "As all sections have been covered, this is fatal..."
 
983
                                        if [ "$FORCE_DEPENDS"x != "1"x ] ; then
 
984
                                                echo Exit.
 
985
                                                exit 1
 
986
                                        fi
 
987
                                else
 
988
                                        echo "Not all sections have been included on the CD, so this is not fatal."
 
989
                                        echo "However, some packages (especially in the contrib section) will not install"
 
990
                                        echo "correctly."
 
991
                                fi
 
992
                        fi
 
993
                fi
 
994
 
 
995
        # Copy the generated Packages files into place on the
 
996
        # appropriate disks, then the Contents files
 
997
        for i in $BINLIST
 
998
        do
 
999
 
 
1000
                        # First of all, create normal-type Packages files
 
1001
                        for SECT in $SECTLIST
 
1002
                        do
 
1003
                                rm -f slink$i/dists/stable/$SECT/binary-$ARCH/Packages*
 
1004
                                cat Packages-$SECT.$i | \
 
1005
                                        grep -v ^X-Medium \
 
1006
                                        >slink$i/dists/stable/$SECT/binary-$ARCH/Packages
 
1007
                                cat Packages-$SECT.$i | grep -v ^X-Medium | \
 
1008
                                        gzip -9 >slink$i/dists/stable/$SECT/binary-$ARCH/Packages.gz
 
1009
                        done
 
1010
                        
 
1011
                        # Now the Packages.cd files
 
1012
                        vecho slink$i
 
1013
                        
 
1014
                        # Be slightly clever here - only copy Packages data for
 
1015
                        # disc nos. less than or equal to the one we're on - disc
 
1016
                        # 1 will not know about discs 2,5 but 5 will know about
 
1017
                        # both the others. The user should insert the last binary
 
1018
                        # disc they have for initial installation.
 
1019
 
 
1020
                        for j in $BINLIST
 
1021
                        do
 
1022
 
 
1023
                                if [ $j -le $i ] ; then
 
1024
                                        for SECT in $SECTLIST
 
1025
                                        do
 
1026
                                                if [ -e Packages-$SECT.$j ] ; then
 
1027
                                                        vecho "   Packages-$SECT.$j"
 
1028
                                                        cat Packages-$SECT.$j >> \
 
1029
                                                                slink$i/dists/stable/$SECT/binary-$ARCH/Packages.cd
 
1030
                                                        cat Packages-$SECT.$j | gzip -9 >> \
 
1031
                                                                slink$i/dists/stable/$SECT/binary-$ARCH/Packages.cd.gz
 
1032
                                                fi
 
1033
                                        done
 
1034
                                fi
 
1035
                        done
 
1036
 
 
1037
                        vecho "   Contents-$ARCH.gz"
 
1038
                        cp -pl $MIRROR/dists/slink/Contents-$ARCH.gz slink$i/dists/stable
 
1039
        done
 
1040
    fi
 
1041
fi
 
1042
 
 
1043
# Now fix the missing bits
 
1044
 
 
1045
if [ $error -eq 0 ] ; then
 
1046
    if [ "$BOOT"x = "1"x ] ; then
 
1047
                echo BOOT:              
 
1048
        vecho "Making bootable images for $ARCH..."
 
1049
        cd $TDIR
 
1050
 
 
1051
        mkdir -m 755 slink1/install
 
1052
        (cd slink1/dists/stable/main/disks-$ARCH/current/ ; \
 
1053
                        cp *.txt *.html $TDIR/slink1/install )
 
1054
 
 
1055
                (cd slink1/doc; 
 
1056
                        for file in ../install/*.{html,txt}; do ln -s $file; done)
 
1057
 
 
1058
        # Hack for bootable disks
 
1059
        rm -rf boot1 boot2
 
1060
        mkdir -p boot1/boot
 
1061
 
 
1062
                case "$ARCH"x in
 
1063
                "i386"x|"sparc"x|"m68k"x|"alpha"x)
 
1064
                        vecho "ARCH is $ARCH, we know what to do. Continuing..."
 
1065
 
 
1066
                        $BASEDIR/boot-$ARCH $MIRROR $BASEDIR $TDIR $ARCH $VERBOSE $BOOTDIR
 
1067
                        if [ $? -gt 0 ] ; then
 
1068
                                echo "boot-$ARCH failed. Exit."
 
1069
                                exit 1
 
1070
                        fi
 
1071
                        ;;
 
1072
                *)
 
1073
                        echo "Oops! We don't know what to do with $ARCH disks yet"
 
1074
                        echo "Leaving bootable CDs alone, you'll need to make boot"
 
1075
                        echo "floppies by hand to install."
 
1076
                        ;;
 
1077
                esac
 
1078
    fi
 
1079
fi
 
1080
 
 
1081
# define extra mkisofs flags for CD image creation
 
1082
# (this part cannot fit in the above section because it is not required to run
 
1083
# slink_cd with *both* BOOT & IMAGEx options enabled at one time)
 
1084
cd $TDIR
 
1085
case "$ARCH"x in
 
1086
        "i386"x)
 
1087
                if [ -d boot1 ]; then
 
1088
                        MKISOFS_OPTS_DISC1="-J -b boot/resc1440.bin -c boot/boot.catalog boot1"
 
1089
                fi
 
1090
                if [ -d boot2 ]; then
 
1091
                        MKISOFS_OPTS_DISC2="-J -b boot/resc1440tecra.bin -c boot/boot.catalog boot2"
 
1092
                fi
 
1093
                ;;
 
1094
        "sparc"x)
 
1095
                if [ -d boot1 ]; then
 
1096
                        MKISOFS_OPTS_DISC1="boot1"
 
1097
                        # move install tree to correct location
 
1098
                        if [ -d $TDIR/slink1/install ] ; then
 
1099
                                vecho "Moving install to boot1"
 
1100
                                rm -rf $TDIR/boot1/install || true
 
1101
                                mv $TDIR/slink1/install $TDIR/boot1
 
1102
                        fi
 
1103
                fi
 
1104
                ;;
 
1105
        "m68k"x)
 
1106
                if [ -d boot1 ]; then
 
1107
                        MKISOFS_OPTS_DISC1="-b install/bvme6000/resc1440.bin -c install/bvme6000/boot.catalog"
 
1108
                fi              
 
1109
                ;;
 
1110
        "alpha"x)
 
1111
                if [ -d boot1 ]; then
 
1112
                        MKISOFS_OPTS_DISC1="-J boot1"
 
1113
                fi
 
1114
                ;;
 
1115
        esac
 
1116
 
 
1117
if [ $error -eq 0 ] ; then
 
1118
    if [ "$EXTRAS"x = "1"x ] ; then
 
1119
                echo EXTRAS:
 
1120
        # Copy some extras onto disks to fill them, e.g. newest 2.1 and 
 
1121
        # 2.2 kernels and netscape
 
1122
        vecho Copying extras onto disks:
 
1123
        cd $TDIR
 
1124
        for i in $DISKLIST
 
1125
        do
 
1126
                        if [ -f $TDIR/slink$i.extras ] ; then
 
1127
                                vecho "   slink$i extras:"
 
1128
                                mkdir slink$i/extras
 
1129
                                cp -R `cat $TDIR/slink$i.extras` slink$i/extras
 
1130
                        else
 
1131
                                vecho "   slink$i has no extras"
 
1132
                        fi
 
1133
        done
 
1134
    fi
 
1135
fi
 
1136
 
 
1137
if [ $error -eq 0 ] ; then
 
1138
    if [ "$MD5LIST"x = "1"x ] ; then
 
1139
                echo MD5LIST:
 
1140
        vecho "Generating md5sums for contents of each disk:"
 
1141
        for i in $DISKLIST
 
1142
        do
 
1143
                        cd $TDIR/slink$i
 
1144
                        vecho "   Disk $i"
 
1145
                        find . -follow -type f | grep -v "\./md5sum" | grep -v "/dists/stable" | xargs md5sum > md5sum.txt
 
1146
                done
 
1147
                # Generate some sizes here. Unfortunately no use at all if we're
 
1148
                # using a sym-link farm...
 
1149
                if [ "$GENLINKS" != "1"x ] ; then
 
1150
                        vecho "Generating sizes of the trees"
 
1151
                        cd $TDIR
 
1152
                        du -l >du
 
1153
                fi
 
1154
    fi
 
1155
fi
 
1156
 
 
1157
if [ $error -eq 0 ] ; then
 
1158
 
 
1159
        # Add HFS flags for m68k/powerpc for macs
 
1160
        if [ "$ARCH"x = "powerpc"x -o "$ARCH"x = "m68k"x ] ; then
 
1161
                MKISOFS_OPTS="--netatalk -j -hfs -probe -map $BASEDIR/hfs.map $MKISOFS_OPTS"
 
1162
        fi
 
1163
 
 
1164
    cd $TDIR
 
1165
 
 
1166
        if [ ! -d $OUT ] ; then
 
1167
                mkdir -p $OUT
 
1168
        fi
 
1169
 
 
1170
    if [ "$IMAGE1"x = "1"x ] ; then
 
1171
                echo IMAGE1:
 
1172
                VOLID1=`cat $TDIR/slink1.volid`
 
1173
        vecho "Making image of slink1 to $OUT/slink1-$ARCH.raw"
 
1174
        vecho $MKISOFS $MKISOFS_OPTS -V "$VOLID1" \
 
1175
                        -o $OUT/slink1-$ARCH.raw $MKISOFS_OPTS_DISC1 slink1 
 
1176
        $MKISOFS $MKISOFS_OPTS -V "$VOLID1" \
 
1177
                        -o $OUT/slink1-$ARCH.raw $MKISOFS_OPTS_DISC1 slink1
 
1178
    fi
 
1179
 
 
1180
    if [ "$IMAGE2"x = "1"x ] ; then
 
1181
                echo IMAGE2:
 
1182
                VOLID2=`cat $TDIR/slink2.volid`
 
1183
        vecho "Making image of slink2 to $OUT/slink2-$ARCH.raw"
 
1184
        vecho $MKISOFS $MKISOFS_OPTS -V "$VOLID2" \
 
1185
          -o $OUT/slink2-$ARCH.raw $MKISOFS_OPTS_DISC2 slink2
 
1186
        $MKISOFS $MKISOFS_OPTS -V "$VOLID2" \
 
1187
          -o $OUT/slink2-$ARCH.raw $MKISOFS_OPTS_DISC2 slink2
 
1188
    fi
 
1189
 
 
1190
    if [ "$IMAGE3"x = "1"x ] ; then
 
1191
                echo IMAGE3:
 
1192
                VOLID3=`cat $TDIR/slink3.volid`
 
1193
        vecho "Making image of slink3 to $OUT/slink3.raw"
 
1194
        vecho $MKISOFS $MKISOFS_OPTS -V "$VOLID3" \
 
1195
          -o $OUT/slink3.raw $MKISOFS_OPTS_DISC3 slink3 
 
1196
        $MKISOFS $MKISOFS_OPTS -V "$VOLID3" \
 
1197
          -o $OUT/slink3.raw $MKISOFS_OPTS_DISC3 slink3
 
1198
    fi
 
1199
 
 
1200
    if [ "$IMAGE4"x = "1"x ] ; then
 
1201
                echo IMAGE4:
 
1202
                VOLID4=`cat $TDIR/slink4.volid`
 
1203
        vecho "Making image of slink4 to $OUT/slink4.raw"
 
1204
        vecho $MKISOFS $MKISOFS_OPTS -V "$VOLID4" \
 
1205
          -o $OUT/slink4.raw $MKISOFS_OPTS_DISC4 slink4 
 
1206
        $MKISOFS $MKISOFS_OPTS -V "$VOLID4" \
 
1207
          -o $OUT/slink4.raw $MKISOFS_OPTS_DISC4 slink4
 
1208
    fi
 
1209
 
 
1210
    if [ "$IMAGE5"x = "1"x ] ; then
 
1211
                echo IMAGE5:
 
1212
                VOLID5=`cat $TDIR/slink5.volid`
 
1213
        vecho "Making image of slink5 to $OUT/slink5-$ARCH.raw"
 
1214
                if [ "$NF"x = "1"x ] ; then
 
1215
        vecho $MKISOFS $MKISOFS_OPTS -V "$VOLID5" \
 
1216
          -o $OUT/slink5-$ARCH.raw $MKISOFS_OPTS_DISC5 slink5 
 
1217
        $MKISOFS $MKISOFS_OPTS -V "$VOLID5" \
 
1218
          -o $OUT/slink5-$ARCH.raw $MKISOFS_OPTS_DISC5 slink5
 
1219
        fi
 
1220
    fi
 
1221
fi
 
1222
 
 
1223
# post-process of generated images (eg. to make the CD image bootable on sparc)
 
1224
if [ $error -eq 0 ] ; then
 
1225
        if [ "$IMAGE1"x = "1"x ] ; then
 
1226
                if [ "$ARCH"x = "alpha"x ] ; then
 
1227
                        vecho "Making slink1 image bootable"
 
1228
                        isomarkboot $OUT/slink1-$ARCH.raw /boot/bootlx /dists/slink/main/disks-al/1999-03-/root1440.bin
 
1229
        fi
 
1230
                if [ "$ARCH"x = "sparc"x ] ; then
 
1231
                        # temporary mount point (eg. for silo to create the
 
1232
                        # bootable CD image) only needed for Sparc so far...
 
1233
                        vecho Checking for temporary mount point for SILO
 
1234
                        mountpoint=/var/tmp/slink_cd.mnt
 
1235
                        if [ -d $mountpoint ]; then
 
1236
                                        umount $mountpoint || true
 
1237
                        else
 
1238
                                        mkdir -p $mountpoint
 
1239
                        fi
 
1240
 
 
1241
                        vecho "Making slink1 image bootable"
 
1242
                        EXECARCH=`dpkg --print-installation-architecture`
 
1243
                        if [ "$EXECARCH"x = "sparc"x ]; then
 
1244
                                siloprog=silo
 
1245
                        elif [ "$EXECARCH"x = "i386"x ]; then
 
1246
                                siloprog=intelsilo
 
1247
                        fi
 
1248
                        if [ -n "$siloprog" ]; then
 
1249
                                cd1=/boot/debian.txt
 
1250
                                cd2=/install/linux-a.out
 
1251
                                cd3=/install/linux-2.2.1-a.out
 
1252
                                cd4=/install/linux-2.2.1-sun4u-a.out
 
1253
                                cd5=/install/root.bin
 
1254
                                echo "mount -o loop $OUT/slink1-$ARCH.raw $mountpoint"
 
1255
                                mount -o loop $OUT/slink1-$ARCH.raw $mountpoint
 
1256
                                vecho $siloprog -r $mountpoint -c $OUT/slink1-$ARCH.raw \
 
1257
                                        -C /boot/silo.conf -l $cd1,$cd2,$cd3,$cd4,$cd5
 
1258
                                $siloprog -r $mountpoint -c $OUT/slink1-$ARCH.raw \
 
1259
                                        -C /boot/silo.conf -l $cd1,$cd2,$cd3,$cd4,$cd5
 
1260
                                umount $mountpoint
 
1261
                        else
 
1262
                                echo "Don't know how to make the sparc bootable image on $EXECARCH system!"
 
1263
                        fi
 
1264
                fi
 
1265
    fi
 
1266
fi
 
1267
 
 
1268
if [ "$IMAGESUMS"x = "1"x ] ; then
 
1269
        echo IMAGESUMS:
 
1270
    # Let's make md5sums of the images for people who may be
 
1271
    # downloading them
 
1272
    cd $OUT
 
1273
        >MD5SUMS
 
1274
        vecho Generating md5sums for the CD images:
 
1275
        for file in *.raw
 
1276
        do
 
1277
                vecho "   $file"
 
1278
                md5sum $file >>MD5SUMS
 
1279
        done
 
1280
fi