Browse Source

$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.
master
freesource 23 years ago
parent
commit
74e5270f06
  1. 34
      BootRoot/Yard.pm
  2. 11
      gbootroot

34
BootRoot/Yard.pm

@ -36,8 +36,9 @@ use Exporter;
@EXPORT = qw(start_logging_output info kernel_version_check verbosity @EXPORT = qw(start_logging_output info kernel_version_check verbosity
read_contents_file extra_links library_dependencies hard_links read_contents_file extra_links library_dependencies hard_links
space_check create_filesystem find_file_in_path sys device_table space_check create_filesystem find_file_in_path sys device_table
text_insert error logadj *LOGFILE which_tests create_fstab text_insert error warning logadj *LOGFILE which_tests
make_link_absolute make_link_relative cleanup_link yard_glob); # these last two added create_fstab ars2 make_link_absolute make_link_relative
cleanup_link yard_glob); # these last two added
# as a test # as a test
use strict; use strict;
@ -88,31 +89,44 @@ sub warning {
sub verbosity { $verbosity = $_[0]; } sub verbosity { $verbosity = $_[0]; }
sub text_insert { $text_insert = $_[0]; $red = $_[1]; $blue = $_[2]; } sub text_insert { $text_insert = $_[0]; $red = $_[1]; $blue = $_[2]; }
sub logadj { $logadj = $_[0]; } 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 ## REQUIRES $kernel opt. $kernel_version
sub kernel_version_check { sub kernel_version_check {
my($kernel,$kernel_version) = @_; my($kernel,$kernel_version) = @_;
if (defined($kernel_version)) {
if ( $kernel_version ) {
# Check to see if it agrees # Check to see if it agrees
my($version_guess) = kernel_version($kernel); my($version_guess) = kernel_version($kernel);
if ($version_guess ne $kernel_version) { if ($version_guess ne $kernel_version) {
## Is this really necessary, it can be assumed a person knows ## Is this really necessary, it can be assumed a person knows
## what they are doing. ## what they are doing.
info(0, info(0,
"You declared kernel $kernel to be version $kernel_version\n", "You declared kernel $kernel to be version $kernel_version\n",
"even though a probe says $version_guess.", "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; $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"); info(0, "\nVersion probe of $kernel returns: $ENV{'RELEASE'}\n");
} else { } else {
warning "Can't determine kernel version of $kernel\n"; warning "Can't determine kernel version of ($kernel)\n";
my($release) = `uname -r`; my($release) = `uname -r`;
if ($release) { if ($release) {
chomp($release); chomp($release);
@ -167,6 +181,8 @@ sub read_contents_file {
} }
$contents_file_tmp = $contents_file; $contents_file_tmp = $contents_file;
kernel_version_check($kernel, $kernel_version_choice);
# Open DEVICE_TABLE # Open DEVICE_TABLE
if ( $fs_type eq "genext2fs" ) { if ( $fs_type eq "genext2fs" ) {
@ -1764,8 +1780,10 @@ sub kernel_version {
# check if we have a normal file (-f dereferences symbolic links) # check if we have a normal file (-f dereferences symbolic links)
if (!-f $image) { if (!-f $image) {
$error = error("Kernel image ($image) is not a plain file.\n"); #$error = error("Kernel image ($image) is not a plain file.\n");
return "ERROR"if $error && $error eq "ERROR"; #return "ERROR"if $error && $error eq "ERROR";
$error = warning("Kernel image ($image) is not a plain file.\n");
return "ERROR";
} else { } else {
my($str) = ""; my($str) = "";

11
gbootroot

@ -564,6 +564,9 @@ start_logging_output($verbosefn,$verbosity); # Yard "tmp dir name"
# box and to the LOGFILE $tmp/verbosity. Realative to the slider 1 == 2 and # box and to the LOGFILE $tmp/verbosity. Realative to the slider 1 == 2 and
# 0 == 1. # 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 # error("text") returns ERROR, writes to verbosity box (Error: "text"), and
# produces "gBootRoot: ERROR: "text" in error_window(), and writes to the # produces "gBootRoot: ERROR: "text" in error_window(), and writes to the
# LOGFILE $tmp/verbosity .. used to report an error # LOGFILE $tmp/verbosity .. used to report an error
@ -790,6 +793,7 @@ $entry2->set_text($container[KERNEL]);
if ($container[KERNEL]) { if ($container[KERNEL]) {
$ars->{kernel} = $container[KERNEL]; $ars->{kernel} = $container[KERNEL];
ars($ars); ars($ars);
ars2($ars);
} }
button("Kernel Selection",$entry2,"Kernel Selection",1); button("Kernel Selection",$entry2,"Kernel Selection",1);
@ -2047,6 +2051,11 @@ sub entry_advanced {
$ars->{filename} = $entry_advanced[$numa]; $ars->{filename} = $entry_advanced[$numa];
ars($ars); ars($ars);
} }
if ( $numa == 12 ) {
$ars->{kernel_version_choice} = $entry_advanced[$numa];
ars($ars);
ars2($ars);
}
} ); } );
$entry_advanced->set_usize(100,20); $entry_advanced->set_usize(100,20);
$_[5]->attach($entry_advanced,$_[0],$_[1],$_[2],$_[3], $_[5]->attach($entry_advanced,$_[0],$_[1],$_[2],$_[3],
@ -2273,6 +2282,7 @@ sub file_ok_sel {
if ($order == 1) { if ($order == 1) {
$ars->{kernel} = $container[$order]; $ars->{kernel} = $container[$order];
ars($ars); ars($ars);
ars2($ars);
} }
# auto-detect compression if system has file # auto-detect compression if system has file
@ -2339,6 +2349,7 @@ sub entry {
if ($num == 1) { if ($num == 1) {
$ars->{kernel} = $container[$num]; $ars->{kernel} = $container[$num];
ars($ars); ars($ars);
ars2($ars);
} }
# here's where types in entry3, types other places # here's where types in entry3, types other places
if (defined $ea1 and $num == 3) { if (defined $ea1 and $num == 3) {

Loading…
Cancel
Save