source: /cluster/svnroot/bccd-ng/branches/skylar-devel/bin/build_livecd.pl @ 2595

Last change on this file since 2595 was 2595, checked in by skylar, 10 years ago

merging in changes from trunk (#520)

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