aboutsummaryrefslogtreecommitdiffstats
path: root/create-commands.sh
blob: f61d0bec84567f520bf37fa8322cd4777ba3d213 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
#!/bin/bash


clear

# Set which arch you want to build
# alpha mips mips64 mips64-64 ppc ppc64 ppc64-64 sparc sparc64 sparc64-64 x86 x86_64 x86_64-64
ARCH=x86

# Double check the CLFS_TARGET variable with the book.
# Books other than x86 won't need this, but set this anyway
# The reason is the book commands expect the user to edit the
# CLFS_TARGET variable for the x86 book. Check if the target book
# requires CLFS_TARGET to be edited. Uncomment if not required.
# Move to the end of the file and uncommend the CLFS_TARGET sed
# If this can be commented and the book commands will set CLFS_TARGET.

#CLFS_TARGET=i686-pc-linux-gnu

# Set paper size for GROFF:  A4 or letter
PAGE=letter

#Set ZONEINFO to the time zone file to be copied to /etc/localtime
# /usr/share/zoneinfo/America/Chicago for example.
ZONEINFO=America/Chicago

CMDSDIR=/mnt/clfs/sources/commands/$ARCH # Directory with dumped book commands
SRCDIR=/mnt/clfs/sources # Directory for the created scripts

#===========BEGIN VERSION VARIABLES==============
ABOOT=0.9b
ARCLOAD=0.5
AUTOCONF=2.69
AUTOMAKE=1.12.4
BASH=4.2
BC=1.06.95
BINUTILS=2.23.2
BISON=3.0
BOOTSCRIPTS=2.1-pre1
BZIP2=1.0.6
CHECK=0.9.10
CLOOG=0.18.0
COLO=1.22
COREUTILS=8.21
DEJAGNU=1.5.1
DHCPCD=6.0.5
DIFFUTILS=3.3
DVHTOOL=1.0.1
E2FSPROGS=1.42.8
ELFTOAOUT=2.3
EGLIBC=2.18-r23806
EGLIBC2=2.18
EUDEV=1.2
EXPECT=5.45
FILE=5.14
FINDUTILS=4.4.2
FLEX=2.5.37
GAWK=4.1.0
GCC=4.8.1
GETTEXT=0.18.3.1
GMP=5.1.2
GREP=2.14
GROFF=1.22.2
GRUB=2.00
GZIP=1.6
HFSUTILS=3.2.6
IANAETC=2.30
IPROUTE2=3.10.0
IPUTILS=s20121221
ISL=0.12.1
KBD=2.0.0
KMOD=15
LESS=460
LIBEE=0.4.1
LIBESTR=0.1.5
LIBTOOL=2.4.2
LINUX=3.10.9
M4=1.4.16
MAKE=3.82
MAN=1.6g
MANPAGES=3.53
MPC=1.0.1
MPFR=3.1.2
NCURSES=5.9
PARTED=3.1
PATCH=2.7.1
PERL=5.18.1
PKGCONFIG=lite-0.28-1
POWERPCUTILS=1.1.3.orig
PROCPS=3.2.8
PSMISC=22.20
READLINE=6.2
RSYSLOG=6.4.2
SED=4.2.2
SHADOW=4.1.5.1
SILO=1.4.14
SYSVINIT=2.88dsf
TAR=1.26
TCL=8.6.0
TEXINFO=4.13a
TEXINFO2=4.13
UTILLINUX=2.23.2
VIM=7.4
VIM2=74
XZ=5.0.5
YABOOT=1.3.17
ZLIB=1.2.8

if [ "$ARCH" == "" ]; then
    echo "ARCH is not set. Please set a proper ARCH variable."
    echo -e "alpha mips mips64 mips64-64 ppc ppc64 sparc sparc64 sparc64-64 x86 x86_64 x86_64-64\n"
    exit
fi

for build in cross-tools temp-system testsuite-tools final-system; do

    if [ -e $SRCDIR/$build.sh ]; then
        rm $SRCDIR/$build.sh
    fi

    echo -e "#!/bin/bash\n\n" >> $SRCDIR/$build.sh;
    echo -e "set -e\n" >> $SRCDIR/$build.sh;
    if [ "$build" == "final-system" ]; then
       echo -e "set +h\n" >> $SRCDIR/$build.sh;
    fi

    if [ "$build" == "cross-tools" -o "$build" == "temp-system" ]; then
       echo "source $HOME/.bashrc  # this would be the clfs user's .bashrc if following the" >> $SRCDIR/$build.sh; 
       echo "               # CLFS book and using the clfs user." >> $SRCDIR/$build.sh;
    fi

    if [ "$build" == "testsuite-tools" -o "$build" == "final-system" ]; then
       echo -e "if [ -f /root/.bash_profile ]; then\n    source /root/.bash_profile\n    # this would be the root user's .bash_profile\n    # if following the CLFS book and using the booted root user\n    # or chrooted root user during multilib builds.\nfi" >> $SRCDIR/$build.sh;
    fi

    echo -e "mkdir -pv $SRCDIR/stamps\n\n" >> $SRCDIR/$build.sh; 

    if [ "$build" == "temp-system" ]; then
    echo -e "source ~/.bashrc\n" >> $SRCDIR/$build.sh;
    fi
    
    cd $CMDSDIR/$build &&

    for file in `echo *`; do
        pkg=`echo $file | sed 's/[0-9][0-9][0-9]-//'`;
        echo -e "#===========$pkg===============\n" >> $SRCDIR/$build.sh;
        echo -e "if [ ! -e \"stamps/$file\" ]; then" >> $SRCDIR/$build.sh;
        case "$pkg" in #Insert package extract and cd into source commands
          "aboot")
             echo "tar xf aboot-$ABOOT.tar.xz && cd aboot-$ABOOT" >> $SRCDIR/$build.sh;
          ;;
          "arcload")
             echo "tar xf arcload-$ARCLOAD.tar.xz && cd arcload-$ARCLOAD" >> $SRCDIR/$build.sh;
          ;;
          "autoconf")
             echo "tar xf autoconf-$AUTOCONF.tar.xz && cd autoconf-$AUTOCONF" >> $SRCDIR/$build.sh;
          ;;
          "automake")
             echo "tar xf automake-$AUTOMAKE.tar.xz && cd automake-$AUTOMAKE" >> $SRCDIR/$build.sh;
          ;;
          "bash")
             echo "tar xf bash-$BASH.tar.xz && cd bash-$BASH" >> $SRCDIR/$build.sh;
          ;;
          "bc")
             echo "tar xf bc-$BC.tar.xz && cd bc-$BC" >> $SRCDIR/$build.sh;
          ;;
          "binutils")
             echo "tar xf binutils-$BINUTILS.tar.xz && cd binutils-$BINUTILS" >> $SRCDIR/$build.sh;
          ;;
          "bison" | "bison-64bit" |  "bison-n32")
             echo "tar xf bison-$BISON.tar.xz && cd bison-$BISON" >> $SRCDIR/$build.sh;
          ;;
          "bootscripts")
             echo "tar xf bootscripts-$BOOTSCRIPTS.tar.xz && cd bootscripts-$BOOTSCRIPTS" >> $SRCDIR/$build.sh;
          ;;
          "bzip2" | "bzip2-64bit" |  "bzip2-n32")
             echo "tar xf bzip2-$BZIP2.tar.xz && cd bzip2-$BZIP2" >> $SRCDIR/$build.sh;
          ;;
          "cflags")
             echo "sed -i '/unset CFLAGS/d' ~/.bashrc" >> $SRCDIR/$build.sh;
             echo "sed -i '/unset CXXFLAGS/d' ~/.bashrc" >> $SRCDIR/$build.sh;
             echo "sed -i '/CLFS_HOST/d' ~/.bashrc" >> $SRCDIR/$build.sh;
             echo "sed -i '/CLFS_TARGET/d' ~/.bashrc" >> $SRCDIR/$build.sh;
             echo "sed -i '/CLFS_TARGET32/d' ~/.bashrc" >> $SRCDIR/$build.sh;
             echo "sed -i '/CC/d' ~/.bashrc" >> $SRCDIR/$build.sh;
             echo "sed -i '/CXX/d' ~/.bashrc" >> $SRCDIR/$build.sh;
             echo "sed -i '/AR/d' ~/.bashrc" >> $SRCDIR/$build.sh;
             echo "sed -i '/AS/d' ~/.bashrc" >> $SRCDIR/$build.sh;
             echo "sed -i '/RANLIB/d' ~/.bashrc" >> $SRCDIR/$build.sh;
             echo "sed -i '/LD/d' ~/.bashrc" >> $SRCDIR/$build.sh;
             echo "sed -i '/STRIP/d' ~/.bashrc" >> $SRCDIR/$build.sh;
             echo "sed -i '/BUILD32/d' ~/.bashrc" >> $SRCDIR/$build.sh;
             echo "sed -i '/BUILDN32/d' ~/.bashrc" >> $SRCDIR/$build.sh;
             echo "sed -i '/BUILD64/d' ~/.bashrc" >> $SRCDIR/$build.sh;
             echo "sed -i '/GCCTARGET/d' ~/.bashrc" >> $SRCDIR/$build.sh;
          ;;
          "choose")
             echo "echo \"If the following command fails, you won't be able to chroot with your host machine. Read the choose to boot or chroot section for more information.\"" >> $SRCDIR/$build.sh;
          ;;
         "check")
             echo "tar xf check-$CHECK.tar.xz && cd check-$CHECK" >> $SRCDIR/$build.sh;
          ;;
          "cloog" | "cloog-64bit" |  "cloog-n32")
             echo "tar xf cloog-$CLOOG.tar.xz && cd cloog-$CLOOG" >> $SRCDIR/$build.sh;
          ;;
          "colo")
             echo "tar xf colo-$COLO.tar.xz && cd colo-$COLO" >> $SRCDIR/$build.sh;
          ;;
          "coreutils")
             echo "tar xf coreutils-$COREUTILS.tar.xz && cd coreutils-$COREUTILS" >> $SRCDIR/$build.sh;
          ;;
          "dejagnu")
             echo "tar xf dejagnu-$DEJAGNU.tar.xz && cd dejagnu-$DEJAGNU" >> $SRCDIR/$build.sh;
          ;;
          "dhcpcd")
             echo "tar xf dhcpcd-$DHCPCD.tar.xz && cd dhcpcd-$DHCPCD" >> $SRCDIR/$build.sh;
          ;;
          "diffutils")
             echo "tar xf diffutils-$DIFFUTILS.tar.xz && cd diffutils-$DIFFUTILS" >> $SRCDIR/$build.sh;
          ;;
          "dvhtool")
             echo "tar xf dvhtool_$DVHTOOL.orig.tar.xz && cd dvhtool-$DVHTOOL" >> $SRCDIR/$build.sh;
          ;;
          "e2fsprogs" | "e2fsprogs-64bit" |  "e2fsprogs-n32")
             echo "tar xf e2fsprogs-$E2FSPROGS.tar.xz && cd e2fsprogs-$E2FSPROGS" >> $SRCDIR/$build.sh;
          ;;
          "eglibc" | "eglibc-64" | "eglibc-64bit" |  "eglibc-n32")
             echo "tar xf eglibc-$EGLIBC.tar.xz && cd eglibc-$EGLIBC2" >> $SRCDIR/$build.sh;
          ;;
          "elf2aout")
             echo "tar xf elf2aout-$ELFTOAOUT.tar.xz && cd elftoaout-$ELFTOAOUT" >> $SRCDIR/$build.sh;
          ;;
          "eudev" | "eudev-64bit" |  "eudev-n32")
             echo "tar xf eudev-$EUDEV.tar.xz && cd eudev-$EUDEV" >> $SRCDIR/$build.sh;
          ;;
          "expect")
             echo "tar xf expect$EXPECT.tar.xz && cd expect$EXPECT" >> $SRCDIR/$build.sh;
          ;;
          "file" | "file-64bit" |  "file-n32")
             echo "tar xf file-$FILE.tar.xz && cd file-$FILE" >> $SRCDIR/$build.sh;
          ;;
          "findutils")
             echo "tar xf findutils-$FINDUTILS.tar.xz && cd findutils-$FINDUTILS" >> $SRCDIR/$build.sh;
          ;;
          "flex" | "flex-64bit" |  "flex-n32")
             echo "tar xf flex-$FLEX.tar.xz && cd flex-$FLEX" >> $SRCDIR/$build.sh;
          ;;
          "gawk")
             echo "tar xf gawk-$GAWK.tar.xz && cd gawk-$GAWK" >> $SRCDIR/$build.sh;
          ;;
          "gcc" | "gcc-static" | "gcc-final")
             echo "tar xf gcc-$GCC.tar.xz && cd gcc-$GCC" >> $SRCDIR/$build.sh;
          ;;
          "gettext" | "gettext-64bit" |  "gettext-n32")
             echo "tar xf gettext-$GETTEXT.tar.xz && cd gettext-$GETTEXT" >> $SRCDIR/$build.sh;
          ;;
          "gmp" | "gmp-64bit" |  "gmp-n32")
             echo "tar xf gmp-$GMP.tar.xz && cd gmp-$GMP" >> $SRCDIR/$build.sh;
          ;;
          "grep")
             echo "tar xf grep-$GREP.tar.xz && cd grep-$GREP" >> $SRCDIR/$build.sh;
          ;;
          "groff")
             echo "tar xf groff-$GROFF.tar.xz && cd groff-$GROFF" >> $SRCDIR/$build.sh;
          ;;
          "grub")
             echo "tar xf grub-$GRUB.tar.xz && cd grub-$GRUB" >> $SRCDIR/$build.sh;
          ;;
          "gzip")
             echo "tar xf gzip-$GZIP.tar.xz && cd gzip-$GZIP" >> $SRCDIR/$build.sh;
          ;;
          "hfsutils")
             echo "tar xf hfsutils-$HFSUTILS.tar.xz && cd hfsutils-$HFSUTILS" >> $SRCDIR/$build.sh;
          ;;
          "iana-etc")
             echo "tar xf iana-etc-$IANAETC.tar.xz && cd iana-etc-$IANAETC" >> $SRCDIR/$build.sh;
          ;;
          "iproute2")
             echo "tar xf iproute2-$IPROUTE2.tar.xz && cd iproute2-$IPROUTE2" >> $SRCDIR/$build.sh;
          ;;
          "iputils")
             echo "tar xf iputils-$IPUTILS.tar.xz && cd iputils-$IPUTILS" >> $SRCDIR/$build.sh;
          ;;
          "isl" | "isl-64bit" |  "isl-n32")
             echo "tar xf isl-$ISL.tar.xz && cd isl-$ISL" >> $SRCDIR/$build.sh;
          ;;
          "kbd")
             echo "tar xf kbd-$KBD.tar.xz && cd kbd-$KBD" >> $SRCDIR/$build.sh;
          ;;
          "kmod" | "kmod-64bit" |  "kmod-n32")
             echo "tar xf kmod-$KMOD.tar.xz && cd kmod-$KMOD" >> $SRCDIR/$build.sh;
          ;;
          "less")
             echo "tar xf less-$LESS.tar.xz && cd less-$LESS" >> $SRCDIR/$build.sh;
          ;;
          "libee" | "libee-64bit" |  "libee-n32")
             echo "tar xf libee-$LIBEE.tar.xz && cd libee-$LIBEE" >> $SRCDIR/$build.sh;
          ;;
          "libestr" | "libestr-64bit" |  "libestr-n32")
             echo "tar xf libestr-$LIBESTR.tar.xz && cd libestr-$LIBESTR" >> $SRCDIR/$build.sh;
          ;;
          "libtool" | "libtool-64bit" |  "libtool-n32")
             echo "tar xf libtool-$LIBTOOL.tar.xz && cd libtool-$LIBTOOL" >> $SRCDIR/$build.sh;
          ;;
          "linux" | "linux-headers")
             echo "tar xf linux-$LINUX.tar.xz && cd linux-$LINUX" >> $SRCDIR/$build.sh;
          ;;
          "m4")
             echo "tar xf m4-$M4.tar.xz && cd m4-$M4" >> $SRCDIR/$build.sh;
          ;;
          "make")
             echo "tar xf make-$MAKE.tar.xz && cd make-$MAKE" >> $SRCDIR/$build.sh;
          ;;
          "man")
             echo "tar xf man-$MAN.tar.xz && cd man-$MAN" >> $SRCDIR/$build.sh;
          ;;
          "man-pages")
             echo "tar xf man-pages-$MANPAGES.tar.xz && cd man-pages-$MANPAGES" >> $SRCDIR/$build.sh;
          ;;
          "mpc" | "mpc-64bit" |  "mpc-n32")
             echo "tar xf mpc-$MPC.tar.xz && cd mpc-$MPC" >> $SRCDIR/$build.sh;
          ;;
          "mpfr" | "mpfr-64bit" |  "mpfr-n32")
             echo "tar xf mpfr-$MPFR.tar.xz && cd mpfr-$MPFR" >> $SRCDIR/$build.sh;
          ;;
          "ncurses" | "ncurses-64bit" |  "ncurses-n32")
             echo "tar xf ncurses-$NCURSES.tar.xz && cd ncurses-$NCURSES" >> $SRCDIR/$build.sh;
          ;;
          "parted")
             echo "tar xf parted-$PARTED.tar.xz && cd parted-$PARTED" >> $SRCDIR/$build.sh;
          ;;
          "powerpc-utils")
             echo "tar xf powerpc-utils_$POWERPCUTILS.tar.xz && cd pmac-utils" >> $SRCDIR/$build.sh;
          ;;
          "patch")
             echo "tar xf patch-$PATCH.tar.xz && cd patch-$PATCH" >> $SRCDIR/$build.sh;
          ;;
          "perl" | "perl-64bit" |  "perl-n32" | "temp-perl")
             echo "tar xf perl-$PERL.tar.xz && cd perl-$PERL" >> $SRCDIR/$build.sh;
          ;;
          "pkg-config")
             echo "tar xf pkg-config-$PKGCONFIG.tar.xz && cd pkg-config-$PKGCONFIG" >> $SRCDIR/$build.sh;
          ;;
          "procps" | "procps-64bit" |  "procps-n32")
             echo "tar xf procps-$PROCPS.tar.xz && cd procps-$PROCPS" >> $SRCDIR/$build.sh;
          ;;
          "psmisc")
             echo "tar xf psmisc-$PSMISC.tar.xz && cd psmisc-$PSMISC" >> $SRCDIR/$build.sh;
          ;;
          "readline" | "readline-64bit" |  "readline-n32")
             echo "tar xf readline-$READLINE.tar.xz && cd readline-$READLINE" >> $SRCDIR/$build.sh;
          ;;
          "rsyslog")
             echo "tar xf rsyslog-$RSYSLOG.tar.xz && cd rsyslog-$RSYSLOG" >> $SRCDIR/$build.sh;
          ;;
          "sed")
             echo "tar xf sed-$SED.tar.xz && cd sed-$SED" >> $SRCDIR/$build.sh;
          ;;
          "shadow")
             echo "tar xf shadow-$SHADOW.tar.xz && cd shadow-$SHADOW" >> $SRCDIR/$build.sh;
          ;;
          "silo")
             echo "tar xf silo-$SILO.tar.xz && cd silo-$SILO" >> $SRCDIR/$build.sh;
          ;;
          "sysvinit")
             echo "tar xf sysvinit-$SYSVINIT.tar.xz && cd sysvinit-$SYSVINIT" >> $SRCDIR/$build.sh;
          ;;
          "tar")
             echo "tar xf tar-$TAR.tar.xz && cd tar-$TAR" >> $SRCDIR/$build.sh;
          ;;
          "tcl")
             echo "tar xf tcl${TCL}-src.tar.xz && cd tcl$TCL" >> $SRCDIR/$build.sh;
          ;;
          "texinfo")
             echo "tar xf texinfo-$TEXINFO.tar.xz && cd texinfo-$TEXINFO2" >> $SRCDIR/$build.sh;
          ;;
          "util-linux" | "util-linux-64bit" |  "util-linux-n32")
             echo "tar xf util-linux-$UTILLINUX.tar.xz && cd util-linux-$UTILLINUX" >> $SRCDIR/$build.sh;
          ;;
          "vim")
             echo "tar xf vim-$VIM.tar.xz && cd vim$VIM2" >> $SRCDIR/$build.sh;
          ;;
          "xz" | "xz-64bit" |  "xz-n32")
             echo "tar xf xz-$XZ.tar.xz && cd xz-$XZ" >> $SRCDIR/$build.sh;
          ;;
          "yaboot")
             echo "tar xf yaboot-$YABOOT.tar.xz && cd yaboot-$YABOOT" >> $SRCDIR/$build.sh;
          ;;
          "zlib" | "zlib-64bit" |  "zlib-n32")
             echo "tar xf zlib-$ZLIB.tar.xz && cd zlib-$ZLIB" >> $SRCDIR/$build.sh;
          ;;
        esac

        cat $file >> $SRCDIR/$build.sh;

        case "$pkg" in #Insert source / build directory removal commands
          "aboot")
             echo "cd .. && rm -rf aboot-$ABOOT" >> $SRCDIR/$build.sh;
          ;;
          "arcload")
             echo "cd .. && rm -rf arcload-$ARCLOAD" >> $SRCDIR/$build.sh;
          ;;
          "autoconf")
             echo "cd .. && rm -rf autoconf-$AUTOCONF"  >> $SRCDIR/$build.sh;
          ;;
          "automake")
             echo "cd .. && rm -rf automake-$AUTOMAKE"  >> $SRCDIR/$build.sh;
          ;;
          "bash")
             echo "cd .. && rm -rf bash-$BASH"  >> $SRCDIR/$build.sh;
          ;;
          "bc")
             echo "cd .. && rm -rf bc-$BC"  >> $SRCDIR/$build.sh;
          ;;
          "binutils")
             echo "cd .. && rm -rf binutils-$BINUTILS binutils-build"  >> $SRCDIR/$build.sh;
          ;;
          "bison" | "bison-64bit" |  "bison-n32")
             echo "cd .. && rm -rf bison-$BISON"  >> $SRCDIR/$build.sh;
          ;;
          "bootscripts")
             echo "cd .. && rm -rf bootscripts-$BOOTSCRIPTS"  >> $SRCDIR/$build.sh;
          ;;
          "bzip2" | "bzip2-64bit" |  "bzip2-n32")
             echo "cd .. && rm -rf bzip2-$BZIP2"  >> $SRCDIR/$build.sh;
          ;;
          "check")
             echo "cd .. && rm -rf check-$CHECK"  >> $SRCDIR/$build.sh;
          ;;
          "cloog" | "cloog-64bit" |  "cloog-n32")
             echo "cd .. && rm -rf cloog-$CLOOG"  >> $SRCDIR/$build.sh;
          ;;
          "colo")
             echo "cd .. && rm -rf colo-$COLO" >> $SRCDIR/$build.sh;
          ;;
          "coreutils")
             echo "cd .. && rm -rf coreutils-$COREUTILS"  >> $SRCDIR/$build.sh;
          ;;
          "dejagnu")
             echo "cd .. && rm -rf dejagnu-$DEJAGNU"  >> $SRCDIR/$build.sh;
          ;;
          "dhcpcd")
             echo "cd .. && rm -rf dhcpcd-$DHCPCD"  >> $SRCDIR/$build.sh;
          ;;
          "diffutils")
             echo "cd .. && rm -rf diffutils-$DIFFUTILS"  >> $SRCDIR/$build.sh;
          ;;
          "dvhtool")
             echo "cd .. && rm -rf dvhtool-$DVHTOOL.orig" >> $SRCDIR/$build.sh;
          ;;
          "e2fsprogs" | "e2fsprogs-64bit" |  "e2fsprogs-n32")
             echo "cd ../../ && rm -rf e2fsprogs-$E2FSPROGS" >> $SRCDIR/$build.sh
          ;;
          "eglibc" | "eglibc-64" | "eglibc-64bit" |  "eglibc-n32")
             echo "cd .. && rm -rf eglibc-$EGLIBC2 eglibc-build"  >> $SRCDIR/$build.sh;
          ;;
          "elftoaout")
             echo "cd .. && rm -rf elftoaout-$ELFTOAOUT" >> $SRCDIR/$build.sh;
          ;;
          "eudev" | "eudev-64bit" |  "eudev-n32")
             echo "cd .. && rm -rf eudev-$EUDEV"  >> $SRCDIR/$build.sh;
          ;;
          "expect")
             echo "cd .. && rm -rf expect$EXPECT"  >> $SRCDIR/$build.sh;
          ;;
          "file" | "file-64bit" |  "file-n32")
             echo "cd .. && rm -rf file-$FILE"  >> $SRCDIR/$build.sh;
          ;;
          "findutils")
             echo "cd .. && rm -rf findutils-$FINDUTILS"  >> $SRCDIR/$build.sh;
          ;;
          "flex" | "flex-64bit" |  "flex-n32")
             echo "cd .. && rm -rf flex-$FLEX"  >> $SRCDIR/$build.sh;
          ;;
          "gawk")
             echo "cd .. && rm -rf gawk-$GAWK"  >> $SRCDIR/$build.sh;
          ;;
          "gcc" | "gcc-static" | "gcc-final")
             echo "cd .. && rm -rf gcc-$GCC gcc-build"  >> $SRCDIR/$build.sh;
          ;;
          "gettext" | "gettext-64bit" |  "gettext-n32")
             if [ "$build" == "temp-system" ]; then
                 echo "cd ../../ && rm -rf gettext-$GETTEXT" >> $SRCDIR/$build.sh;
             else
                 echo "cd .. && rm -rf gettext-$GETTEXT"  >> $SRCDIR/$build.sh;
             fi
          ;;
          "gmp" | "gmp-64bit" |  "gmp-n32")
             echo "cd .. && rm -rf gmp-$GMP"  >> $SRCDIR/$build.sh;
          ;;
          "grep")
             echo "cd .. && rm -rf grep-$GREP"  >> $SRCDIR/$build.sh;
          ;;
          "groff")
             echo "cd .. && rm -rf groff-$GROFF"  >> $SRCDIR/$build.sh;
          ;;
          "grub")
             echo "cd .. && rm -rf grub-$GRUB" >> $SRCDIR/$build.sh;
          ;;
          "gzip")
             echo "cd .. && rm -rf gzip-$GZIP"  >> $SRCDIR/$build.sh;
          ;;
          "hfsutils")
             echo "cd .. && rm -rf hfsutils-$HFSUTILS"  >> $SRCDIR/$build.sh;
          ;;
          "iana-etc")
             echo "cd .. && rm -rf iana-etc-$IANAETC"  >> $SRCDIR/$build.sh;
          ;;
          "iproute2")
             echo "cd .. && rm -rf iproute2-$IPROUTE2"  >> $SRCDIR/$build.sh;
          ;;
          "iputils")
             echo "cd .. && rm -rf iputils-$IPUTILS"  >> $SRCDIR/$build.sh;
          ;;
          "isl" | "isl-64bit" |  "isl-n32")
             echo "cd .. && rm -rf isl-$ISL"  >> $SRCDIR/$build.sh;
          ;;
          "kbd")
             echo "cd .. && rm -rf kbd-$KBD"  >> $SRCDIR/$build.sh;
          ;;
          "kmod" | "kmod-64bit" |  "kmod-n32")
             echo "cd .. && rm -rf kmod-$KMOD"  >> $SRCDIR/$build.sh;
          ;;
          "less")
             echo "cd .. && rm -rf less-$LESS"  >> $SRCDIR/$build.sh;
          ;;
          "libee" | "libee-64bit" |  "libee-n32")
             echo "cd .. && rm -rf libee-$LIBEE"  >> $SRCDIR/$build.sh;
          ;;
          "libestr" | "libestr-64bit" |  "libestr-n32")
             echo "cd .. && rm -rf libestr-$LIBESTR"  >> $SRCDIR/$build.sh;
          ;;
          "libtool" | "libtool-64bit" |  "libtool-n32")
             echo "cd .. && rm -rf libtool-$LIBTOOL"  >> $SRCDIR/$build.sh;
          ;;
          "linux" | "linux-headers")
             echo "cd .. && rm -rf linux-$LINUX"  >> $SRCDIR/$build.sh;
          ;;
          "m4")
             echo "cd .. && rm -rf m4-$M4"  >> $SRCDIR/$build.sh;
          ;;
          "make")
             echo "cd .. && rm -rf make-$MAKE"  >> $SRCDIR/$build.sh;
          ;;
          "man")
             echo "cd .. && rm -rf man-$MAN"  >> $SRCDIR/$build.sh;
          ;;
          "man-pages")
             echo "cd .. && rm -rf man-pages-$MANPAGES"  >> $SRCDIR/$build.sh;
          ;;
          "mpc" | "mpc-64bit" |  "mpc-n32")
             echo "cd .. && rm -rf mpc-$MPC"  >> $SRCDIR/$build.sh;
          ;;
          "mpfr" | "mpfr-64bit" |  "mpfr-n32")
             echo "cd .. && rm -rf mpfr-$MPFR"  >> $SRCDIR/$build.sh;
          ;;
          "ncurses" | "ncurses-64bit" |  "ncurses-n32")
             echo "cd .. && rm -rf ncurses-$NCURSES"  >> $SRCDIR/$build.sh;
          ;;
          "parted")
             echo "cd .. && rm -rf parted-$PARTED"  >> $SRCDIR/$build.sh;
          ;;
          "powerpc-utils")
             echo "cd .. && rm -rf pmac-utils"  >> $SRCDIR/$build.sh;
          ;;
          "patch")
             echo "cd .. && rm -rf patch-$PATCH"  >> $SRCDIR/$build.sh;
          ;;
          "perl" | "perl-64bit" |  "perl-n32" | "temp-perl")
             echo "cd .. && rm -rf perl-$PERL"  >> $SRCDIR/$build.sh;
          ;;
          "pkg-config")
             echo "cd .. && rm -rf pkg-config-$PKGCONFIG"  >> $SRCDIR/$build.sh;
          ;;
          "procps" | "procps-64bit" |  "procps-n32")
             echo "cd .. && rm -rf procps-$PROCPS"  >> $SRCDIR/$build.sh;
          ;;
          "psmisc")
             echo "cd .. && rm -rf psmisc-$PSMISC"  >> $SRCDIR/$build.sh;
          ;;
          "readline" | "readline-64bit" |  "readline-n32")
             echo "cd .. && rm -rf readline-$READLINE"  >> $SRCDIR/$build.sh;
          ;;
          "rsyslog")
             echo "cd .. && rm -rf rsyslog-$RSYSLOG"  >> $SRCDIR/$build.sh;
          ;;
          "sed")
             echo "cd .. && rm -rf sed-$SED"  >> $SRCDIR/$build.sh;
          ;;
          "shadow")
             echo "cd .. && rm -rf shadow-$SHADOW"  >> $SRCDIR/$build.sh;
          ;;
          "silo")
             echo "cd .. && rm -rf silo-$SILO" >> $SRCDIR/$build.sh;
          ;;
          "sysvinit")
             echo "cd .. && rm -rf sysvinit-$SYSVINIT"  >> $SRCDIR/$build.sh;
          ;;
          "tar")
             echo "cd .. && rm -rf tar-$TAR"  >> $SRCDIR/$build.sh;
          ;;
          "tcl")
             echo "cd ../../ && rm -rf tcl$TCL"  >> $SRCDIR/$build.sh;
          ;;
          "texinfo")
             echo "cd .. && rm -rf texinfo-$TEXINFO2"  >> $SRCDIR/$build.sh;
          ;;
          "util-linux" | "util-linux-64bit" |  "util-linux-n32")
             echo "cd .. && rm -rf util-linux-$UTILLINUX" >> $SRCDIR/$build.sh;
          ;;
           "vim")
             echo "cd .. && rm -rf vim$VIM2"  >> $SRCDIR/$build.sh;
          ;;
          "xz" | "xz-64bit" |  "xz-n32")
             echo "cd .. && rm -rf xz-$XZ"  >> $SRCDIR/$build.sh;
          ;;
          "yaboot")
             echo "cd .. && rm -rf yaboot-$YABOOT"  >> $SRCDIR/$build.sh;
          ;;
          "zlib" | "zlib-64bit" |  "zlib-n32")
             echo "cd .. && rm -rf zlib-$ZLIB"  >> $SRCDIR/$build.sh;
          ;;
        esac 

        echo -e "touch \"stamps/${file}\"" >> $SRCDIR/$build.sh;
        echo -e "fi\n" >> $SRCDIR/$build.sh;
    done

done

sed -i 's@/mnt/clfs@@g' $SRCDIR/{testsuite-tools,final-system}.sh

# comment the following line if the book being used sets CLFS_TARGET
#sed -i "s@\[target triplet\]@$CLFS_TARGET@" $SRCDIR/cross-tools.sh;
echo "Setting ZONEINFO for eglibc in final-system.sh";
sed -i "s@\*\*EDITME\[xxx\]EDITME\*\*@$ZONEINFO@" $SRCDIR/final-system.sh;
echo "Setting PAGE for groff paper size in final-system.sh";
sed -i "s@\*\*EDITME\[paper_size\]EDITME\*\*@$PAGE@" $SRCDIR/final-system.sh;
echo -e "\nVerify CLFS_TARGET is correct in cross-tools.sh"
echo -e "\n Verify ZONEINFO data file is correct at eglibc in final-system.sh";
echo -e "\n  Verify PAGE paper size is correct at groff in final-system.sh";
echo -e "\n   Check GMP page in chapter 10 and gmp section in finalsystem.sh";
echo -e "\n    If you don't want checks, remove those commands from final-system.sh";

echo -e "echo \"Do not forget to set the root password before booting into your new systems. See the shadow instruction page at chapter 10 in the book.\"" >> $SRCDIR/final-system.sh;