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. 67
      BootRoot/BootRoot.pm
  2. 60
      BootRoot/Error.pm
  3. 5
      BootRoot/Options.pm
  4. 21
      BootRoot/Yard.pm

67
BootRoot/BootRoot.pm

@ -784,7 +784,8 @@ else {
# check() read_contents_file( "$template_dir$template", $tmp, # check() read_contents_file( "$template_dir$template", $tmp,
# $filesystem_size, \%uml_expect ); # $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) # create() - term depends on whether root or normal user (really copy)
# $lib_bool = "" if $lib_bool eq 0; # $lib_bool = "" if $lib_bool eq 0;
@ -805,17 +806,11 @@ else {
start_logging_output($verbosefn,$verbosity); # Yard "tmp dir name" start_logging_output($verbosefn,$verbosity); # Yard "tmp dir name"
# $kernel = $ars->{kernel};
# $kernel_version_choice = $ars->{kernel_version_choice};
$ars->{kernel} = $option{kernel}; $ars->{kernel} = $option{kernel};
ars2($ars); ars2($ars);
$ars->{kernel_version_choice} = $option{"kernel-version"}; $ars->{kernel_version_choice} = $option{"kernel-version"};
ars2($ars); ars2($ars);
#my $it = kernel_version_check($option{kernel},$option{"kernel-version"});
my $template = $option{template}; my $template = $option{template};
$option{"filesystem-size"} $option{"filesystem-size"}
@ -832,12 +827,64 @@ if ( $option{"uml-exclusively"} ) {
$ars->{uml_exclusively} = $uml_exclusively; $ars->{uml_exclusively} = $uml_exclusively;
ars2($ars); #not used in function below ars2($ars); #not used in function below
read_contents_file( "$template_dir$template", $tmp, # links_deps()
$filesystem_size); # 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 } # end if $::commandline

60
BootRoot/Error.pm

@ -29,6 +29,7 @@ use Exporter;
use strict; use strict;
use BootRoot::Yard; use BootRoot::Yard;
use BootRoot::Options;
my $true = 1; my $true = 1;
my $false = 0; my $false = 0;
@ -47,31 +48,40 @@ sub error_window {
my (@error) = @_; my (@error) = @_;
my $output = join("",@error); my $output = join("",@error);
if (not defined $error_window) { if (!%option ) {
$error_window = new Gtk::Dialog; if (not defined $error_window) {
$error_window->signal_connect("destroy", \&destroy_window, $error_window = new Gtk::Dialog;
\$error_window); $error_window->signal_connect("destroy", \&destroy_window,
$error_window->signal_connect("delete_event", \&destroy_window, \$error_window);
\$error_window); $error_window->signal_connect("delete_event", \&destroy_window,
$error_window->set_title("gBootRoot ERROR"); \$error_window);
$error_window->border_width(15); $error_window->set_title("gBootRoot ERROR");
my $label = new Gtk::Label($output); $error_window->border_width(15);
#$label->set_justify("left") if $_[1]; my $label = new Gtk::Label($output);
$error_window->vbox->pack_start( $label, $true, $true, 15 ); #$label->set_justify("left") if $_[1];
$label->show(); $error_window->vbox->pack_start( $label, $true, $true, 15 );
my $button = new Gtk::Button("OK"); $label->show();
$button->signal_connect("clicked", sub {destroy $error_window}); my $button = new Gtk::Button("OK");
$button->can_default(1); $button->signal_connect("clicked", sub {destroy $error_window});
$error_window->action_area->pack_start($button, $false, $false,0); $button->can_default(1);
$button->grab_default; $error_window->action_area->pack_start($button, $false, $false,0);
$button->show; $button->grab_default;
} $button->show;
if (!visible $error_window) { }
show $error_window; if (!visible $error_window) {
} show $error_window;
else { }
destroy $error_window; else {
} destroy $error_window;
}
}
else {
print "$output\n";
}
} # end sub error_window } # end sub error_window

5
BootRoot/Options.pm

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

21
BootRoot/Yard.pm

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

Loading…
Cancel
Save