Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

mklrpnb 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/perl -w
  2. #
  3. # A program to make a netbootable image from a LRP firewall floppy
  4. # Tested on a Coyote Linux floppy
  5. #
  6. @cfg = `mtype a:syslinux.cfg`;
  7. unless (defined(@cfg)) {
  8. print "Cannot find syslinux.cfg on floppy\n";
  9. exit 1;
  10. }
  11. ($append) = grep(/^append/, @cfg); # find the append= line
  12. chomp($append); # remove trailing newline
  13. $append =~ s/append=//; # remove the append= at beginning
  14. @args = split(/ /, $append); # split into arguments at whitespace
  15. ($root) = grep(/^initrd=/, @args); # find the initrd= argument
  16. $root =~ s/^initrd=//; # remove the initrd= at beginning
  17. ($lrp) = grep(/^LRP=/, @args); # find the LRP= argument
  18. $lrp =~ s/^LRP=//; # remove the LRP= at beginning
  19. @lrp = split(/,/, $lrp); # split into filenames at ,
  20. unshift(@lrp, $root); # prepend the root LRP filename
  21. $append = '';
  22. foreach $i (@args) { # rebuild the append string
  23. next if ($i =~ /^initrd=/); # minus the unneeded parameters
  24. next if ($i =~ /^LRP=/);
  25. next if ($i =~ /^boot=/);
  26. $append .= "$i ";
  27. }
  28. # print "$append\n";
  29. $tempdir = "/tmp/lrp$$";
  30. mkdir($tempdir, 0777) or die "$tempdir: $!\n";
  31. chdir($tempdir) or die "$tempdir: $!\n";
  32. foreach $i (@lrp) {
  33. $i .= '.lrp' if $i !~ /\.lrp$/;
  34. print "Unpacking $i\n";
  35. system("mtype a:$i | tar zxvf -");
  36. }
  37. print "Repacking to /tmp/lrp.lrp\n";
  38. system("tar zcf /tmp/lrp.lrp *");
  39. chdir('/tmp') or die "/tmp: $!\n";
  40. system("rm -fr $tempdir");
  41. print "Extracting kernel image from floppy\n";
  42. system("mtype a:linux > /tmp/lrp.ker");
  43. print "Creating netboot image in /tmp/lrp.nb\n";
  44. system("mkelf-linux --append='$append' --output=/tmp/lrp.nb /tmp/lrp.ker /tmp/lrp.lrp");
  45. exit 0;