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

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

re #524:
Added support for automatic shutdown w/o password, added code to automatically shut down after test suite
Made a file, /bccd_boot_flags that populates with boot flags from the NIC on startup. Now accessing boot flags is as simple as source /bccd_boot_flags.

  • Property svn:executable set to *
File size: 34.7 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-bootflags", "init.d/bccd-auotmated", "init.d/bccd-passwd",
328                   "init.d/bccd-dhcp", "init.d/bccd-sshd", "X11/xorg.conf",
329          "lam.conf", "init.d/bccd-nfs", "init.d/bccd-unite-sw", "init.d/bccd-nics",
330          "init.d/bccd-dhcp-conf", "init.d/bccd-route", "init.d/bccd-keyboard", "rc.local",
331          "init.d/bccd-fsrw", "init.d/bccd-mail", "auto.master", "auto.sshfs", "ld.so.conf.d/CUDA.conf" ) {
332    $Bccd->run_test(
333        "revfetch",
334        "",
335        "Fetched /etc/$file file.",
336        $svnrev,
337        "$websvn/packages/etc/$file",
338        "$BUILDDIR/etc/$file",
339        );
340}
341
342$Bccd->run_test(
343    "chmod",
344    "",
345    "Set $BUILDDIR/etc/sudoers user/group readable only.",
346    0440,
347    "$BUILDDIR/etc/sudoers",
348    );
349
350foreach my $file ( "bccd-networking", "bccd-passwd", "bccd-dhcp", "bccd-sshd", "bccd-nfs", "bccd-unite-sw",
351          "bccd-nics", "bccd-dhcp-conf", "bccd-route", "bccd-keyboard", "bccd-fsrw", "bccd-mail", "bccd-bootflags", "bccd-automated" ) {
352    $Bccd->run_test(
353        "chmod",
354        "",
355        "Set $BUILDDIR/etc/init.d/$file executable.",
356        0755,
357        "$BUILDDIR/etc/init.d/$file",
358        );
359}
360
361$cwd = getcwd();
362
363$Bccd->run_test(
364    "chdir",
365    "",
366    "cd $BUILDDIR",
367    "$BUILDDIR",
368    );
369
370$Bccd->run_test(
371    "recrevfetch",
372    "",
373    "Fetched lib directory.",
374    $svnrev,
375    "$websvn/trees/lib/",
376    );
377
378$Bccd->run_test(
379    "recrevfetch",
380    "",
381    "Fetched bin directory.",
382    $svnrev,
383    "$websvn/trees/bin/",
384    );
385
386$Bccd->run_test(
387    "recrevfetch",
388    "",
389    "Fetched etc tree.",
390    $svnrev,
391    "$websvn/trees/etc/",
392    );
393
394$Bccd->run_test(
395    "recrevfetch",
396    "",
397    "Fetched root home directory.",
398    $svnrev,
399    "$websvn/trees/root/",
400    );
401
402
403$Bccd->run_test(
404    "chdir",
405    "",
406    "cd $BUILDDIR/etc",
407    "$BUILDDIR/etc",
408    );
409
410$Bccd->run_test(
411    "recrevfetch",
412    "",
413    "Fetched skel profile.",
414    $svnrev,
415    "$websvn/packages/etc/skel",
416    );
417
418foreach my $file ( "$BUILDDIR/etc/skel/.firstlogin", "$BUILDDIR/etc/skel/.bash_profile", ) {
419    $Bccd->run_test(
420        "chmod",
421        "",
422        "chmod 0755 $file",
423        0755,
424        "$file",
425        );
426}
427
428if(-f "$BUILDDIR/etc/skel/.bashrc") {
429    $Bccd->run_test(
430        "unlink",
431        "",
432        "Removed default .bashrc",
433        "$BUILDDIR/etc/skel/.bashrc",
434        );
435}
436
437$Bccd->run_test(
438    "chdir",
439    "",
440    "cd'ing into $BUILDDIR/etc/skel",
441    "$BUILDDIR/etc/skel",
442    );
443
444$Bccd->run_test(
445    "chdir",
446    "",
447    "cd $cwd",
448    "$cwd",
449    );
450
451$Bccd->run_test(
452    "revfetch",
453    "",
454    "Fetched liberate script.",
455    $svnrev,
456    "$websvn/packages/liberate.pl",
457    "$BUILDDIR/root/liberate.pl",
458    );
459
460$Bccd->run_test(
461    "revfetch",
462    "",
463    "Fetched /etc/default/useradd file.",
464    $svnrev,
465    "$websvn/packages/etc/default/useradd",
466    "$BUILDDIR/etc/default/useradd",
467    );
468
469$Bccd->run_test(
470    "fwrite",
471    "",
472    "Allowing initrd kernel upgrade.",
473    "a",
474    "$BUILDDIR/etc/kernel-img.conf",
475    "do_initrd=yes",
476    );
477
478$Bccd->run_test(
479    "system",
480    "",
481    "Updated apt cache.",
482    "/usr/sbin/chroot $BUILDDIR apt-get update",
483    );
484
485$Bccd->run_test(
486    "system",
487    "",
488    "Fetched pre-install dependencies.",
489    "/usr/sbin/chroot $BUILDDIR apt-get -y --allow-unauthenticated  install debian-archive-keyring initramfs-tools",
490    );
491
492if($opts{'arch'} eq 'i386') {
493        $Bccd->run_test(
494            "system",
495            "0",
496            "Fetched Debian packages.",
497            "/usr/sbin/chroot $BUILDDIR /usr/bin/aptitude --allow-untrusted -y install $PACKAGES $EXTRA_PACKAGES",
498            );
499}
500elsif($opts{'arch'} eq 'amd64') {
501        $Bccd->run_test(
502            "system",
503            "0",
504            "Fetched Debian packages.",
505            "/usr/sbin/chroot $BUILDDIR aptitude --allow-untrusted -y install $PACKAGES $EXTRA_PACKAGES $AMD64_PACKAGES",
506            );
507}
508
509if($opts{'arch'} eq 'amd64') {
510    $Bccd->run_test(
511        "system",
512        "",
513        "Symlinking IA32 libstdc++ compatibility library.",
514        "/usr/sbin/chroot $BUILDDIR ln -s /usr/lib32/libstdc++.so.6 /usr/lib32/libstdc++.so",
515        );
516}
517
518# Workaround for tftpd-hpa/inetd conflict
519$Bccd->run_test(
520    "system",
521    "",
522    "Removing inetutils-inetd to avoid conflict with tftpd-hpa.",
523    "/usr/sbin/chroot $BUILDDIR /usr/bin/dpkg -r inetutils-inetd",
524    );
525
526$Bccd->run_test(
527    "system",
528    100,
529    "Fetching tftpd-hpa separately.",
530    "/usr/sbin/chroot $BUILDDIR /usr/bin/apt-get --force-yes -y install tftpd-hpa",
531    );
532
533$Bccd->run_test(
534    "system",
535    "",
536    "Deleted cached deb packages.",
537    "/usr/sbin/chroot $BUILDDIR apt-get clean",
538    );
539
540$Bccd->run_test(
541    "revfetch",
542    "",
543    "Fetched tftpd-hpa configuration.",
544    $svnrev,
545    "$websvn/packages/etc/default/tftpd-hpa",
546    "$BUILDDIR/etc/default/tftpd-hpa",
547    );
548
549$Bccd->run_test(
550    "revfetch",
551    "",
552    "Fetched NIS default domain.",
553    $svnrev,
554    "$websvn/packages/etc/defaultdomain",
555    "$BUILDDIR/etc/defaultdomain",
556    );
557
558$Bccd->run_test(
559    "mkpath",
560    "",
561    "Making $KERNREV modules directory.",
562    "$BUILDDIR/lib/modules/$KERNREV",
563    );
564
565$Bccd->run_test(
566    "revfetch",
567    "",
568    "Fetched ssh_config file.",
569    $svnrev,
570    "$websvn/packages/etc/ssh/ssh_config",
571    "$BUILDDIR/etc/ssh/ssh_config",
572    );
573
574$Bccd->run_test(
575    "revfetch",
576    "",
577    "Fetched sshd_config file.",
578    $svnrev,
579    "$websvn/packages/etc/ssh/sshd_config",
580    "$BUILDDIR/etc/ssh/sshd_config",
581    );
582
583$Bccd->run_test(
584    "mkpath",
585    "",
586    "mkdir $BUILDDIR/etc/udev/rules.d",
587    "$BUILDDIR/etc/udev/rules.d",
588    );
589
590$Bccd->run_test(
591    "revfetch",
592    "",
593    "Fetched USB automounting udev rule.",
594    $svnrev,
595    "$websvn/packages/etc/udev/rules.d/99-automount_usb.rules",
596    "$BUILDDIR/etc/udev/rules.d/99-automount_usb.rules",
597    );
598
599# Revision write
600
601$Bccd->run_test(
602    "fwrite",
603    "",
604    "Opened $BUILDDIR/etc/$PROJECT-revision for writing.",
605    "w",
606    "$BUILDDIR/etc/$PROJECT-revision",
607    "$svnrev",
608    );
609
610# Install software
611
612$Bccd->run_test(
613    "mkpath",
614    "",
615    "Created node checkin directory.",
616    "$CHECKIN",
617    );
618
619
620$nouid = $Bccd->run_test(
621    "getuseruid",
622    "",
623    "Got uid for nobody user.",
624    "nobody",
625    );
626
627$nogid = $Bccd->run_test(
628    "getusergid",
629    "",
630    "Got gid for nobody user.",
631    "nobody",
632    );
633
634$Bccd->run_test(
635    "chown",
636    "",
637    "chown'd checkin directory $CHECKIN to $nouid:$nogid.",
638    "$nouid",
639    "$nogid",
640    "$CHECKIN",
641    );
642
643if( ! -f "$BUILDDIR/usr/bin/python2" ) {
644    $Bccd->run_test(
645        "system",
646        "",
647        "Linked python->python2 for C3 tools.",
648        "/usr/sbin/chroot $BUILDDIR ln -s /usr/bin/python2.5 /usr/bin/python2",
649        );
650}
651
652$Bccd->run_test(
653    "system",
654    "",
655    "Linked VBoxService into /usr/sbin.",
656    "/usr/sbin/chroot $BUILDDIR ln -s /opt/VBoxGuestAdditions-3.2.8/sbin/VBoxService /usr/sbin/VBoxService",
657    );
658
659foreach my $vb ("VBoxClient","VBoxControl") {
660    $Bccd->run_test(
661        "system",
662        "",
663        "Linked $vb into /usr/bin.",
664        "/usr/sbin/chroot $BUILDDIR ln -s /opt/VBoxGuestAdditions-3.2.8/bin/$vb /usr/bin/$vb",
665        );
666}
667
668$Bccd->run_test(
669    "fcopy",
670    "",
671    "Copied pxelinux to tftpboot.",
672    "$BUILDDIR/usr/lib/syslinux/pxelinux.0",
673    "$BUILDDIR/var/lib/tftpboot/pxelinux.0",
674    );
675
676$Bccd->run_test(
677    "mkpath",
678    "",
679    "Made $BUILDDIR/var/lib/tftpboot/pxelinux.cfg",
680    "$BUILDDIR/var/lib/tftpboot/pxelinux.cfg",
681    );
682
683foreach my $file ( "dhcpd.conf", "dhclient.conf", "dhclient.conf-bccd", "dhclient.conf-any" ) {
684    $Bccd->run_test(
685        "revfetch",
686        "",
687        "Fetched DHCP $file configuration.",
688        $svnrev,
689        "$websvn/packages/etc/dhcp3/$file",
690        "$BUILDDIR/etc/dhcp3/$file",
691        );
692}
693
694# Needed down here to prevent hang with debconf
695foreach my $file ( "exports", "hosts.equiv", "gpm.conf", "inittab" ) {
696    $Bccd->run_test(
697        "revfetch",
698        "",
699        "Fetched /etc/$file file.",
700        $svnrev,
701        "$websvn/packages/etc/$file",
702        "$BUILDDIR/etc/$file",
703        );
704}
705
706$Bccd->run_test(
707    "system",
708    "",
709    "Setting LSB parsing of init scripts.",
710    "touch $BUILDDIR/etc/update-rc.d-lsbparse",
711    );
712
713$Bccd->run_test(
714    "system",
715    "",
716    "Disabling hardware-optimized ld.so directories.",
717    "touch $BUILDDIR/etc/ld.so.nohwcap",
718    );
719
720foreach my $script ("nis", "ssh-host-keys", "nfs-kernel-server", "ssh",
721                    "dhcp3-server", "dbus", "hal", "apache2",) {
722    $Bccd->run_test(
723        "system",
724        "",
725        "Disabled $script.",
726        "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d -f $script remove",
727        );
728}
729
730foreach my $script ("nfs-common", "vboxadd-service", "mpd","bccd-mail", ) {
731    $Bccd->run_test(
732        "system",
733        "",
734        "Enabling $script at boot time.",
735        "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d $script defaults",
736        );
737}
738
739# This must run before 20 (bccd-passwd) and autofs
740foreach my $script ("bccd-unite-sw", "perfctr","bccd-bootflags","bccd-automated") {
741    $Bccd->run_test(
742        "system",
743        "",
744        "Enabling $script config.",
745        "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d $script defaults 18",
746        );
747}
748
749# Based on virtualbox install script
750foreach my $script ("vboxadd","vboxadd-x11",) {
751    $Bccd->run_test(
752        "system",
753        "",
754        "Enabling $script config.",
755        "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d $script defaults 30",
756        );
757}
758
759$Bccd->run_test(
760    "system",
761    "",
762    "Enabling vboxadd-service config.",
763    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d vboxadd-service defaults 35",
764    );
765
766$Bccd->run_test(
767        "system",
768        "",
769        "Enabling home directory overlay cleaning.",
770        "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-clean-home start 5 2 S .",
771        );
772
773$Bccd->run_test(
774    "system",
775    "",
776    "Enabling bccd-nics config.",
777    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-nics start 39 S .",
778    );
779
780$Bccd->run_test(
781    "system",
782    "",
783    "Enabling bccd-dhcp-conf config.",
784    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-dhcp-conf start 38 S .",
785    );
786
787$Bccd->run_test(
788    "system",
789    "",
790    "Enabling bccd-route config.",
791    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-route start 41 S .",
792    );
793
794$Bccd->run_test(
795    "system",
796    "",
797    "Enabling bccd-fsrw config.",
798    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-fsrw start 11 S .",
799    );
800
801$Bccd->run_test(
802    "system",
803    "",
804    "Enabling bccd-keyboard config.",
805    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-keyboard start 18 S .",
806    );
807
808$Bccd->run_test(
809    "system",
810    "",
811    "Enabling bccd-networking config.",
812    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-networking start 42 2 S .",
813    );
814
815$Bccd->run_test(
816    "system",
817    "",
818    "Enabling networking config.",
819    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d networking start 42 2 S .",
820    );
821
822$Bccd->run_test(
823    "system",
824    "",
825    "Enabling bccd-nfs config.",
826    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-nfs start 20 2 S .",
827    );
828
829$Bccd->run_test(
830    "system",
831    "",
832    "Enabling bccd-passwd config.",
833    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-passwd start 20 S .",
834    );
835
836$Bccd->run_test(
837    "system",
838    "",
839    "Enabling bccd-sshd config.",
840    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-sshd start 20 2 S .",
841    );
842
843$Bccd->run_test(
844    "system",
845    "",
846    "Enabling bccd-dhcp config.",
847    "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d bccd-dhcp start 40 S .",
848    );
849
850$Bccd->run_test(
851    "system",
852    "",
853    "Added root password.",
854    "/usr/sbin/chroot $BUILDDIR /usr/sbin/usermod -p '\$1\$erNdlHdL\$EV6C0eBbe6M3bVaK9m4If0' root",
855    );
856
857# User creation
858
859# Manual writes to keep NIS from interfering with static uid/gid
860
861$Bccd->run_test(
862    "fwrite",
863    "",
864    "Wrote out sshd user.",
865    "a",
866    "$BUILDDIR/etc/passwd",
867    "sshd:x:103:65534::/var/run/sshd:/usr/sbin/nologin",
868    );
869
870$Bccd->run_test(
871    "fwrite",
872    "",
873    "Wrote out sshd group.",
874    "a",
875    "$BUILDDIR/etc/shadow",
876    "sshd:!:13625:0:99999:7:::",
877    );
878
879$Bccd->run_test(
880    "system",
881    "",
882    "Creating non-root-group account.",
883    "/usr/sbin/chroot $BUILDDIR /usr/sbin/groupadd -g 1000 bccd",
884    );
885
886$Bccd->run_test(
887    "system",
888    "",
889    "Created non-root user account.",
890    "/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",
891    );
892
893$Bccd->run_test(
894    "system",
895    "",
896    "Created vbox user account.",
897    "/usr/sbin/chroot $BUILDDIR /usr/sbin/useradd -s /bin/sh -G daemon -d /var/run/vboxadd vboxadd",
898    );
899
900$Bccd->run_test(
901    "system",
902    "",
903    "Altered non-root account directory for KNOPPIX.",
904    "/usr/sbin/chroot $BUILDDIR /usr/sbin/usermod -d /UNIONFS/home/$USER $USER",
905    );
906
907# Bccd perl modules
908
909$Bccd->run_test(
910    "mkpath",
911    "",
912    "mkdir $BUILDDIR/$PERLDIR",
913    "$BUILDDIR/$PERLDIR",
914    );
915
916$Bccd->run_test(
917    "chdir",
918    "",
919    "cd'd to $BUILDDIR/$PERLDIR/../",
920    "$BUILDDIR/$PERLDIR/../",
921    );
922
923
924$Bccd->run_test(
925    "recrevfetch",
926    "",
927    "Checked out Bccd perl modules.",
928    $svnrev,
929    "$websvn/trees/$PERLDIR/",
930    );
931
932$Bccd->run_test(
933    "chdir",
934    "",
935    "cd'd to $tmpdir.",
936    "$tmpdir",
937    );
938
939$Bccd->run_test(
940    "recrevfetch",
941    "",
942    "Checked out hardware autodetect stuff.",
943    $svnrev,
944    "$websvn/trees/hwsetup/",
945    );
946
947$Bccd->run_test(
948    "system",
949    "",
950    "Copied hardware autodetect into $BUILDDIR.",
951    "cp -R $tmpdir/hwsetup/* $BUILDDIR/",
952    );
953
954# Starting hwsetup init scripts
955foreach my $script ( "knoppix-autoconfig", "xserver-xorg" ) {
956    $Bccd->run_test(
957        "system",
958        "",
959        "Enabled $script.",
960        "/usr/sbin/chroot $BUILDDIR /usr/sbin/update-rc.d $script start 20 2 3 4 5 .",
961        );
962}
963
964# Software install
965
966$Bccd->run_test(
967    "chdir",
968    "",
969    "cd'd to $BUILDDIR",
970    "$BUILDDIR",
971    );
972
973$Bccd->run_test(
974    "recrevfetch",
975    "",
976    "Fetched software tree.",
977    $svnrev,
978    "$websvn/trees/software/bccd/",
979    );
980
981$Bccd->run_test(
982    "system",
983    "",
984    "Changed $SOFTWARE to bccd:bccd.",
985    "/usr/sbin/chroot $BUILDDIR /bin/chown -R bccd:bccd $SOFTWARE",
986    );
987
988foreach my $prog ( <$BUILDDIR/bccd/software/*/bin/*> ) {
989    $Bccd->run_test(
990        "chmod",
991        "",
992        "chmod 0755 $prog",
993        0755,
994        "$prog",
995        );
996}
997
998$Bccd->run_test(
999        "mkpath",
1000        "",
1001        "mkdir $BUILDDIR/usr/lib/iceweasel/plugins",
1002        "$BUILDDIR/usr/lib/iceweasel/plugins", 
1003        );
1004
1005$Bccd->run_test(
1006        "fcopy",
1007        "",
1008        "cp $BUILDDIR//bccd/software/jre1.6.0_13/plugin/i386/ns7/libjavaplugin_oji.so $BUILDDIR/usr/lib/iceweasel/plugins",
1009        "$BUILDDIR//bccd/software/jre1.6.0_13/plugin/i386/ns7/libjavaplugin_oji.so",
1010        "$BUILDDIR/usr/lib/iceweasel/plugins",
1011        );
1012
1013$Bccd->run_test(
1014    "chdir",
1015    "",
1016    "cd $BUILDDIR/",
1017    "$BUILDDIR/",
1018    );
1019
1020$Bccd->run_test(
1021    "recrevfetch",
1022    "",
1023    "Fetched test tree.",
1024    $svnrev,
1025    "$websvn/trees/home",
1026    );
1027
1028$Bccd->run_test(
1029    "system",
1030    "",
1031    "chown'd $BUILDDIR/home/bccd to bccd:bccd",
1032    "/usr/sbin/chroot $BUILDDIR chown -R $USER:$USER /home/bccd",
1033    );
1034
1035$Bccd->run_test(
1036    "chmod",
1037    "",
1038    "chmod 0600 $BUILDDIR/home/bccd/.mpd.conf",
1039    0600,
1040    "$BUILDDIR/home/bccd/.mpd.conf",
1041    );
1042
1043$Bccd->run_test(
1044    "chmod",
1045    "",
1046    "chmod 0755 $BUILDDIR/root/.ssh/",
1047    0755,
1048    "$BUILDDIR/root/.ssh/",
1049    );
1050
1051$Bccd->run_test(
1052    "chmod",
1053    "",
1054    "chmod 0755 $BUILDDIR/home/$USER/.ssh",
1055    0755,
1056    "$BUILDDIR/home/$USER/.ssh",
1057    );
1058
1059$Bccd->run_test(
1060                "chmod",
1061                "",
1062                "chmod 0755 $BUILDDIR/home/$USER",
1063                0755,
1064                "$BUILDDIR/home/$USER",
1065                );
1066
1067foreach my $file ( "$BUILDDIR/root/.ssh/bccd", "$BUILDDIR/root/.ssh/config" ) {
1068    $Bccd->run_test(
1069        "chmod",
1070        "",
1071        "chmod 0600 $file",
1072        0600,
1073        "$file",
1074        );
1075}
1076
1077foreach my $key ( <$BUILDDIR/etc/ssh/ssh*key*> ) {
1078    $Bccd->run_test(
1079        "unlink",
1080        "",
1081        "Removed ssh key $key.",
1082        "$key",
1083        );
1084}
1085
1086$Bccd->run_test(
1087    "system",
1088    "",
1089    "Requiring bccd ssh start script for ssh start.",
1090    "perl -wpli -e 's/^(#\\s+Required-Start:\\s+.*\$)/\$1 bccd-sshd/' $BUILDDIR/etc/init.d/ssh",
1091    );
1092
1093$Bccd->run_test(
1094    "system",
1095    "",
1096    "Requiring bccd nic start script for networking start.",
1097    "perl -wpli -e 's/^(#\\s+Required-Start:\\s+.*\$)/\$1 bccd-nics/' $BUILDDIR/etc/init.d/networking",
1098    );
1099
1100$Bccd->run_test(
1101    "system",
1102    "",
1103    "Allowing pdnsd to listen on all interfaces.",
1104    "perl -wpli -e 's!(server_ip = )!// \$1!g' $BUILDDIR/usr/share/pdnsd/pdnsd-resolvconf.conf",
1105    );
1106
1107$Bccd->run_test(
1108    "system",
1109    "",
1110    "Fixing cstddef for openmpi.",
1111    "perl -wpli -e 's/#include_next/#include/g' $BUILDDIR/usr/include/c++/4.3/cstddef",
1112    );
1113
1114# Make us LIVE
1115
1116$Bccd->run_test(
1117    "fwrite",
1118    "",
1119    "Made us LIVE.",
1120    "w",
1121    "$BUILDDIR/etc/$PROJECT-stage",
1122    "LIVE",
1123    );
1124
1125# Setting up menus
1126
1127foreach my $file (<$BUILDDIR/usr/share/menu/*>) {
1128    $Bccd->run_test(
1129        "unlink",
1130        "",
1131        "rm'd X menu item $file",
1132        "$file",
1133        );
1134}
1135
1136$cwd = getcwd();
1137
1138$Bccd->run_test(
1139    "chdir",
1140    "",
1141    "cd $BUILDDIR/",
1142    "$BUILDDIR/",
1143    );
1144
1145$Bccd->run_test(
1146    "recrevfetch",
1147    "",
1148    "Fetched /usr items.",
1149    $svnrev,
1150    "$websvn/trees/usr/",
1151    );
1152
1153$Bccd->run_test(
1154    "recrevfetch",
1155    "",
1156    "Fetched architecure-specific items for $opts{'arch'}.",
1157    $svnrev,
1158    "$websvn/trees/arch/$opts{'arch'}",
1159    );
1160
1161$Bccd->run_test(
1162    "system",
1163    "",
1164    "Copied architecture-specific items from /$opts{'arch'} to /.",
1165        "/usr/sbin/chroot $BUILDDIR /usr/bin/rsync -av --progress /$opts{'arch'}/ /",
1166    );
1167
1168$Bccd->run_test(
1169        "fcopy",
1170        "",
1171        "Copied cloop.ko into $tmpdir.",
1172        "$BUILDDIR/KNOPPIX/KNOPPIX/modules/cloop.ko",
1173        "$tmpdir/cloop.ko",
1174        );
1175
1176$Bccd->run_test(
1177    "chdir",
1178    "",
1179    "Changed back to old directory.",
1180    "$cwd",
1181    );
1182
1183$Bccd->run_test(
1184    "system",
1185    "",
1186    "Updated desktop menus.",
1187    "/usr/sbin/chroot $BUILDDIR /usr/bin/update-menus",
1188    );
1189
1190# Software end
1191
1192# Pre-fetching liberation stuff
1193
1194$Bccd->run_test(
1195    "revfetch",
1196    "",
1197    "Fetched LVM fdisk script.",
1198    $svnrev,
1199    "$websvn/packages/fdisk_lvm.input",
1200    "$BUILDDIR/$LIBFETCH/fdisk_lvm.input",
1201    );
1202
1203$Bccd->run_test(
1204    "revfetch",
1205    "",
1206    "Fetched BCCD splash screen.",
1207    $svnrev,
1208    "$websvn/packages/$SPLASH_FILE",
1209    "$BUILDDIR/$LIBFETCH/$SPLASH_FILE",
1210    );
1211
1212$Bccd->run_test(
1213    "revfetch",
1214    "",
1215    "Fetched liberation exports file.",
1216    $svnrev,
1217    "$websvn/packages/etc/exports.liberate",
1218    "$BUILDDIR/$LIBFETCH/exports",
1219    );
1220
1221$Bccd->run_test(
1222    "chdir",
1223    "",
1224    "cd'ing to $BUILDDIR/$LIBFETCH/.",
1225    "$BUILDDIR/$LIBFETCH",
1226    );
1227
1228$Bccd->run_test(
1229    "system",
1230    "",
1231    "Tar'd up linux_aufs.",
1232    "tar -C $BUILDDIR -cjvf $BUILDDIR/$LIBFETCH/lib-linux.tar.bz2 boot lib/modules var/lib/tftpboot",
1233    );
1234
1235foreach my $file (grep(-f $_, <$BUILDDIR/var/lib/apt/lists/*>)) {
1236        $Bccd->run_test(
1237            "unlink",
1238            "",
1239            "Removed apt file lists.",
1240            "$file",
1241            );
1242}
1243
1244$Bccd->run_test(
1245    "recrevfetch",
1246    "",
1247    "Fetched $websvn/trees/diskless over svn.",
1248    $svnrev,
1249    "$websvn/trees/diskless",
1250    );
1251
1252$Bccd->run_test(
1253    "chdir",
1254    "",
1255    "Reverted to $cwd.",
1256    "$cwd",
1257    );
1258
1259$Bccd->run_test(
1260    "revfetch",
1261    "",
1262    "Fetched grub menu.",
1263    $svnrev,
1264    "$websvn/packages/boot/grub/menu.lst",
1265    "$BUILDDIR/$LIBFETCH/grub_menu.lst",
1266    );
1267
1268$Bccd->run_test(
1269    "lsofkill",
1270    "",
1271    "Killing procs in $BUILDDIR: ",
1272    "$BUILDDIR",
1273    );
1274
1275# Make here so automount doesn't destroy it
1276
1277$Bccd->run_test(
1278    "mkpath",
1279    "",
1280    "mkdir $BUILDDIR/mnt/ssh",
1281    "$BUILDDIR/mnt/ssh",
1282    );
1283
1284$Bccd->run_test(
1285    "chdir",
1286    "",
1287    "cd'd to $tmpdir for Knoppix fetch.",
1288    "$tmpdir",
1289    );
1290
1291$Bccd->run_test(
1292    "recrevfetch",
1293    "",
1294    "Fetched KNOPPIX sans root filesystem.",
1295    $svnrev,
1296    "$websvn/trees/KNOPPIX/",
1297    );
1298
1299$Bccd->run_test(
1300    "fcopy",
1301    "",
1302    "Copying Linux kernel into KNOPPIX image.",
1303    "$BUILDDIR/boot/vmlinuz-$KERNREV",
1304    "$tmpdir/KNOPPIX/boot/isolinux/linux",
1305    );
1306
1307$Bccd->run_test(
1308        "system",
1309        "",
1310        "Making network initramfs.",
1311        "/usr/sbin/chroot $BUILDDIR /usr/sbin/mkinitramfs -d /etc/initramfs-tools.diskless -o /var/lib/tftpboot/initramfs-$KERNREV $KERNREV",
1312        );
1313
1314$Bccd->run_test(
1315    "system",
1316    "",
1317    "Unpacking initramfs modules for KNOPPIX minirt.",
1318    qq{gzip -d -c $BUILDDIR/var/lib/tftpboot/initramfs-$KERNREV|cpio --make-directories -i 'lib/modules/$KERNREV/*'},
1319    );
1320
1321$Bccd->run_test(
1322    "rename",
1323    "",
1324    "Moved initramfs modules into KNOPPIX minirt.",
1325    "$tmpdir/lib/modules/",
1326    "$tmpdir/KNOPPIX/boot/isolinux/minirt/modules",
1327    );
1328
1329$Bccd->run_test(
1330        "unlink",
1331        "",
1332        "Removing temporary net initramfs.",
1333        "$BUILDDIR/var/lib/tftpboot/initramfs-$KERNREV",
1334        );
1335
1336$Bccd->run_test(
1337    "system",
1338    "",
1339    "Unmounted $BUILDDIR/proc.",
1340    "umount -l $BUILDDIR/proc",
1341    );
1342
1343$Bccd->run_test(
1344    "system",
1345    "",
1346    "Unmounted $BUILDDIR/sys.",
1347    "umount -l $BUILDDIR/sys",
1348    );
1349
1350$Bccd->run_test(
1351    "fmove",
1352    "",
1353    "Moved cloop.ko into KNOPPIX directory.",
1354    "$tmpdir/cloop.ko",
1355    "$tmpdir/KNOPPIX/KNOPPIX/modules/cloop.ko",
1356    );
1357
1358
1359$Bccd->run_test(
1360        "revfetch",
1361        "",
1362        "Fetched minirt device configuration.",
1363        $svnrev,
1364        "$websvn/packages/mknod.y",
1365        "$tmpdir/mknod.y",
1366        );
1367
1368$Bccd->run_test(
1369        "mknods",
1370        "",
1371        "Created minirt device nodes.",
1372        "$tmpdir/mknod.y",
1373        "$tmpdir/KNOPPIX/boot/isolinux/minirt",
1374        );
1375
1376$Bccd->run_test(
1377        "system",
1378        "",
1379        "Created minirt filesystem.",
1380        "dd if=/dev/zero of=$tmpdir/minirt bs=1k count=14700",
1381        );
1382
1383$Bccd->run_test(
1384        "system",
1385        "",
1386        "Made ext2 filesystem in minirt filesystem.",
1387        "/sbin/mke2fs -F $tmpdir/minirt",
1388        );
1389
1390$Bccd->run_test(
1391        "mkpath",
1392        "",
1393        "Made loop directory.",
1394        "$tmpdir/loop",
1395        );
1396
1397$Bccd->run_test(
1398        "system",
1399        "",
1400        "Mounted minirt on loop directory.",
1401        "/bin/mount -t ext2 -o loop $tmpdir/minirt $tmpdir/loop",
1402        );
1403
1404$Bccd->run_test(
1405        "system",
1406        "",
1407        "Copied minirt into loop filesystem.",
1408        "rsync -a $tmpdir/KNOPPIX/boot/isolinux/minirt/ $tmpdir/loop/",
1409        );
1410
1411$Bccd->run_test(
1412        "mkpath",
1413        "",
1414        "Made modules directory in loop filesystem.",
1415        "$tmpdir/loop/modules/",
1416        );
1417
1418foreach my $mod (@MINIRT_MODS) {
1419        $Bccd->run_test(
1420                "system",
1421                "",
1422                "Copied $mod into minirt loop filesystem.",
1423                "find $BUILDDIR/lib/modules/$KERNREV/ -type f -name $mod -exec /bin/cp -v {} $tmpdir/loop/modules/$mod \\;",
1424        );
1425}
1426
1427$Bccd->run_test(
1428        "system",
1429        "",
1430        "Unmounted loop filesystem.",
1431        "umount $tmpdir/loop/",
1432        );
1433
1434$Bccd->run_test(
1435        "rmtree",
1436        "",
1437        "Removed minirt tree.",
1438        "$tmpdir/KNOPPIX/boot/isolinux/minirt/",
1439        );
1440
1441$Bccd->run_test(
1442        "system",
1443        "",
1444        "Placed minirt in KNOPPIX tree.",
1445        "gzip -c $tmpdir/minirt > $tmpdir/KNOPPIX/boot/isolinux/minirt.gz",
1446        );
1447
1448$Bccd->run_test(
1449    "revfetch",
1450    "",
1451    "Fetched background image.",
1452    $svnrev,
1453    "$websvn/packages/$SPLASH_FILE",
1454    "$tmpdir/$SPLASH_FILE",
1455    );
1456
1457$Bccd->run_test(
1458    "system",
1459    "",
1460    "Creating isolinux splash image.",
1461    "pngtopnm $tmpdir/$SPLASH_FILE | ppmtolss16 > $tmpdir/KNOPPIX/boot/isolinux/logo.16",
1462    );
1463
1464$Bccd->run_test(
1465    "regexsub_file",
1466    "",
1467    "Adding revision to KNOPPIX boot file.",
1468    "$tmpdir/KNOPPIX/boot/isolinux/boot.msg",
1469    "==REVISION==",
1470    "$svnrev",
1471    );
1472
1473$Bccd->run_test(
1474    "regexsub_file",
1475    "",
1476    "Adding date to KNOPPIX boot file.",
1477    "$tmpdir/KNOPPIX/boot/isolinux/boot.msg",
1478    "==DATE==",
1479    "$FORMAT_DATE",
1480    );
1481
1482$Bccd->run_test(
1483        "fwrite",
1484        "",
1485        "Writing out date to /etc/$PROJECT-build-date.",
1486        "w",
1487        "$BUILDDIR/etc/$PROJECT-build-date",
1488        "$FORMAT_DATE",
1489        );
1490
1491$Bccd->run_test(
1492        "rmtree",
1493        "",
1494        "Removing linux_aufs fetch for $BUILDDIR.",
1495        "$BUILDDIR/$opts{'arch'}",
1496        );
1497
1498$Bccd->run_test(
1499    "system",
1500    "",
1501    "Created compressed root filesystem.",
1502    "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'",
1503    );
1504
1505$Bccd->run_test(
1506    "system",
1507    "",
1508    "Created bootable ISO image.",
1509    "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",
1510    );
1511
1512print "Passed ".$Bccd->get_passed()." out of ".$Bccd->get_total()." total tests.\n";
1513
1514if($opts{'updatedb'}) {
1515    my $dbh = open_db("$opts{'updatedb'}");
1516    if( $Bccd->get_passed() < $Bccd->get_total() ) {
1517        insert_results($TESTNAME,$STAGE,$svnrev,$Bccd->snarf_file("$tmpdir/allout"),"FAILURE",$dbh);
1518    } else {
1519        insert_results($TESTNAME,$STAGE,$svnrev,$Bccd->snarf_file("$tmpdir/allout"),"SUCCESS",$dbh);
1520    }
1521    $Bccd->close_stdio();
1522    $dbh->disconnect;
1523}
1524
1525chdir $ENV{'HOME'};
1526
1527exit $Bccd->get_total()-$Bccd->get_passed();
1528
1529__END__
1530
1531build_livecd.pl - Build process based on Knoppix Live CD creation
1532
1533=head1 - SYNOPSIS
1534
1535This script is based on KNOPPIX project documentation for creating a
1536                #Test for running system commands
1537Debian-based Live CD using cloop.
1538
1539=head1 - OPTIONS
1540
1541=over 8
1542
1543=item B<--builddir> I<path-to-dir>
1544
1545Path to build directory for live CD. Will be cleaned up after the work is
1546done.
1547
1548=item B<--arch> I<arch>
1549
1550Architecture to build for.
1551
1552=item B<--outiso> I<path-to-file>
1553
1554Where to output the bccd ISO image.
1555
1556=item B<--websvn> I<websvn-url>
1557
1558Path to bccd's websvn branch, i.e. http://cluster.earlham.edu/svn/bccd-ng/trunk.
1559
1560=item B<--suite> I<release-name>
1561
1562Name of the Debian release suite to download.
1563
1564=item B<--nocleanup>
1565
1566Preserve the /tmp directory for investigation.
1567
1568=item B<--help>
1569
1570This message.
1571
1572=cut
Note: See TracBrowser for help on using the repository browser.