summaryrefslogtreecommitdiffstats
path: root/perl-install/loopback.pm
Commit message (Expand)AuthorAgeFilesLines
* no_commentPascal Rigaux2000-09-141-1/+1
* no_commentPascal Rigaux2000-08-181-25/+0
* no_commentPascal Rigaux2000-08-041-12/+3
* no_commentPascal Rigaux2000-04-131-1/+0
* no_commentPascal Rigaux2000-04-121-10/+10
* no_commentPascal Rigaux2000-03-301-0/+19
* no_commentPascal Rigaux2000-03-261-0/+3
* no_commentPascal Rigaux2000-03-221-8/+23
* no_commentPascal Rigaux2000-03-201-21/+30
* no_commentPascal Rigaux2000-03-141-2/+27
* no_commentPascal Rigaux2000-03-111-5/+4
* no_commentPascal Rigaux2000-03-091-2/+0
* no_commentPascal Rigaux2000-03-081-0/+83
$o->{$_} eq "1" and $o->{$_} = $l[0] || die _("No floppy drive available");
+ }
+
+ $o->{blank} and $o->copyKernelFromDiskette();
+ $o->{updatemodules} and $o->updateModulesFromDiskette();
+ }
+}
+
+sub copyKernelFromDiskette {
+ my ($o) = @_;
+ return if $::testing || !$o->{blank};
+
+ fs::mount($o->{blank}, "/floppy", "vfat", 0);
+ eval { commands::cp("-f", "/floppy/vmlinuz", "$o->{prefix}/boot/vmlinuz-default") };
+ if ($@) {
+ log::l("copying of /floppy/vmlinuz from blank modified disk failed: $@");
+ }
+ fs::umount("/floppy");
+}
+
+sub updateModulesFromDiskette {
+ my ($o) = @_;
+ return if $::testing || !$o->{updatemodules};
+
+ fs::mount($o->{updatemdoules}, "/floppy", "ext2", 0);
+ foreach (glob_("$o->{prefix}/lib/modules/*")) {
+ my ($kernelVersion) = m,lib/modules/(\S*),;
+ if (-d "/floppy/$kernelVersion") {
+ my @src_files = glob_("/floppy/$kernelVersion/*");
+ my @dest_files = split "\n", `find "$o->{prefix}/lib/modules`;
+ foreach my $s (@src_files) {
+ my ($sfile, $sext) = $s =~ /([^\/\.]*\.o)(?:\.gz|\.bz2)?$/;
+ my $qsfile = quotemeta $sfile;
+ my $qsext = quotemeta $sext;
+ foreach my $target (@dest_files) {
+ $target =~ /$qsfile/ or next;
+ eval { commands::cp("-f", $s, $target) };
+ if ($@) {
+ log::l("updating module $target by $s failed: $@");
+ } else {
+ log::l("updating module $target by $s");
+ }
+ if ($target !~ /$qsfile$qsext$/) {
+ #- extension differ, first rename target file correctly,
+ #- then uncompress source file, then compress it as expected.
+ my ($basetarget, $text) = $target =~ /(.*?)(\.gz|\.bz2)$/;
+ rename $target, "$basetarget$sext";
+ $sext eq '.gz' and run_program::run("gzip", "-d", "$basetarget$sext");
+ $sext eq '.bz2' and run_program::run("bzip2", "-d", "$basetarget$sext");
+ $text eq '.gz' and run_program::run("gzip", $basetarget);
+ $text eq '.bz2' and run_program::run("bzip2", $basetarget);
+ }
+ }
+ }
+ }
+ }
+ fs::umount("/floppy");
}
#------------------------------------------------------------------------------