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
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) = "";

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
# 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
# LOGFILE $tmp/verbosity .. used to report an error
@ -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);
@ -2047,6 +2051,11 @@ sub entry_advanced {
$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],
@ -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) {

Loading…
Cancel
Save