mirror of
https://github.com/fspc/gbootroot.git
synced 2025-02-23 09:03:23 -05:00
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.
This commit is contained in:
parent
2f4e1cdcc6
commit
f960c66fcb
@ -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,
|
||||
$filesystem_size);
|
||||
# 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
|
||||
|
@ -29,6 +29,7 @@ use Exporter;
|
||||
|
||||
use strict;
|
||||
use BootRoot::Yard;
|
||||
use BootRoot::Options;
|
||||
|
||||
my $true = 1;
|
||||
my $false = 0;
|
||||
@ -47,31 +48,40 @@ sub error_window {
|
||||
my (@error) = @_;
|
||||
my $output = join("",@error);
|
||||
|
||||
if (not defined $error_window) {
|
||||
$error_window = new Gtk::Dialog;
|
||||
$error_window->signal_connect("destroy", \&destroy_window,
|
||||
\$error_window);
|
||||
$error_window->signal_connect("delete_event", \&destroy_window,
|
||||
\$error_window);
|
||||
$error_window->set_title("gBootRoot ERROR");
|
||||
$error_window->border_width(15);
|
||||
my $label = new Gtk::Label($output);
|
||||
#$label->set_justify("left") if $_[1];
|
||||
$error_window->vbox->pack_start( $label, $true, $true, 15 );
|
||||
$label->show();
|
||||
my $button = new Gtk::Button("OK");
|
||||
$button->signal_connect("clicked", sub {destroy $error_window});
|
||||
$button->can_default(1);
|
||||
$error_window->action_area->pack_start($button, $false, $false,0);
|
||||
$button->grab_default;
|
||||
$button->show;
|
||||
}
|
||||
if (!visible $error_window) {
|
||||
show $error_window;
|
||||
}
|
||||
else {
|
||||
destroy $error_window;
|
||||
}
|
||||
if (!%option ) {
|
||||
if (not defined $error_window) {
|
||||
$error_window = new Gtk::Dialog;
|
||||
$error_window->signal_connect("destroy", \&destroy_window,
|
||||
\$error_window);
|
||||
$error_window->signal_connect("delete_event", \&destroy_window,
|
||||
\$error_window);
|
||||
$error_window->set_title("gBootRoot ERROR");
|
||||
$error_window->border_width(15);
|
||||
my $label = new Gtk::Label($output);
|
||||
#$label->set_justify("left") if $_[1];
|
||||
$error_window->vbox->pack_start( $label, $true, $true, 15 );
|
||||
$label->show();
|
||||
my $button = new Gtk::Button("OK");
|
||||
$button->signal_connect("clicked", sub {destroy $error_window});
|
||||
$button->can_default(1);
|
||||
$error_window->action_area->pack_start($button, $false, $false,0);
|
||||
$button->grab_default;
|
||||
$button->show;
|
||||
}
|
||||
if (!visible $error_window) {
|
||||
show $error_window;
|
||||
}
|
||||
else {
|
||||
destroy $error_window;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
print "$output\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
} # end sub error_window
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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 ) {
|
||||
print @msgs;
|
||||
if ( $option{stdout} ) {
|
||||
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.
|
||||
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…
x
Reference in New Issue
Block a user