3 # (c) 2009 Technische Universität Dresden
4 # This file is part of TUD:OS and distributed under the terms of the
5 # GNU General Public License 2.
6 # Please see the COPYING-GPL-2 file for details.
8 # Adam Lackorzynski <adam@os.inf.tu-dresden.de>
13 BEGIN { unshift @INC, $ENV{L4DIR}.'/tool/lib'
14 if $ENV{L4DIR} && -d $ENV{L4DIR}.'/tool/lib/L4';}
18 use File::Temp qw/tempdir/;
20 my $module_path = $ENV{SEARCHPATH} || ".";
21 my %opts = L4::Grub::parse_gengrub_args();
22 my $modulesfile = shift;
23 my $isofilename = shift;
25 unless (defined $isofilename) {
26 print "usage: $0 MODULESFILE ISOFILENAME entry1 [entry2] ...\n";
30 my $tmpdir = tempdir(CLEANUP => 1);
32 system("mkdir -p \"$tmpdir\"");
34 L4::Grub::prepare_grub1_dir($tmpdir);
36 open(A, ">$tmpdir/boot/grub/menu.lst")
37 || die "Cannot create '$tmpdir/boot/grub/menu.lst': $!!";
39 print A "color 23 52\n";
40 print A "serial\nterminal serial\n" if $opts{serial};
41 print A "timeout $opts{timeout}\n" if defined $opts{timeout};
47 foreach my $entryname (@ARGV)
49 print "Processing entry '$entryname'\n";
50 my %entry = L4::ModList::get_module_entry($modulesfile, $entryname);
51 print A L4::ModList::generate_grub1_entry($entryname, '', %entry);
52 $files{$_} = 1 foreach map { L4::ModList::search_file_or_die($_, $module_path) } @{$entry{files}};
56 #system("cat $tmpdir/boot/grub/menu.lst");
57 system("cp -v ".join(' ', keys %files)." $tmpdir");
58 L4::Grub::grub1_mkisofs($isofilename, $tmpdir);