source: /cluster/svnroot/bccd-ng/branches/sam-test_fw/bin/build_livecd.pl @ 3007

Last change on this file since 3007 was 3007, checked in by leemasa, 10 years ago

Added newlines

  • Property svn:executable set to *
File size: 34.6 KB
Line 
1#!/usr/bin/perl
2
3#BCCD ISO build script
4
5use strict;
6use warnings;
7use lib "../trees/usr/local/lib/site_perl/5.10.0";
8use Getopt::Long;
9use Pod::Usage;
10use File::Path;
11use File::Temp;
12use File::Copy;
13use WWW::Mechanize;
14use POSIX;
15use Bccd;
16use Cwd;
17use Bccd::TestDb qw/open_db insert_results/;
18use Readonly;
19
20$ENV{LANGUAGE} = "C";
21$ENV{LC_ALL} = "C";
22$ENV{LANG} = "C";
23
24my %opts;
25
26my($debmirror,$websvn,$rc,$out,$ft,$tmpdir,$cwd,$svnrev,
27   $Bccd,$allout,$rpkgs,$nouid,$nogid,$debmirror_host,
28   $debmirror_name,$debsecmirror,$dir);
29my(@lsof,@pids,@rd);
30
31GetOptions(
32    'arch=s' => \$opts{'arch'},
33    'outiso=s' => \$opts{'outiso'},
34    'suite=s' => \$opts{'suite'},
35    'nocleanup' => \$opts{'nocleanup'},
36    'updatedb=s' => \$opts{'updatedb'},
37    'svnrev=i' => \$opts{'svnrev'},
38    "debug" => \$opts{'debug'},
39    "info" => \$opts{'info'},
40    "debmirror=s" => \$opts{'debmirror'},
41    "websvn=s" => \$opts{'websvn'},
42    "dir=s" => \$opts{'dir'},
43    'help' => \$opts{'help'}
44    );
45
46if($opts{'help'}) {
47    pod2usage(-verbose => 2);
48}
49
50if(!$opts{'arch'} ||
51   !$opts{'outiso'} ||
52   !$opts{'suite'}
53    ) {
54    pod2usage(-verbose => 2);
55}
56
57Readonly my $PROJECT => 'bccd';
58$ft = new File::Temp();
59if(defined($opts{'dir'})) {
60        $dir = $opts{'dir'};
61} else {
62        $dir = File::Spec->tmpdir;
63}
64
65if(defined($opts{'nocleanup'})) {
66        print "Disabling automatic cleanup\n";
67        $ft = File::Temp->newdir("/tmp/$PROJECT.XXXXXXX",CLEANUP => 0);
68}
69else {
70        print "Enabling automatic cleanup\n";
71        $ft = File::Temp->newdir("/tmp/$PROJECT.XXXXXXX",DIR=>$dir,CLEANUP => 1);
72}
73$tmpdir = $ft->dirname();
74
75$Bccd = new Bccd();
76
77if(defined($opts{'debmirror'})) {
78        $debmirror_host = $opts{'debmirror'};
79} else {
80        $debmirror_host = "debmirror.cluster.earlham.edu";
81}
82$debmirror = "http://$debmirror_host";
83
84if(defined($opts{'websvn'})) {
85        $websvn = $opts{'websvn'};
86} else {
87        $websvn = "http://bccd-ng.cluster.earlham.edu/svn/bccd-ng/branches/skylar-test_fw/";
88}
89
90Readonly my $BUILDDIR   => $tmpdir."/build-bccd/";
91Readonly my $SOFTWARE   => "/bccd/software/";
92Readonly my $PROJDIR    => $BUILDDIR."/diskless/bccd/";
93Readonly my $BCCDCLIENT => $BUILDDIR."/diskless/clients/";
94Readonly my $NEWHOME    => "$BUILDDIR/bccd/home";
95Readonly my $CHECKIN    => "$NEWHOME/meta/nodes/";
96Readonly my $LIBFETCH   => "/root/liberate";
97Readonly my $KERNREV    => "2.6.31.12-aufs";
98$ENV{'DEBIAN_FRONTEND'} = "noninteractive";
99Readonly my $PACKAGES   => "screen openssh-client openssh-server less make gcc-4.2 g++-4.2 flex bison gdb alien lsb-rpm bzip2 sudo yum debootstrap rsync dhcp3-server tcpdump syslinux syslinux-common subversion nfs-common nfs-kernel-server ncurses-base ncurses-bin libncurses5 libncurses5-dev psmisc vim iproute pciutils host bc ntp ntpdate debconf-utils dhcpcd xbase-clients libxt-dev lesstif2 lesstif2-dev ipcalc dialog lvm2 grub parted tzdata xserver-xorg-video-fbdev xfonts-100dpi xfonts-75dpi xfonts-scalable xserver-xorg-video-all fontconfig xfonts-base gpm udev vtwm aterm rxvt xbase-clients menu bbkeys libwww-mechanize-perl postgresql-client-common postgresql-client-8.3 libdbi-perl libdbd-pg-perl strace tcsh libnet-dhcp-perl libnetaddr-ip-perl libnet-ip-perl libstdc++5 pdnsd csh libterm-readkey-perl libsvn-perl libui-dialog-perl libreadonly-perl sshfs autofs libnet-dhcp-perl dnsutils libfile-touch-perl libnet-cidr-perl arping dosfstools gawk dc glutg3-dev libxi-dev wireless-tools snmp snmpd netpbm imagemagick libyaml-perl tcl8.4 libc6-i386 initramfs-tools linux-image-$KERNREV xvfb libmime-lite-perl exim4 x11vnc mingetty";
100Readonly my $EXTRA_PACKAGES => "fftw2 fftw-dev sfftw-dev sfftw2 automake1.7 console-tools libreadline5-dev hal libxmu-headers libxmu-dev gfortran ethtool libssl0.9.8 libblas-dev libblas-dev atlas3-base atlas3-base-dev atlas3-base refblas3 lapack3 atlas3-test libg2c0-dev libg2c0 apache2 iceweasel xpdf octave3.0 ruby sl robotfindskitten pvm xpvm emacs grac blender automake1.9 libtool libglu1-mesa-dev minicom lcd4linux insight joe grace libxpm-dev telnet lsof xresprobe fbset fluxbox xgalaga zenmap nedit eterm manpages-dev";
101Readonly my $AMD64_PACKAGES => "libc6-dev-i386 ia32-libs";
102Readonly my $BAD_PACKAGES   => ""; # Packages that throw some fatal error during install but still work
103Readonly my $PERLDIR        => "/usr/local/lib/site_perl/";
104Readonly my $TESTNAME       => "build_livecd";
105Readonly my $STAGE          => $Bccd->get_stage();
106Readonly my $KNOPDIR        => "$tmpdir/KNOPPIX";
107Readonly my $USER           => "$PROJECT";
108Readonly my @TIME           => localtime();
109Readonly my $FORMAT_DATE    => ($TIME[5]+1900)."-".($TIME[4]+1)."-".$TIME[3];
110Readonly my $SPLASH_FILE    => 'bccd_logo_new.png';
111Readonly my @MINIRT_MODS    => (
112                                "BusLogic.ko",
113                                "NCR53c406a.ko",
114                                "a100u2w.ko",
115                                "advansys.ko",
116                                "aic7xxx.ko",
117                                "cloop.ko",
118                                "dc395x.ko",
119                                "dtc.ko",
120                                "eata.ko",
121                                "ehci-hcd.ko",
122                                "fdomain.ko",
123                                "ff-memless.ko",
124                                "forcedeth.ko",
125                                "gdth.ko",
126                                "ieee1394.ko",
127                                "initio.ko",
128                                "usb-libusual.ko",
129                                "loop.ko",
130                                "mptbase.ko",
131                                "mptscsih.ko",
132                                "ohci-hcd.ko",
133                                "ohci1394.ko",
134                                "pas16.ko",
135                                "psi240i.ko",
136                                "sbp2.ko",
137                                "sym53c8xx.ko",
138                                "t128.ko",
139                                "tmscsim.ko",
140                                "u14-34f.ko",
141                                "uhci-hcd.ko",
142                                "ultrastor.ko",
143                                "usb-storage.ko",
144                                "usbcore.ko",
145                                "usbhid.ko",
146                                "wd7000.ko",
147                                );
148
149# Revision fetch
150
151if($opts{'info'}) {
152    $Bccd->set_debug('INFO');
153}
154
155if($opts{'debug'}) {
156    $Bccd->set_debug('DEBUG');
157}
158
159if($opts{'updatedb'}) {
160    $Bccd->redirect_stdio("$tmpdir");
161}
162
163if($opts{'svnrev'}) {
164    $svnrev = $opts{'svnrev'};
165} else {
166    if($websvn !~ /^http/) {
167        $svnrev = "BASE";
168    } else {
169        $svnrev = $Bccd->run_test(
170            "getsvnrev",
171            "",
172            "Got subversion revision of $websvn.",
173            "$websvn",
174            );
175    }
176}
177
178$Bccd->run_test(
179    "chdir",
180    "",
181    "cd'd into $tmpdir.",
182    "$tmpdir",
183    );
184
185$Bccd->run_test(
186    "system",
187    "",
188    "Built initial install tree.",
189    "debootstrap --arch $opts{'arch'} $opts{'suite'} $BUILDDIR $debmirror",
190    );
191
192$Bccd->run_test(
193    "system",
194    "",
195    "Copied /dev to $BUILDDIR/dev.",
196    "cp -R /dev $BUILDDIR/dev",
197    );
198
199$Bccd->run_test(
200    "system",
201    "",
202    "Mounted /proc into $BUILDDIR.",
203    "mount -t proc none $BUILDDIR/proc",
204    );
205
206$Bccd->run_test(
207    "system",
208    "",
209    "Mounted /sys into $BUILDDIR.",
210    "mount -t sysfs none $BUILDDIR/sys",
211    );
212
213$Bccd->run_test(
214    "fwrite",
215    "",
216    "Disabled apt-get package authentication.",
217    "a",
218    "$BUILDDIR/etc/apt/apt.conf",
219    "APT::Get::AllowUnauthenticated 1 ;",
220    );
221
222$Bccd->run_test(
223    "system",
224    "",
225    "Installed Perl testing modules in install tree.",
226    "chroot $BUILDDIR apt-get -y install libtest-base-perl",
227    );
228
229$Bccd->run_test(
230    "system",
231    "",
232    "Installed Perl testing modules in install tree.",
233    "chroot $BUILDDIR apt-get -y install libtest-base-perl",
234    );
235
236foreach my $file ( "$BUILDDIR/etc/apt/sources.list","$BUILDDIR/etc/apt/apt.conf","$BUILDDIR/etc/network/interfaces","$BUILDDIR/etc/dhcp3/dhcpd.conf","$BUILDDIR/etc/dhcp3/dhclient.conf","$BUILDDIR/etc/ssh/ssh_config","$BUILDDIR/etc/ssh/sshd_config","$BUILDDIR/etc/profile","$BUILDDIR/etc/defaultdomain","$BUILDDIR/etc/default/nis","$BUILDDIR/etc/default/useradd","$BUILDDIR/etc/default/tftpd-hpa","$BUILDDIR/etc/rc.local" ) {
237    if( -f $file ) {
238        $Bccd->run_test(
239            "unlink",
240            "",
241            "rm'd existing cfg file $file",
242            "$file",
243            );
244    }
245}
246
247foreach my $dir ( $BCCDCLIENT, $PROJDIR, "$BUILDDIR/etc/network", "$BUILDDIR/etc/dhcp3", "$BUILDDIR/etc/ssh", "$BUILDDIR/$SOFTWARE", "$BUILDDIR/root/.ssh", "$BUILDDIR/nfs",
248                  "$BUILDDIR/$LIBFETCH", "$BUILDDIR/var/run" ) {
249    if( !(-d $dir) ) {
250        $Bccd->run_test(
251            "mkpath",
252            "",
253            "Made $dir directory.",
254            "$dir",
255            );
256    }
257}
258
259$Bccd->run_test(
260    "revfetch",
261    "",
262    "Fetched debconf preseed file.",
263    $svnrev,
264    "$websvn/packages/debconf.preseed",
265    "$BUILDDIR/root/debconf.preseed",
266    );
267
268$Bccd->run_test(
269    "system",
270    "",
271    "Set debconf selections.",
272    "/usr/sbin/chroot $BUILDDIR debconf-set-selections /root/debconf.preseed",
273    );
274
275$Bccd->run_test(
276    "revfetch",
277    "",
278    "Fetched apt source list.",
279    $svnrev,
280    "$websvn/packages/etc/apt/sources.list",
281    "$BUILDDIR/etc/apt/sources.list",
282    );
283
284$Bccd->run_test(
285    "regexsub_file",
286    "",
287    "Changed DEBMIRROR template in sources list to $debmirror_host.",
288    "$BUILDDIR/etc/apt/sources.list",
289    "!DEBMIRROR!",
290    "$debmirror_host",
291    );
292
293foreach my $file ( "interfaces", "interfaces.compute" ) {
294    $Bccd->run_test(
295        "revfetch",
296        "",
297        "Fetched network $file cfg.",
298        $svnrev,
299        "$websvn/packages/etc/network/$file",
300        "$BUILDDIR/etc/network/$file",
301        );
302}
303
304$Bccd->run_test(
305    "mkpath",
306    "",
307    "mkdir /etc/X11/xinit",
308    "$BUILDDIR/etc/X11/xinit",
309    );
310
311# Make apt work
312
313foreach my $dir ( "/var/cache/apt/archives", "/var/cache/apt/archives/partial" ) {
314    $Bccd->run_test(
315        "mkpath",
316        "",
317        "mkdir $dir",
318        "$BUILDDIR/$dir",
319        );
320}
321
322# /etc fetch
323foreach my $file ( "hosts", "hosts.compute", "hosts.allow", "hosts.deny", "profile", "modules", "modules.net",
324          "passwd.compute", "group.compute", "shadow.compute", "exports.compute",
325          "nsswitch.conf", "unionfs.conf", "X11/xinit/xinitrc", "X11/xinit/xserverrc",
326          "dpkg/dpkg.cfg", "ld.so.conf.d/software.conf", "sudoers", "init.d/bccd-networking",
327          "init.d/bccd-passwd", "init.d/bccd-dhcp", "init.d/bccd-sshd", "X11/xorg.conf",
328          "lam.conf", "init.d/bccd-nfs", "init.d/bccd-unite-sw", "init.d/bccd-nics",
329          "init.d/bccd-dhcp-conf", "init.d/bccd-route", "init.d/bccd-keyboard", "rc.local",
330          "init.d/bccd-fsrw", "init.d/bccd-mail", "auto.master", "auto.sshfs", "ld.so.conf.d/CUDA.conf" ) {
331    $Bccd->run_test(
332        "revfetch",
333        "",
334        "Fetched /etc/$file file.",
335        $svnrev,
336        "$websvn/packages/etc/$file",
337        "$BUILDDIR/etc/$file",
338        );
339}
340
341$Bccd->run_test(
342    "chmod",
343    "",
344    "Set $BUILDDIR/etc/sudoers user/group readable only.",
345    0440,
346    "$BUILDDIR/etc/sudoers",
347    );
348
349foreach my $file ( "bccd-networking", "bccd-passwd", "bccd-dhcp", "bccd-sshd", "bccd-nfs", "bccd-unite-sw",
350          "bccd-nics", "bccd-dhcp-conf", "bccd-route", "bccd-keyboard", "bccd-fsrw", "bccd-mail" ) {
351    $Bccd->run_test(
352        "chmod",
353        "",
354        "Set $BUILDDIR/etc/init.d/$file executable.",
355        0755,
356        "$BUILDDIR/etc/init.d/$file",
357        );
358}
359
360$cwd = getcwd();
361
362$Bccd->run_test(
363    "chdir",
364    "",
365    "cd $BUILDDIR",
366    "$BUILDDIR",
367    );
368
369$Bccd->run_test(
370    "recrevfetch",
371    "",
372    "Fetched lib directory.",
373    $svnrev,
374    "$websvn/trees/lib/",
375    );
376
377$Bccd->run_test(
378    "recrevfetch",
379    "",
380    "Fetched bin directory.",
381    $svnrev,
382    "$websvn/trees/bin/",
383    );
384
385$Bccd->run_test(
386    "recrevfetch",
387    "",
388    "Fetched etc tree.",
389    $svnrev,
390    "$websvn/trees/etc/",
391    );
392
393$Bccd->run_test(
394    "recrevfetch",
395    "",
396    "Fetched root home directory.",
397    $svnrev,
398    "$websvn/trees/root/",
399    );
400
401
402$Bccd->run_test(
403    "chdir",
404    "",
405    "cd $BUILDDIR/etc",
406    "$BUILDDIR/etc",
407    );
408
409$Bccd->run_test(
410    "recrevfetch",
411    "",
412    "Fetched skel profile.",
413    $svnrev,
414    "$websvn/packages/etc/skel",
415    );
416
417foreach my $file ( "$BUILDDIR/etc/skel/.firstlogin", "$BUILDDIR/etc/skel/.bash_profile", ) {
418    $Bccd->run_test(
419        "chmod",
420        "",
421        "chmod 0755 $file",
422        0755,
423        "$file",
424        );
425}
426
427if(-f "$BUILDDIR/etc/skel/.bashrc") {
428    $Bccd->run_test(
429        "unlink",
430        "",
431        "Removed default .bashrc",
432        "$BUILDDIR/etc/skel/.bashrc",
433        );
434}
435
436$Bccd->run_test(
437    "chdir",
438    "",
439    "cd'ing into $BUILDDIR/etc/skel",
440    "$BUILDDIR/etc/skel",
441    );
442
443$Bccd->run_test(
444    "chdir",
445    "",
446    "cd $cwd",
447    "$cwd",
448    );
449
450$Bccd->run_test(
451    "revfetch",
452    "",
453    "Fetched liberate script.",
454    $svnrev,
455    "$websvn/packages/liberate.pl",
456    "$BUILDDIR/root/liberate.pl",
457    );
458
459$Bccd->run_test(
460    "revfetch",
461    "",
462    "Fetched /etc/default/useradd file.",
463    $svnrev,
464    "$websvn/packages/etc/default/useradd",
465    "$BUILDDIR/etc/default/useradd",
466    );
467
468$Bccd->run_test(
469    "fwrite",
470    "",
471    "Allowing initrd kernel upgrade.",
472    "a",
473    "$BUILDDIR/etc/kernel-img.conf",
474    "do_initrd=yes",
475    );
476
477$Bccd->run_test(
478    "system",
479    "",
480    "Updated apt cache.",
481    "/usr/sbin/chroot $BUILDDIR apt-get update",
482    );
483
484$Bccd->run_test(
485    "system",
486    "",
487    "Fetched pre-install dependencies.",
488    "/usr/sbin/chroot $BUILDDIR apt-get -y --allow-unauthenticated  install debian-archive-keyring initramfs-tools",
489    );
490
491if($opts{'arch'} eq 'i386') {
492        $Bccd->run_test(
493            "system",
494            "0",
495            "Fetched Debian packages.",
496            "/usr/sbin/chroot $BUILDDIR /usr/bin/aptitude --allow-untrusted -y install $PACKAGES $EXTRA_PACKAGES",
497            );
498}
499elsif($opts{'arch'} eq 'amd64') {
500        $Bccd->run_test(
501            "system",
502            "0",
503            "Fetched Debian packages.",
504            "/usr/sbin/chroot $BUILDDIR aptitude --allow-untrusted -y install $PACKAGES $EXTRA_PACKAGES $AMD64_PACKAGES",
505            );
506}
507
508if($opts{'arch'} eq 'amd64') {
509    $Bccd->run_test(
510        "system",
511        "",
512        "Symlinking IA32 libstdc++ compatibility library.",
513        "/usr/sbin/chroot $BUILDDIR ln -s /usr/lib32/libstdc++.so.6 /usr/lib32/libstdc++.so",
514        );
515}
516
517# Workaround for tftpd-hpa/inetd conflict
518$Bccd->run_test(
519    "system",
520    "",
521    "Removing inetutils-inetd to avoid conflict with tftpd-hpa.",
522    "/usr/sbin/chroot $BUILDDIR /usr/bin/dpkg -r inetutils-inetd",
523    );
524
525$Bccd->run_test(
526    "system",
527    100,
528    "Fetching tftpd-hpa separately.",
529    "/usr/sbin/chroot $BUILDDIR /usr/bin/apt-get --force-yes -y install tftpd-hpa",
530    );
531
532$Bccd->run_test(
533    "system",
534    "",
535    "Deleted cached deb packages.",
536    "/usr/sbin/chroot $BUILDDIR apt-get clean",
537    );
538
539$Bccd->run_test(
540    "revfetch",
541    "",
542    "Fetched tftpd-hpa configuration.",
543    $svnrev,
544    "$websvn/packages/etc/default/tftpd-hpa",
545    "$BUILDDIR/etc/default/tftpd-hpa",
546    );
547
548$Bccd->run_test(
549    "revfetch",
550    "",
551    "Fetched NIS default domain.",
552    $svnrev,
553    "$websvn/packages/etc/defaultdomain",
554    "$BUILDDIR/etc/defaultdomain",
555    );
556
557$Bccd->run_test(
558    "mkpath",
559    "",
560    "Making $KERNREV modules directory.",
561    "$BUILDDIR/lib/modules/$KERNREV",
562    );
563
564$Bccd->run_test(
565    "revfetch",
566    "",
567    "Fetched ssh_config file.",
568    $svnrev,
569    "$websvn/packages/etc/ssh/ssh_config",
570    "$BUILDDIR/etc/ssh/ssh_config",
571    );
572
573$Bccd->run_test(
574    "revfetch",
575    "",
576    "Fetched sshd_config file.",
577    $svnrev,
578    "$websvn/packages/etc/ssh/sshd_config",
579    "$BUILDDIR/etc/ssh/sshd_config",
580    );
581
582$Bccd->run_test(
583    "mkpath",
584    "",
585    "mkdir $BUILDDIR/etc/udev/rules.d",
586    "$BUILDDIR/etc/udev/rules.d",
587    );
588
589$Bccd->run_test(
590    "revfetch",
591    "",
592    "Fetched USB automounting udev rule.",
593    $svnrev,
594    "$websvn/packages/etc/udev/rules.d/99-automount_usb.rules",
595    "$BUILDDIR/etc/udev/rules.d/99-automount_usb.rules",
596    );
597
598# Revision write
599
600$Bccd->run_test(
601    "fwrite",
602    "",
603    "Opened $BUILDDIR/etc/$PROJECT-revision for writing.",
604    "w",
605    "$BUILDDIR/etc/$PROJECT-revision",
606    "$svnrev",
607    );
608
609# Install software
610
611$Bccd->run_test(
612    "mkpath",
613    "",
614    "Created node checkin directory.",
615    "$CHECKIN",
616    );
617
618
619$nouid = $Bccd->run_test(
620    "getuseruid",
621    "",
622    "Got uid for nobody user.",
623    "nobody",
624    );
625
626$nogid = $Bccd->run_test(
627    "getusergid",
628    "",
629    "Got gid for nobody user.",
630    "nobody",
631    );
632
633$Bccd->run_test(
634    "chown",
635    "",
636    "chown'd checkin directory $CHECKIN to $nouid:$nogid.",
637    "$nouid",
638    "$nogid",
639    "$CHECKIN",
640    );
641
642if( ! -f "$BUILDDIR/usr/bin/python2" ) {
643    $Bccd->run_test(
644        "system",
645        "",
646        "Linked python->python2 for C3 tools.",
647        "/usr/sbin/chroot $BUILDDIR ln -s /usr/bin/python2.5 /usr/bin/python2",
648        );
649}
650
651$Bccd->run_test(
652    "system",
653    "",
654    "Linked VBoxService into /usr/sbin.",
655    "/usr/sbin/chroot $BUILDDIR ln -s /opt/VBoxGuestAdditions-3.2.8/sbin/VBoxService /usr/sbin/VBoxService",
656    );
657
658foreach my $vb ("VBoxClient","VBoxControl") {
659    $Bccd->run_test(
660        "system",
661        "",
662        "Linked $vb into /usr/bin.",
663        "/usr/sbin/chroot $BUILDDIR ln -s /opt/VBoxGuestAdditions-3.2.8/bin/$vb /usr/bin/$vb",
664        );
665}
666
667$Bccd->run_test(
668    "fcopy",
669    "",
670    "Copied pxelinux to tftpboot.",
671    "$BUILDDIR/usr/lib/syslinux/pxelinux.0",
672    "$BUILDDIR/var/lib/tftpboot/pxelinux.0",
673    );
674
675$Bccd->run_test(
676    "mkpath",
677    "",
678    "Made $BUILDDIR/var/lib/tftpboot/pxelinux.cfg",
679    "$BUILDDIR/var/lib/tftpboot/pxelinux.cfg",
680    );
681
682foreach my $file ( "dhcpd.conf", "dhclient.conf", "dhclient.conf-bccd", "dhclient.conf-any" ) {
683    $Bccd->run_test(
684        "revfetch",
685        "",
686        "Fetched DHCP $file configuration.",
687        $svnrev,
688        "$websvn/packages/etc/dhcp3/$file",
689        "$BUILDDIR/etc/dhcp3/$file",
690        );
691}
692
693# Needed down here to prevent hang with debconf
694foreach my $file ( "exports", "hosts.equiv", "gpm.conf", "inittab" ) {
695    $Bccd->run_test(
696        "revfetch",
697        "",
698        "Fetched /etc/$file file.",
699        $svnrev,
700        "$websvn/packages/etc/$file",
701        "$BUILDDIR/etc/$file",
702        );
703}
704
705$Bccd->run_test(
706    "system",
707    "",
708    "Setting LSB parsing of init scripts.",
709    "touch $BUILDDIR/etc/update-rc.d-lsbparse",
710    );
711
712$Bccd->run_test(
713    "system",
714    "",
715    "Disabling hardware-optimized ld.so directories.",
716    "touch $BUILDDIR/etc/ld.so.nohwcap",
717    );
718
719foreach my $script ("nis", "ssh-host-keys", "nfs-kernel-server", "ssh",
720                    "dhcp3-server", "dbus", "hal", "apache2",) {
721    $Bccd->run_test(
722        "system",
723        "",
724        "Disabled $script.",
725        "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d -f $script remove",
726        );
727}
728
729foreach my $script ("nfs-common", "vboxadd-service", "mpd","bccd-mail", ) {
730    $Bccd->run_test(
731        "system",
732        "",
733        "Enabling $script at boot time.",
734        "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d $script defaults",
735        );
736}
737
738# This must run before 20 (bccd-passwd) and autofs
739foreach my $script ("bccd-unite-sw", "perfctr",) {
740    $Bccd->run_test(
741        "system",
742        "",
743        "Enabling $script config.",
744        "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d $script defaults 18",
745        );
746}
747
748# Based on virtualbox install script
749foreach my $script ("vboxadd","vboxadd-x11",) {
750    $Bccd->run_test(
751        "system",
752        "",
753        "Enabling $script config.",
754        "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d $script defaults 30",
755        );
756}
757
758$Bccd->run_test(
759    "system",
760    "",
761    "Enabling vboxadd-service config.",
762    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d vboxadd-service defaults 35",
763    );
764
765$Bccd->run_test(
766        "system",
767        "",
768        "Enabling home directory overlay cleaning.",
769        "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-clean-home start 5 2 S .",
770        );
771
772$Bccd->run_test(
773    "system",
774    "",
775    "Enabling bccd-nics config.",
776    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-nics start 39 S .",
777    );
778
779$Bccd->run_test(
780    "system",
781    "",
782    "Enabling bccd-dhcp-conf config.",
783    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-dhcp-conf start 38 S .",
784    );
785
786$Bccd->run_test(
787    "system",
788    "",
789    "Enabling bccd-route config.",
790    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-route start 41 S .",
791    );
792
793$Bccd->run_test(
794    "system",
795    "",
796    "Enabling bccd-fsrw config.",
797    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-fsrw start 11 S .",
798    );
799
800$Bccd->run_test(
801    "system",
802    "",
803    "Enabling bccd-keyboard config.",
804    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-keyboard start 18 S .",
805    );
806
807$Bccd->run_test(
808    "system",
809    "",
810    "Enabling bccd-networking config.",
811    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-networking start 42 2 S .",
812    );
813
814$Bccd->run_test(
815    "system",
816    "",
817    "Enabling networking config.",
818    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d networking start 42 2 S .",
819    );
820
821$Bccd->run_test(
822    "system",
823    "",
824    "Enabling bccd-nfs config.",
825    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-nfs start 20 2 S .",
826    );
827
828$Bccd->run_test(
829    "system",
830    "",
831    "Enabling bccd-passwd config.",
832    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-passwd start 20 S .",
833    );
834
835$Bccd->run_test(
836    "system",
837    "",
838    "Enabling bccd-sshd config.",
839    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-sshd start 20 2 S .",
840    );
841
842$Bccd->run_test(
843    "system",
844    "",
845    "Enabling bccd-dhcp config.",
846    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-dhcp start 40 S .",
847    );
848
849$Bccd->run_test(
850    "system",
851    "",
852    "Added root password.",
853    "/usr/sbin/chroot $BUILDDIR /usr/sbin/usermod -p '\$1\$erNdlHdL\$EV6C0eBbe6M3bVaK9m4If0' root",
854    );
855
856# User creation
857
858# Manual writes to keep NIS from interfering with static uid/gid
859
860$Bccd->run_test(
861    "fwrite",
862    "",
863    "Wrote out sshd user.",
864    "a",
865    "$BUILDDIR/etc/passwd",
866    "sshd:x:103:65534::/var/run/sshd:/usr/sbin/nologin",
867    );
868
869$Bccd->run_test(
870    "fwrite",
871    "",
872    "Wrote out sshd group.",
873    "a",
874    "$BUILDDIR/etc/shadow",
875    "sshd:!:13625:0:99999:7:::",
876    );
877
878$Bccd->run_test(
879    "system",
880    "",
881    "Creating non-root-group account.",
882    "/usr/sbin/chroot $BUILDDIR /usr/sbin/groupadd -g 1000 bccd",
883    );
884
885$Bccd->run_test(
886    "system",
887    "",
888    "Created non-root user account.",
889    "/usr/sbin/chroot $BUILDDIR /usr/sbin/useradd -s /bin/bash -G fuse,adm -u 1000 -g 1000 -d /home/$USER -m -p '\$1\$Agm0SXPB\$JnObEvwBQdg4WCovvMKST1' $USER",
890    );
891
892$Bccd->run_test(
893    "system",
894    "",
895    "Created vbox user account.",
896    "/usr/sbin/chroot $BUILDDIR /usr/sbin/useradd -s /bin/sh -G daemon -d /var/run/vboxadd vboxadd",
897    );
898
899$Bccd->run_test(
900    "system",
901    "",
902    "Altered non-root account directory for KNOPPIX.",
903    "/usr/sbin/chroot $BUILDDIR /usr/sbin/usermod -d /UNIONFS/home/$USER $USER",
904    );
905
906# Bccd perl modules
907
908$Bccd->run_test(
909    "mkpath",
910    "",
911    "mkdir $BUILDDIR/$PERLDIR",
912    "$BUILDDIR/$PERLDIR",
913    );
914
915$Bccd->run_test(
916    "chdir",
917    "",
918    "cd'd to $BUILDDIR/$PERLDIR/../",
919    "$BUILDDIR/$PERLDIR/../",
920    );
921
922
923$Bccd->run_test(
924    "recrevfetch",
925    "",
926    "Checked out Bccd perl modules.",
927    $svnrev,
928    "$websvn/trees/$PERLDIR/",
929    );
930
931$Bccd->run_test(
932    "chdir",
933    "",
934    "cd'd to $tmpdir.",
935    "$tmpdir",
936    );
937
938$Bccd->run_test(
939    "recrevfetch",
940    "",
941    "Checked out hardware autodetect stuff.",
942    $svnrev,
943    "$websvn/trees/hwsetup/",
944    );
945
946$Bccd->run_test(
947    "system",
948    "",
949    "Copied hardware autodetect into $BUILDDIR.",
950    "cp -R $tmpdir/hwsetup/* $BUILDDIR/",
951    );
952
953# Starting hwsetup init scripts
954foreach my $script ( "knoppix-autoconfig", "xserver-xorg" ) {
955    $Bccd->run_test(
956        "system",
957        "",
958        "Enabled $script.",
959        "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d $script start 20 2 3 4 5 .",
960        );
961}
962
963# Software install
964
965$Bccd->run_test(
966    "chdir",
967    "",
968    "cd'd to $BUILDDIR",
969    "$BUILDDIR",
970    );
971
972$Bccd->run_test(
973    "recrevfetch",
974    "",
975    "Fetched software tree.",
976    $svnrev,
977    "$websvn/trees/software/bccd/",
978    );
979
980$Bccd->run_test(
981    "system",
982    "",
983    "Changed $SOFTWARE to bccd:bccd.",
984    "/usr/sbin/chroot $BUILDDIR /bin/chown -R bccd:bccd $SOFTWARE",
985    );
986
987foreach my $prog ( <$BUILDDIR/bccd/software/*/bin/*> ) {
988    $Bccd->run_test(
989        "chmod",
990        "",
991        "chmod 0755 $prog",
992        0755,
993        "$prog",
994        );
995}
996
997$Bccd->run_test(
998        "mkpath",
999        "",
1000        "mkdir $BUILDDIR/usr/lib/iceweasel/plugins",
1001        "$BUILDDIR/usr/lib/iceweasel/plugins", 
1002        );
1003
1004$Bccd->run_test(
1005        "fcopy",
1006        "",
1007        "cp $BUILDDIR//bccd/software/jre1.6.0_13/plugin/i386/ns7/libjavaplugin_oji.so $BUILDDIR/usr/lib/iceweasel/plugins",
1008        "$BUILDDIR//bccd/software/jre1.6.0_13/plugin/i386/ns7/libjavaplugin_oji.so",
1009        "$BUILDDIR/usr/lib/iceweasel/plugins",
1010        );
1011
1012$Bccd->run_test(
1013    "chdir",
1014    "",
1015    "cd $BUILDDIR/",
1016    "$BUILDDIR/",
1017    );
1018
1019$Bccd->run_test(
1020    "recrevfetch",
1021    "",
1022    "Fetched test tree.",
1023    $svnrev,
1024    "$websvn/trees/home",
1025    );
1026
1027$Bccd->run_test(
1028    "system",
1029    "",
1030    "chown'd $BUILDDIR/home/bccd to bccd:bccd",
1031    "/usr/sbin/chroot $BUILDDIR chown -R $USER:$USER /home/bccd",
1032    );
1033
1034$Bccd->run_test(
1035    "chmod",
1036    "",
1037    "chmod 0600 $BUILDDIR/home/bccd/.mpd.conf",
1038    0600,
1039    "$BUILDDIR/home/bccd/.mpd.conf",
1040    );
1041
1042$Bccd->run_test(
1043    "chmod",
1044    "",
1045    "chmod 0755 $BUILDDIR/root/.ssh/",
1046    0755,
1047    "$BUILDDIR/root/.ssh/",
1048    );
1049
1050$Bccd->run_test(
1051    "chmod",
1052    "",
1053    "chmod 0755 $BUILDDIR/home/$USER/.ssh",
1054    0755,
1055    "$BUILDDIR/home/$USER/.ssh",
1056    );
1057
1058$Bccd->run_test(
1059                "chmod",
1060                "",
1061                "chmod 0755 $BUILDDIR/home/$USER",
1062                0755,
1063                "$BUILDDIR/home/$USER",
1064                );
1065
1066foreach my $file ( "$BUILDDIR/root/.ssh/bccd", "$BUILDDIR/root/.ssh/config" ) {
1067    $Bccd->run_test(
1068        "chmod",
1069        "",
1070        "chmod 0600 $file",
1071        0600,
1072        "$file",
1073        );
1074}
1075
1076foreach my $key ( <$BUILDDIR/etc/ssh/ssh*key*> ) {
1077    $Bccd->run_test(
1078        "unlink",
1079        "",
1080        "Removed ssh key $key.",
1081        "$key",
1082        );
1083}
1084
1085$Bccd->run_test(
1086    "system",
1087    "",
1088    "Requiring bccd ssh start script for ssh start.",
1089    "perl -wpli -e 's/^(#\\s+Required-Start:\\s+.*\$)/\$1 bccd-sshd/' $BUILDDIR/etc/init.d/ssh",
1090    );
1091
1092$Bccd->run_test(
1093    "system",
1094    "",
1095    "Requiring bccd nic start script for networking start.",
1096    "perl -wpli -e 's/^(#\\s+Required-Start:\\s+.*\$)/\$1 bccd-nics/' $BUILDDIR/etc/init.d/networking",
1097    );
1098
1099$Bccd->run_test(
1100    "system",
1101    "",
1102    "Allowing pdnsd to listen on all interfaces.",
1103    "perl -wpli -e 's!(server_ip = )!// \$1!g' $BUILDDIR/usr/share/pdnsd/pdnsd-resolvconf.conf",
1104    );
1105
1106$Bccd->run_test(
1107    "system",
1108    "",
1109    "Fixing cstddef for openmpi.",
1110    "perl -wpli -e 's/#include_next/#include/g' $BUILDDIR/usr/include/c++/4.3/cstddef",
1111    );
1112
1113# Make us LIVE
1114
1115$Bccd->run_test(
1116    "fwrite",
1117    "",
1118    "Made us LIVE.",
1119    "w",
1120    "$BUILDDIR/etc/$PROJECT-stage",
1121    "LIVE",
1122    );
1123
1124# Setting up menus
1125
1126foreach my $file (<$BUILDDIR/usr/share/menu/*>) {
1127    $Bccd->run_test(
1128        "unlink",
1129        "",
1130        "rm'd X menu item $file",
1131        "$file",
1132        );
1133}
1134
1135$cwd = getcwd();
1136
1137$Bccd->run_test(
1138    "chdir",
1139    "",
1140    "cd $BUILDDIR/",
1141    "$BUILDDIR/",
1142    );
1143
1144$Bccd->run_test(
1145    "recrevfetch",
1146    "",
1147    "Fetched /usr items.",
1148    $svnrev,
1149    "$websvn/trees/usr/",
1150    );
1151
1152$Bccd->run_test(
1153    "recrevfetch",
1154    "",
1155    "Fetched architecure-specific items for $opts{'arch'}.",
1156    $svnrev,
1157    "$websvn/trees/arch/$opts{'arch'}",
1158    );
1159
1160$Bccd->run_test(
1161    "system",
1162    "",
1163    "Copied architecture-specific items from /$opts{'arch'} to /.",
1164        "/usr/sbin/chroot $BUILDDIR /usr/bin/rsync -av --progress /$opts{'arch'}/ /",
1165    );
1166
1167$Bccd->run_test(
1168        "fcopy",
1169        "",
1170        "Copied cloop.ko into $tmpdir.",
1171        "$BUILDDIR/KNOPPIX/KNOPPIX/modules/cloop.ko",
1172        "$tmpdir/cloop.ko",
1173        );
1174
1175$Bccd->run_test(
1176    "chdir",
1177    "",
1178    "Changed back to old directory.",
1179    "$cwd",
1180    );
1181
1182$Bccd->run_test(
1183    "system",
1184    "",
1185    "Updated desktop menus.",
1186    "/usr/sbin/chroot $BUILDDIR /usr/bin/update-menus",
1187    );
1188
1189# Software end
1190
1191# Pre-fetching liberation stuff
1192
1193$Bccd->run_test(
1194    "revfetch",
1195    "",
1196    "Fetched LVM fdisk script.",
1197    $svnrev,
1198    "$websvn/packages/fdisk_lvm.input",
1199    "$BUILDDIR/$LIBFETCH/fdisk_lvm.input",
1200    );
1201
1202$Bccd->run_test(
1203    "revfetch",
1204    "",
1205    "Fetched BCCD splash screen.",
1206    $svnrev,
1207    "$websvn/packages/$SPLASH_FILE",
1208    "$BUILDDIR/$LIBFETCH/$SPLASH_FILE",
1209    );
1210
1211$Bccd->run_test(
1212    "revfetch",
1213    "",
1214    "Fetched liberation exports file.",
1215    $svnrev,
1216    "$websvn/packages/etc/exports.liberate",
1217    "$BUILDDIR/$LIBFETCH/exports",
1218    );
1219
1220$Bccd->run_test(
1221    "chdir",
1222    "",
1223    "cd'ing to $BUILDDIR/$LIBFETCH/.",
1224    "$BUILDDIR/$LIBFETCH",
1225    );
1226
1227$Bccd->run_test(
1228    "system",
1229    "",
1230    "Tar'd up linux_aufs.",
1231    "tar -C $BUILDDIR -cjvf $BUILDDIR/$LIBFETCH/lib-linux.tar.bz2 boot lib/modules var/lib/tftpboot",
1232    );
1233
1234foreach my $file (grep(-f $_, <$BUILDDIR/var/lib/apt/lists/*>)) {
1235        $Bccd->run_test(
1236            "unlink",
1237            "",
1238            "Removed apt file lists.",
1239            "$file",
1240            );
1241}
1242
1243$Bccd->run_test(
1244    "recrevfetch",
1245    "",
1246    "Fetched $websvn/trees/diskless over svn.",
1247    $svnrev,
1248    "$websvn/trees/diskless",
1249    );
1250
1251$Bccd->run_test(
1252    "chdir",
1253    "",
1254    "Reverted to $cwd.",
1255    "$cwd",
1256    );
1257
1258$Bccd->run_test(
1259    "revfetch",
1260    "",
1261    "Fetched grub menu.",
1262    $svnrev,
1263    "$websvn/packages/boot/grub/menu.lst",
1264    "$BUILDDIR/$LIBFETCH/grub_menu.lst",
1265    );
1266
1267$Bccd->run_test(
1268    "lsofkill",
1269    "",
1270    "Killing procs in $BUILDDIR: ",
1271    "$BUILDDIR",
1272    );
1273
1274# Make here so automount doesn't destroy it
1275
1276$Bccd->run_test(
1277    "mkpath",
1278    "",
1279    "mkdir $BUILDDIR/mnt/ssh",
1280    "$BUILDDIR/mnt/ssh",
1281    );
1282
1283$Bccd->run_test(
1284    "chdir",
1285    "",
1286    "cd'd to $tmpdir for Knoppix fetch.",
1287    "$tmpdir",
1288    );
1289
1290$Bccd->run_test(
1291    "recrevfetch",
1292    "",
1293    "Fetched KNOPPIX sans root filesystem.",
1294    $svnrev,
1295    "$websvn/trees/KNOPPIX/",
1296    );
1297
1298$Bccd->run_test(
1299    "fcopy",
1300    "",
1301    "Copying Linux kernel into KNOPPIX image.",
1302    "$BUILDDIR/boot/vmlinuz-$KERNREV",
1303    "$tmpdir/KNOPPIX/boot/isolinux/linux",
1304    );
1305
1306$Bccd->run_test(
1307        "system",
1308        "",
1309        "Making network initramfs.",
1310        "/usr/sbin/chroot $BUILDDIR /usr/sbin/mkinitramfs -d /etc/initramfs-tools.diskless -o /var/lib/tftpboot/initramfs-$KERNREV $KERNREV",
1311        );
1312
1313$Bccd->run_test(
1314    "system",
1315    "",
1316    "Unpacking initramfs modules for KNOPPIX minirt.",
1317    qq{gzip -d -c $BUILDDIR/var/lib/tftpboot/initramfs-$KERNREV|cpio --make-directories -i 'lib/modules/$KERNREV/*'},
1318    );
1319
1320$Bccd->run_test(
1321    "rename",
1322    "",
1323    "Moved initramfs modules into KNOPPIX minirt.",
1324    "$tmpdir/lib/modules/",
1325    "$tmpdir/KNOPPIX/boot/isolinux/minirt/modules",
1326    );
1327
1328$Bccd->run_test(
1329        "unlink",
1330        "",
1331        "Removing temporary net initramfs.",
1332        "$BUILDDIR/var/lib/tftpboot/initramfs-$KERNREV",
1333        );
1334
1335$Bccd->run_test(
1336    "system",
1337    "",
1338    "Unmounted $BUILDDIR/proc.",
1339    "umount -l $BUILDDIR/proc",
1340    );
1341
1342$Bccd->run_test(
1343    "system",
1344    "",
1345    "Unmounted $BUILDDIR/sys.",
1346    "umount -l $BUILDDIR/sys",
1347    );
1348
1349$Bccd->run_test(
1350    "fmove",
1351    "",
1352    "Moved cloop.ko into KNOPPIX directory.",
1353    "$tmpdir/cloop.ko",
1354    "$tmpdir/KNOPPIX/KNOPPIX/modules/cloop.ko",
1355    );
1356
1357
1358$Bccd->run_test(
1359        "revfetch",
1360        "",
1361        "Fetched minirt device configuration.",
1362        $svnrev,
1363        "$websvn/packages/mknod.y",
1364        "$tmpdir/mknod.y",
1365        );
1366
1367$Bccd->run_test(
1368        "mknods",
1369        "",
1370        "Created minirt device nodes.",
1371        "$tmpdir/mknod.y",
1372        "$tmpdir/KNOPPIX/boot/isolinux/minirt",
1373        );
1374
1375$Bccd->run_test(
1376        "system",
1377        "",
1378        "Created minirt filesystem.",
1379        "dd if=/dev/zero of=$tmpdir/minirt bs=1k count=14700",
1380        );
1381
1382$Bccd->run_test(
1383        "system",
1384        "",
1385        "Made ext2 filesystem in minirt filesystem.",
1386        "/sbin/mke2fs -F $tmpdir/minirt",
1387        );
1388
1389$Bccd->run_test(
1390        "mkpath",
1391        "",
1392        "Made loop directory.",
1393        "$tmpdir/loop",
1394        );
1395
1396$Bccd->run_test(
1397        "system",
1398        "",
1399        "Mounted minirt on loop directory.",
1400        "/bin/mount -t ext2 -o loop $tmpdir/minirt $tmpdir/loop",
1401        );
1402
1403$Bccd->run_test(
1404        "system",
1405        "",
1406        "Copied minirt into loop filesystem.",
1407        "rsync -a $tmpdir/KNOPPIX/boot/isolinux/minirt/ $tmpdir/loop/",
1408        );
1409
1410$Bccd->run_test(
1411        "mkpath",
1412        "",
1413        "Made modules directory in loop filesystem.",
1414        "$tmpdir/loop/modules/",
1415        );
1416
1417foreach my $mod (@MINIRT_MODS) {
1418        $Bccd->run_test(
1419                "system",
1420                "",
1421                "Copied $mod into minirt loop filesystem.",
1422                "find $BUILDDIR/lib/modules/$KERNREV/ -type f -name $mod -exec /bin/cp -v {} $tmpdir/loop/modules/$mod \\;",
1423        );
1424}
1425
1426$Bccd->run_test(
1427        "system",
1428        "",
1429        "Unmounted loop filesystem.",
1430        "umount $tmpdir/loop/",
1431        );
1432
1433$Bccd->run_test(
1434        "rmtree",
1435        "",
1436        "Removed minirt tree.",
1437        "$tmpdir/KNOPPIX/boot/isolinux/minirt/",
1438        );
1439
1440$Bccd->run_test(
1441        "system",
1442        "",
1443        "Placed minirt in KNOPPIX tree.",
1444        "gzip -c $tmpdir/minirt > $tmpdir/KNOPPIX/boot/isolinux/minirt.gz",
1445        );
1446
1447$Bccd->run_test(
1448    "revfetch",
1449    "",
1450    "Fetched background image.",
1451    $svnrev,
1452    "$websvn/packages/$SPLASH_FILE",
1453    "$tmpdir/$SPLASH_FILE",
1454    );
1455
1456$Bccd->run_test(
1457    "system",
1458    "",
1459    "Creating isolinux splash image.",
1460    "pngtopnm $tmpdir/$SPLASH_FILE | ppmtolss16 > $tmpdir/KNOPPIX/boot/isolinux/logo.16",
1461    );
1462
1463$Bccd->run_test(
1464    "regexsub_file",
1465    "",
1466    "Adding revision to KNOPPIX boot file.",
1467    "$tmpdir/KNOPPIX/boot/isolinux/boot.msg",
1468    "==REVISION==",
1469    "$svnrev",
1470    );
1471
1472$Bccd->run_test(
1473    "regexsub_file",
1474    "",
1475    "Adding date to KNOPPIX boot file.",
1476    "$tmpdir/KNOPPIX/boot/isolinux/boot.msg",
1477    "==DATE==",
1478    "$FORMAT_DATE",
1479    );
1480
1481$Bccd->run_test(
1482        "fwrite",
1483        "",
1484        "Writing out date to /etc/$PROJECT-build-date.",
1485        "w",
1486        "$BUILDDIR/etc/$PROJECT-build-date",
1487        "$FORMAT_DATE",
1488        );
1489
1490$Bccd->run_test(
1491        "rmtree",
1492        "",
1493        "Removing linux_aufs fetch for $BUILDDIR.",
1494        "$BUILDDIR/$opts{'arch'}",
1495        );
1496
1497$Bccd->run_test(
1498    "system",
1499    "",
1500    "Created compressed root filesystem.",
1501    "bash -c 'genisoimage -R -U -V BCCD-NG -publisher ccg -hide-rr-moved -cache-inodes -no-bak -pad $BUILDDIR | create_compressed_fs  - 65536 > $tmpdir/KNOPPIX/KNOPPIX/KNOPPIX'",
1502    );
1503
1504$Bccd->run_test(
1505    "system",
1506    "",
1507    "Created bootable ISO image.",
1508    "genisoimage -pad -l -r -J -v -V BCCD-NG -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -hide-rr-moved -o $opts{'outiso'} $tmpdir/KNOPPIX",
1509    );
1510
1511print "Passed ".$Bccd->get_passed()." out of ".$Bccd->get_total()." total tests.\n";
1512
1513if($opts{'updatedb'}) {
1514    my $dbh = open_db("$opts{'updatedb'}");
1515    if( $Bccd->get_passed() < $Bccd->get_total() ) {
1516        insert_results($TESTNAME,$STAGE,$svnrev,$Bccd->snarf_file("$tmpdir/allout"),"FAILURE",$dbh);
1517    } else {
1518        insert_results($TESTNAME,$STAGE,$svnrev,$Bccd->snarf_file("$tmpdir/allout"),"SUCCESS",$dbh);
1519    }
1520    $Bccd->close_stdio();
1521    $dbh->disconnect;
1522}
1523
1524chdir $ENV{'HOME'};
1525
1526exit $Bccd->get_total()-$Bccd->get_passed();
1527
1528__END__
1529
1530build_livecd.pl - Build process based on Knoppix Live CD creation
1531
1532=head1 - SYNOPSIS
1533
1534This script is based on KNOPPIX project documentation for creating a
1535                #Test for running system commands
1536Debian-based Live CD using cloop.
1537
1538=head1 - OPTIONS
1539
1540=over 8
1541
1542=item B<--builddir> I<path-to-dir>
1543
1544Path to build directory for live CD. Will be cleaned up after the work is
1545done.
1546
1547=item B<--arch> I<arch>
1548
1549Architecture to build for.
1550
1551=item B<--outiso> I<path-to-file>
1552
1553Where to output the bccd ISO image.
1554
1555=item B<--websvn> I<websvn-url>
1556
1557Path to bccd's websvn branch, i.e. http://cluster.earlham.edu/svn/bccd-ng/trunk.
1558
1559=item B<--suite> I<release-name>
1560
1561Name of the Debian release suite to download.
1562
1563=item B<--nocleanup>
1564
1565Preserve the /tmp directory for investigation.
1566
1567=item B<--help>
1568
1569This message.
1570
1571=cut
Note: See TracBrowser for help on using the repository browser.