Browse Source

This gets just about every option working, except for uml-kernel and

preserve-ownership.  Adds color --stdout.  Basically, the bare min is
--template and --stdout for display on console.
master
freesource 22 years ago
parent
commit
f960c66fcb
  1. 65
      BootRoot/BootRoot.pm
  2. 10
      BootRoot/Error.pm
  3. 5
      BootRoot/Options.pm
  4. 17
      BootRoot/Yard.pm

65
BootRoot/BootRoot.pm

@ -784,7 +784,8 @@ else {
# check() read_contents_file( "$template_dir$template", $tmp,
# $filesystem_size, \%uml_expect );
#
# links_deps() extra_links($changed_text, \%nss_pam);
# links_deps() extra_links($changed_text, \%nss_pam); hard_links
# library_dependencies
#
# create() - term depends on whether root or normal user (really copy)
# $lib_bool = "" if $lib_bool eq 0;
@ -805,17 +806,11 @@ else {
start_logging_output($verbosefn,$verbosity); # Yard "tmp dir name"
# $kernel = $ars->{kernel};
# $kernel_version_choice = $ars->{kernel_version_choice};
$ars->{kernel} = $option{kernel};
ars2($ars);
$ars->{kernel_version_choice} = $option{"kernel-version"};
ars2($ars);
#my $it = kernel_version_check($option{kernel},$option{"kernel-version"});
my $template = $option{template};
$option{"filesystem-size"}
@ -832,12 +827,64 @@ if ( $option{"uml-exclusively"} ) {
$ars->{uml_exclusively} = $uml_exclusively;
ars2($ars); #not used in function below
read_contents_file( "$template_dir$template", $tmp,
# links_deps()
# Good defaults
my %nss_pam = (
60 => {
conf_nss => 1,
},
61 => {
conf_pam => 1,
},
);
# create()
my $lib_bool = 1;
my $bin_bool = 1;
my $mod_bool = 1;
my $strip_bool = 1;
my $filename;
$option{"root-filename"}
? ($filename = $option{"root-filename"})
: ($filename = "root_fs");
# The filesystem-type
$::makefs = $option{"filesystem-command"} if $option{"filesystem-command"};
# The Action - yard is the default method
my $method;
$option{method}
? ($method = $option{method})
: ($method = "yard");
if ( $method eq "yard" ) {
my $error = read_contents_file( "$template_dir$template", $tmp,
$filesystem_size);
return if $error && $error eq "ERROR";
$error = extra_links("$template_dir$template", \%nss_pam);
return if $error && $error eq "ERROR";
$error = hard_links();
return if $error && $error eq "ERROR";
$error = library_dependencies("$template_dir$template");
return if $error && $error eq "ERROR";
$error = create_filesystem($filename,$filesystem_size,$tmp,$lib_bool,
$bin_bool,$mod_bool,$strip_bool);
return if $error && $error eq "ERROR";
# create_uml()
create_expect_uml($filesystem_size, $tmp, $filename);
}
#print kernel_version_check(), "Hi there!\n";
######################################################
} # end if $::commandline

10
BootRoot/Error.pm

@ -29,6 +29,7 @@ use Exporter;
use strict;
use BootRoot::Yard;
use BootRoot::Options;
my $true = 1;
my $false = 0;
@ -47,6 +48,7 @@ sub error_window {
my (@error) = @_;
my $output = join("",@error);
if (!%option ) {
if (not defined $error_window) {
$error_window = new Gtk::Dialog;
$error_window->signal_connect("destroy", \&destroy_window,
@ -73,6 +75,14 @@ sub error_window {
destroy $error_window;
}
}
else {
print "$output\n";
}
} # end sub error_window
sub errmk {

5
BootRoot/Options.pm

@ -39,9 +39,10 @@ sub option {
"method=s",
"template=s", # The only required argument
"filesystem-size=s",
"filesytem-type=s",
"uml-exclusively=s",
"filesystem-command=s",
"uml-exclusively=s", # on/off
"preserve-ownership=s",
"kernel=s",
"kernel-version=s",
"stdout"

17
BootRoot/Yard.pm

@ -1,4 +1,4 @@
#############################################################################
############################################################################
##
## Yard.pm combining
## MAKE_ROOT_FS, CHECK_ROOT_FS, and YARD_UTILS.PL by Tom Fawcett
@ -47,6 +47,7 @@ use File::Path;
use FileHandle;
use Cwd; # I am not even sure if this is being used here now
use English; # I think this can be ditched for portability
use Term::ANSIColor; # for commandline output
use File::Find; # used by check_root_fs
use BootRoot::BootRoot;
use BootRoot::Error;
@ -537,6 +538,7 @@ sub extra_links {
$find_nss = $nss_pam->{60}{conf_nss};
$find_pam = $nss_pam->{61}{conf_pam};
# Determine how the PASS is configured by the user.
if ( $find_nss != 1 && $find_pam != 1 ) {
info(0, "PASS 2: Picking up extra files from links...\n");
@ -1828,11 +1830,18 @@ sub info {
}
if ( $option{stdout} ) {
if ( %option ) {
print @msgs;
if ($level == 0) {
print color("blue"), @msgs, color("reset");
}
elsif ($level == 1) {
print color("red"), @msgs, color("reset");
}
}
}
} # end sub info
## This will produce red.
sub error {
@ -2198,7 +2207,7 @@ sub kernel_version {
my $error;
# check if we have a normal file (-f dereferences symbolic links)
if (!-f $image) {
if (!$image || !-f $image) {
#$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");

Loading…
Cancel
Save