mirror of
https://github.com/fspc/gbootroot.git
synced 2025-02-22 08:33:24 -05:00
* Unification complete.
This commit is contained in:
parent
d884211935
commit
51854a7794
13
Yard.pm
13
Yard.pm
@ -34,7 +34,7 @@ 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
|
space_check create_filesystem find_file_in_path sys
|
||||||
text_insert logadj error);
|
text_insert logadj error *LOGFILE);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
@ -77,6 +77,8 @@ sub warning {
|
|||||||
sub verbosity { $verbosity = $_[0]; }
|
sub verbosity { $verbosity = $_[0]; }
|
||||||
sub text_insert { $text_insert = $_[0]; }
|
sub text_insert { $text_insert = $_[0]; }
|
||||||
sub logadj { $logadj = $_[0]; }
|
sub logadj { $logadj = $_[0]; }
|
||||||
|
# This is because verbosity_box is in start_logging_output
|
||||||
|
#sub verbosity_window { $verbosity_window = $_[0]; }
|
||||||
|
|
||||||
|
|
||||||
## REQUIRES $kernel opt. $kernel_version
|
## REQUIRES $kernel opt. $kernel_version
|
||||||
@ -1060,7 +1062,8 @@ sub start_logging_output {
|
|||||||
}
|
}
|
||||||
# ERRORCHECK
|
# ERRORCHECK
|
||||||
## If logfile doesn't open in /tmp there is some type of fatal problem.
|
## If logfile doesn't open in /tmp there is some type of fatal problem.
|
||||||
open(LOGFILE, ">$logfile") or die "open($logfile): $!\n";
|
open(LOGFILE, ">>$logfile") or die "open($logfile): $!\n";
|
||||||
|
# &::verbosity_box() if !visible $verbosity_window;
|
||||||
info(1, "Logging output to $logfile\n")
|
info(1, "Logging output to $logfile\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1069,8 +1072,10 @@ sub start_logging_output {
|
|||||||
sub sys {
|
sub sys {
|
||||||
open(SYS, "@_ 2>&1 |") or die "open on sys(@_) failed: $!";
|
open(SYS, "@_ 2>&1 |") or die "open on sys(@_) failed: $!";
|
||||||
while (<SYS>) {
|
while (<SYS>) {
|
||||||
print LOGFILE;
|
print LOGFILE unless $_ =~ m,\/.*file\n$,;
|
||||||
print if $verbosity > 0;
|
if ($verbosity > 0) {
|
||||||
|
info(1,$_) unless $_ =~ m,\/.*file\n$,;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
close(SYS) or return $?;
|
close(SYS) or return $?;
|
||||||
0; # like system()
|
0; # like system()
|
||||||
|
53
gBootRoot
53
gBootRoot
@ -251,9 +251,10 @@ if (!-d "$tmp1/gbootroot_mnt$$") {
|
|||||||
my $verbosity = 1; # info & sys use this as Global
|
my $verbosity = 1; # info & sys use this as Global
|
||||||
|
|
||||||
## One hard copy log file is saved for the session, and the user can also
|
## One hard copy log file is saved for the session, and the user can also
|
||||||
## save from the verbosity box.
|
## save from the verbosity box including saving a selection.
|
||||||
#my $verbosefn = "$tmp/verbose"; # All verbosity
|
#my $verbosefn = "$tmp/verbose"; # All verbosity
|
||||||
my $verbosefn = "/tmp/verbose"; # Yard - always logged, but 0&1 = STDOUT
|
my $verbosefn = "/tmp/verbose"; # Yard - always logged, but 0&1 = STDOUT
|
||||||
|
verbosity_box();
|
||||||
start_logging_output($verbosefn,$verbosity); # Yard "tmp dir name"
|
start_logging_output($verbosefn,$verbosity); # Yard "tmp dir name"
|
||||||
# "verbosity level"
|
# "verbosity level"
|
||||||
|
|
||||||
@ -382,6 +383,16 @@ $verbosity_scale->show();
|
|||||||
$adj1->signal_connect( "value_changed", sub {
|
$adj1->signal_connect( "value_changed", sub {
|
||||||
$verbosity = $verbosity_scale->get_adjustment->value - 1;
|
$verbosity = $verbosity_scale->get_adjustment->value - 1;
|
||||||
verbosity($verbosity);
|
verbosity($verbosity);
|
||||||
|
|
||||||
|
if ($verbosity == -1) {
|
||||||
|
destroy $verbosity_window if visible $verbosity_window;
|
||||||
|
}
|
||||||
|
elsif (!$verbosity_window) {
|
||||||
|
close(LOGFILE);
|
||||||
|
verbosity_box();
|
||||||
|
start_logging_output($verbosefn,$verbosity);
|
||||||
|
}
|
||||||
|
|
||||||
} );
|
} );
|
||||||
$box2->pack_start( $verbosity_scale, $false, $false, 0);
|
$box2->pack_start( $verbosity_scale, $false, $false, 0);
|
||||||
|
|
||||||
@ -1044,7 +1055,7 @@ sub yard {
|
|||||||
|
|
||||||
# Error handling in Yard will take some strategy
|
# Error handling in Yard will take some strategy
|
||||||
if (!-d $container[1] && -f $container[1]) {
|
if (!-d $container[1] && -f $container[1]) {
|
||||||
verbosity_box();
|
#verbosity_box();
|
||||||
$error = kernel_version_check($container[1]);
|
$error = kernel_version_check($container[1]);
|
||||||
# Yard: kernel,kernel version
|
# Yard: kernel,kernel version
|
||||||
# Becomes $ENV{'RELEASE'}
|
# Becomes $ENV{'RELEASE'}
|
||||||
@ -1284,9 +1295,10 @@ sub file_ok_sel {
|
|||||||
|
|
||||||
# auto-detect compression if system has file
|
# auto-detect compression if system has file
|
||||||
if ($container[2]) {
|
if ($container[2]) {
|
||||||
my $file = sys("which file");
|
my $file = sys("which file > /dev/null 2>&1");
|
||||||
if ($file == 0) {
|
if ($file == 0) {
|
||||||
open(F,"file $container[2]|"); # no error check here
|
open(F,"file $container[2] > /dev/null 2>&1|"); # no error check
|
||||||
|
# here
|
||||||
while (<F>) {
|
while (<F>) {
|
||||||
if (/gzip/) {
|
if (/gzip/) {
|
||||||
$gz_toggle->set_active( $true );
|
$gz_toggle->set_active( $true );
|
||||||
@ -1359,7 +1371,7 @@ sub entry {
|
|||||||
my $file = sys("which file");
|
my $file = sys("which file");
|
||||||
if ($file == 0) {
|
if ($file == 0) {
|
||||||
if ($container[2]) {
|
if ($container[2]) {
|
||||||
open(F,"file $container[2]|"); # no error check here
|
open(F,"file $container[2] > /dev/null 2>&1|"); # no error check here
|
||||||
while (<F>) {
|
while (<F>) {
|
||||||
if (/gzip/) {
|
if (/gzip/) {
|
||||||
$gz_toggle->set_active( $true );
|
$gz_toggle->set_active( $true );
|
||||||
@ -1803,7 +1815,7 @@ sub stripper {
|
|||||||
# stripper (program,bin|lib);
|
# stripper (program,bin|lib);
|
||||||
if ((!defined $lib_strip_check && !defined $bin_strip_check) or
|
if ((!defined $lib_strip_check && !defined $bin_strip_check) or
|
||||||
($lib_strip_check->active || $bin_strip_check->active)) {
|
($lib_strip_check->active || $bin_strip_check->active)) {
|
||||||
my $not_stripped = `file $_[0]`;
|
my $not_stripped = `file $_[0] >/dev/null 2>&1`;
|
||||||
my $filename = basename($_[0]);
|
my $filename = basename($_[0]);
|
||||||
|
|
||||||
if ($not_stripped =~ m,not stripped,) {
|
if ($not_stripped =~ m,not stripped,) {
|
||||||
@ -1948,9 +1960,11 @@ sub initrd {
|
|||||||
return "ERROR" if $error && $error eq "ERROR";
|
return "ERROR" if $error && $error eq "ERROR";
|
||||||
print T "y\n"; close(T);
|
print T "y\n"; close(T);
|
||||||
pb($I,3);
|
pb($I,3);
|
||||||
info(0, "Mounting initrd in tmp\n");
|
info(0, "Mounting initrd in $tmp/initrd_mnt\n");
|
||||||
|
|
||||||
return if errmk(sys("mkdir $tmp/initrd_mnt")) == 2;
|
if (!-d "$tmp/initrd_mnt") {
|
||||||
|
return if errmk(sys("mkdir $tmp/initrd_mnt")) == 2;
|
||||||
|
}
|
||||||
return if errmk(sys("mount -o loop -t ext2 $tmp/$initrd $tmp/initrd_mnt"))
|
return if errmk(sys("mount -o loop -t ext2 $tmp/$initrd $tmp/initrd_mnt"))
|
||||||
== 2;
|
== 2;
|
||||||
pb($I,4);
|
pb($I,4);
|
||||||
@ -2387,7 +2401,6 @@ sub err_custom_perl {
|
|||||||
# This monster needs different behavior than create_text.
|
# This monster needs different behavior than create_text.
|
||||||
sub verbosity_box {
|
sub verbosity_box {
|
||||||
|
|
||||||
if (not defined $verbosity_window) {
|
|
||||||
$verbosity_window = new Gtk::Window "toplevel";
|
$verbosity_window = new Gtk::Window "toplevel";
|
||||||
$verbosity_window->signal_connect("destroy", \&destroy_window,
|
$verbosity_window->signal_connect("destroy", \&destroy_window,
|
||||||
\$verbosity_window);
|
\$verbosity_window);
|
||||||
@ -2442,19 +2455,15 @@ sub verbosity_box {
|
|||||||
$main_vbox->pack_start( $vbox, $false, $true, 0 );
|
$main_vbox->pack_start( $vbox, $false, $true, 0 );
|
||||||
$vbox->show();
|
$vbox->show();
|
||||||
|
|
||||||
my $button = new Gtk::Button( "Close" );
|
#my $button = new Gtk::Button( "Close" );
|
||||||
$button->signal_connect( 'clicked',
|
#$button->signal_connect( 'clicked',
|
||||||
sub { destroy $verbosity_window; } );
|
# sub { destroy $verbosity_window; } );
|
||||||
$vbox->pack_start( $button, $true, $true, 0 );
|
#$vbox->pack_start( $button, $true, $true, 0 );
|
||||||
$button->can_default( $true );
|
#$button->can_default( $true );
|
||||||
$button->grab_default();
|
#$button->grab_default();
|
||||||
$button->show();
|
#$button->show();
|
||||||
}
|
|
||||||
if (!visible $verbosity_window) {
|
show $verbosity_window;
|
||||||
show $verbosity_window;
|
|
||||||
} else {
|
|
||||||
destroy $verbosity_window;
|
|
||||||
}
|
|
||||||
|
|
||||||
} # end sub verbosity_box
|
} # end sub verbosity_box
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user