From 74e5270f068064f20f3dfec11c3f6d79d1cdcc3f Mon Sep 17 00:00:00 2001 From: freesource Date: Wed, 28 Nov 2001 02:39:27 +0000 Subject: [PATCH] $ENV{RELEASE} is now initialized every time a check is run on the template. Information can come from three sources, the kernel version returned from a selected kernel in the main section, the user defined kernel version in the ABS, or `uname -r`. User defined kernel version overrides the kernel. The root_fs needs to be built in relation to the actual kernel modules it will run on. Previously the $RELEASE value wasn't returned properly because of some bugs in kernel_version_check. This has been fixed. --- BootRoot/Yard.pm | 34 ++++++++++++++++++++++++++-------- gbootroot | 23 +++++++++++++++++------ 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/BootRoot/Yard.pm b/BootRoot/Yard.pm index 800b6ff..6f3b920 100644 --- a/BootRoot/Yard.pm +++ b/BootRoot/Yard.pm @@ -36,8 +36,9 @@ use Exporter; @EXPORT = qw(start_logging_output info kernel_version_check verbosity read_contents_file extra_links library_dependencies hard_links space_check create_filesystem find_file_in_path sys device_table - text_insert error logadj *LOGFILE which_tests create_fstab - make_link_absolute make_link_relative cleanup_link yard_glob); # these last two added + text_insert error warning logadj *LOGFILE which_tests + create_fstab ars2 make_link_absolute make_link_relative + cleanup_link yard_glob); # these last two added # as a test use strict; @@ -88,31 +89,44 @@ sub warning { sub verbosity { $verbosity = $_[0]; } sub text_insert { $text_insert = $_[0]; $red = $_[1]; $blue = $_[2]; } sub logadj { $logadj = $_[0]; } +my ($ars, $kernel, $kernel_version_choice); +sub ars2 { $ars = $_[0]; + + $kernel = $ars->{kernel}; + $kernel_version_choice = $ars->{kernel_version_choice}; +} + ## REQUIRES $kernel opt. $kernel_version sub kernel_version_check { my($kernel,$kernel_version) = @_; - if (defined($kernel_version)) { + + + if ( $kernel_version ) { # Check to see if it agrees my($version_guess) = kernel_version($kernel); + if ($version_guess ne $kernel_version) { ## Is this really necessary, it can be assumed a person knows ## what they are doing. info(0, "You declared kernel $kernel to be version $kernel_version\n", "even though a probe says $version_guess.", - " I'll assume you're right.\n") + " I'll assume you're right.\n"); + $ENV{'RELEASE'} = $kernel_version; + return $ENV{'RELEASE'}; } $ENV{'RELEASE'} = $kernel_version; - } elsif (defined($ENV{'RELEASE'} = kernel_version($kernel))) { + } elsif ( kernel_version($kernel) ne "ERROR" ) { + $ENV{'RELEASE'} = kernel_version($kernel); info(0, "\nVersion probe of $kernel returns: $ENV{'RELEASE'}\n"); } else { - warning "Can't determine kernel version of $kernel\n"; + warning "Can't determine kernel version of ($kernel)\n"; my($release) = `uname -r`; if ($release) { chomp($release); @@ -167,6 +181,8 @@ sub read_contents_file { } $contents_file_tmp = $contents_file; + kernel_version_check($kernel, $kernel_version_choice); + # Open DEVICE_TABLE if ( $fs_type eq "genext2fs" ) { @@ -1764,8 +1780,10 @@ sub kernel_version { # check if we have a normal file (-f dereferences symbolic links) if (!-f $image) { - $error = error("Kernel image ($image) is not a plain file.\n"); - return "ERROR"if $error && $error eq "ERROR"; + #$error = error("Kernel image ($image) is not a plain file.\n"); + #return "ERROR"if $error && $error eq "ERROR"; + $error = warning("Kernel image ($image) is not a plain file.\n"); + return "ERROR"; } else { my($str) = ""; diff --git a/gbootroot b/gbootroot index 9b2b612..a8a19c4 100755 --- a/gbootroot +++ b/gbootroot @@ -563,6 +563,9 @@ start_logging_output($verbosefn,$verbosity); # Yard "tmp dir name" # info($verbosity setting can be {0=blue,1=red}, "text") writes to verbosity # box and to the LOGFILE $tmp/verbosity. Realative to the slider 1 == 2 and # 0 == 1. +# +# warning("text") produces 0=blue output with "Warning: " appended and keeps +# count of warning via the $Warnings variable. # # error("text") returns ERROR, writes to verbosity box (Error: "text"), and # produces "gBootRoot: ERROR: "text" in error_window(), and writes to the @@ -790,6 +793,7 @@ $entry2->set_text($container[KERNEL]); if ($container[KERNEL]) { $ars->{kernel} = $container[KERNEL]; ars($ars); + ars2($ars); } button("Kernel Selection",$entry2,"Kernel Selection",1); @@ -2042,12 +2046,17 @@ sub entry_advanced { my $entry_advanced = Gtk::Entry->new(); $entry_advanced->set_editable( $true ); $entry_advanced->signal_connect( "changed", sub { - $entry_advanced[$numa] = $entry_advanced->get_text(); - if ($numa == 4) { - $ars->{filename} = $entry_advanced[$numa]; - ars($ars); - } - } ); + $entry_advanced[$numa] = $entry_advanced->get_text(); + if ($numa == 4) { + $ars->{filename} = $entry_advanced[$numa]; + ars($ars); + } + if ( $numa == 12 ) { + $ars->{kernel_version_choice} = $entry_advanced[$numa]; + ars($ars); + ars2($ars); + } + } ); $entry_advanced->set_usize(100,20); $_[5]->attach($entry_advanced,$_[0],$_[1],$_[2],$_[3], ['shrink','fill','expand'],['fill','shrink'],0,0); @@ -2273,6 +2282,7 @@ sub file_ok_sel { if ($order == 1) { $ars->{kernel} = $container[$order]; ars($ars); + ars2($ars); } # auto-detect compression if system has file @@ -2339,6 +2349,7 @@ sub entry { if ($num == 1) { $ars->{kernel} = $container[$num]; ars($ars); + ars2($ars); } # here's where types in entry3, types other places if (defined $ea1 and $num == 3) {