Browse Source

* Cleaned up some verbosity spots

* Unified the logfile
* Getting closer
master
freesource 24 years ago
parent
commit
faaca21637
  1. 146
      gBootRoot

146
gBootRoot

@ -121,6 +121,7 @@ my $label_advanced;
my $separator; my $separator;
my $order; my $order;
my $text_window; my $text_window;
my $verbosity_window;
my @container; my @container;
my @original_container; my @original_container;
my $file_dialog; my $file_dialog;
@ -243,17 +244,17 @@ if (!-d "$tmp1/gbootroot_mnt$$") {
"gBootRoot: ERROR: Could not make mount directory") != 2; "gBootRoot: ERROR: Could not make mount directory") != 2;
} }
# Verbosity should probably be controlled separately for each # Verbosity is universal for all methods, and controlled by a scale slider.
# method.
# Yard # Yard
# 0 --> only the important messages. # 0 --> only the important messages.
# 1 --> all messages. # 1 --> all messages.
my $verbosity = 1; # info & sys use this as Global my $verbosity = 1; # info & sys use this as Global
## Both of these files are used, but that will be changed ## One hard copy log file is saved for the session, and the user can also
my $verbosefn = "$tmp/verbose"; # gBootRoot ## save from the verbosity box.
my $yard_temp = "/tmp/yard_verbose"; # Yard - always logged, but 0&1 = STDOUT #my $verbosefn = "$tmp/verbose"; # All verbosity
start_logging_output($yard_temp,$verbosity); # Yard "tmp dir name" my $verbosefn = "/tmp/verbose"; # Yard - always logged, but 0&1 = STDOUT
start_logging_output($verbosefn,$verbosity); # Yard "tmp dir name"
# "verbosity level" # "verbosity level"
# Right now >= 0.7000 is o.k. # Right now >= 0.7000 is o.k.
@ -264,9 +265,8 @@ if (Gtk::check_version("1","0","7") =~ /too old/) {
" to use this program, but you may encounter problems." . " to use this program, but you may encounter problems." .
" See the FAQ\nfor places to get a newer gtk-perl version." . " See the FAQ\nfor places to get a newer gtk-perl version." .
" \n\nThe most common error reported:\n\"Can't locate" . " \n\nThe most common error reported:\n\"Can't locate" .
" object method\"" " object method\"");
#,"center");
,"center");
print "Using a version of gtk-perl < 0.7000\n"; print "Using a version of gtk-perl < 0.7000\n";
} }
@ -378,6 +378,7 @@ $verbosity_scale->set_value_pos("right");
$verbosity_scale->set_digits(0); $verbosity_scale->set_digits(0);
$tooltips->set_tip( $verbosity_scale, "Adjust the Verbosity Level.", "" ); $tooltips->set_tip( $verbosity_scale, "Adjust the Verbosity Level.", "" );
$verbosity_scale->show(); $verbosity_scale->show();
# Verbosity Box can be turned on/off here
$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);
@ -1039,12 +1040,15 @@ sub yard {
#open(YARD,"$template_dir$template"); #open(YARD,"$template_dir$template");
#my @stuff = <YARD>; #my @stuff = <YARD>;
#print @stuff; #print @stuff;
my $error;
# 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]) {
create_text("yard"); verbosity_box();
kernel_version_check($container[1]); # Yard: kernel,kernel version $error = kernel_version_check($container[1]);
# Yard: kernel,kernel version
# Becomes $ENV{'RELEASE'} # Becomes $ENV{'RELEASE'}
return if $error && $error eq "ERROR";
} }
else { else {
error_window("Kernel Selection required"); error_window("Kernel Selection required");
@ -1052,18 +1056,23 @@ sub yard {
} }
read_contents_file("$template_dir$template"); $error = read_contents_file("$template_dir$template");
return if $error && $error eq "ERROR";
##extra_links("$template_dir$template"); ##$error = extra_links("$template_dir$template");
return if $error && $error eq "ERROR";
##library_dependencies("$template_dir$template"); ##$error = library_dependencies("$template_dir$template");
return if $error && $error eq "ERROR";
##hard_links(); ##$error = hard_links();
return if $error && $error eq "ERROR";
##space_check($filesystem_size, $lib_strip_check_root->get_active(), ##$error = space_check($filesystem_size, $lib_strip_check_root->get_active(),
## $bin_strip_check_root->get_active(), ## $bin_strip_check_root->get_active(),
## $module_strip_check_root->get_active(), ## $module_strip_check_root->get_active(),
## $obj_count_root, $tmp); ## $obj_count_root, $tmp);
return if $error && $error eq "ERROR";
} # end sub yard } # end sub yard
@ -1142,10 +1151,11 @@ sub label_advanced {
} }
# I created two of these, one for help (eventually there may be a different
# approach), and one for verbosity. I am sure there is a better OO way to
# do it, though.
sub create_text { sub create_text {
my ($text_type) = @_;
if (not defined $text_window) { if (not defined $text_window) {
$text_window = new Gtk::Window "toplevel"; $text_window = new Gtk::Window "toplevel";
$text_window->signal_connect("destroy", \&destroy_window, $text_window->signal_connect("destroy", \&destroy_window,
@ -1180,8 +1190,8 @@ sub create_text {
[ 'expand', 'shrink', 'fill' ], [ 'expand', 'shrink', 'fill' ],
[ 'expand', 'shrink', 'fill' ], [ 'expand', 'shrink', 'fill' ],
0, 0 ); 0, 0 );
$text->grab_focus();
$text->show(); $text->show();
text_insert($text); # yard thing
# Add a vertical scrollbar to the GtkText widget # Add a vertical scrollbar to the GtkText widget
my $vscrollbar = new Gtk::VScrollbar( $text->vadj ); my $vscrollbar = new Gtk::VScrollbar( $text->vadj );
@ -1192,12 +1202,7 @@ sub create_text {
$vscrollbar->show(); $vscrollbar->show();
$text->freeze(); $text->freeze();
if ($text_type eq "help") {
$text->insert( undef, undef, undef, help() ); $text->insert( undef, undef, undef, help() );
}
#elsif ($text_type eq "yard") {
# $text->insert( undef, undef, undef, "Stuff coming soon" );
#}
$text->thaw(); $text->thaw();
my $separator = new Gtk::HSeparator(); my $separator = new Gtk::HSeparator();
@ -1221,6 +1226,7 @@ sub create_text {
} else { } else {
destroy $text_window; destroy $text_window;
} }
} # end sub create_text } # end sub create_text
sub make_menu_item { sub make_menu_item {
@ -1414,7 +1420,9 @@ sub submit {
my($kernel,$root_image); my($kernel,$root_image);
# comment this out for testing # comment this out for testing
unlink("$verbosefn"); # Since only one filehandle is now used, this won't work
# anymore.
#unlink("$verbosefn");
open (MTAB, "/etc/mtab") or die "no mtab!\n"; open (MTAB, "/etc/mtab") or die "no mtab!\n";
while (<MTAB>) { while (<MTAB>) {
if (m,$mnt,) { if (m,$mnt,) {
@ -1934,7 +1942,11 @@ sub initrd {
sys("dd if=/dev/zero of=$tmp/$initrd bs=1024 count=$size_needed"); sys("dd if=/dev/zero of=$tmp/$initrd bs=1024 count=$size_needed");
pb($I,2); pb($I,2);
# no need to enter y every time .. could use -F # no need to enter y every time .. could use -F
open(T,"|mke2fs -m0 -i8192 $tmp/$initrd >> $verbosefn 2>&1") or die "Problem here: $!\n"; print T "y\n"; close(T); my $error;
open(T,"|mke2fs -m0 -i8192 $tmp/$initrd >/dev/null 2>&1") or
($error = error("Can not make ext2 filesystem on initrd.\n"));
return "ERROR" if $error && $error eq "ERROR";
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\n");
@ -2256,7 +2268,8 @@ mtab_window($dialog,$error,$count) if $error == 0;
# All err? report errors if $? > 0. # All err? report errors if $? > 0.
sub error_window { sub error_window {
my ($error) = @_; my (@error) = @_;
my $output = join("",@error);
if (not defined $error_window) { if (not defined $error_window) {
$error_window = new Gtk::Dialog; $error_window = new Gtk::Dialog;
@ -2266,8 +2279,8 @@ sub error_window {
\$error_window); \$error_window);
$error_window->set_title("gBootRoot ERROR"); $error_window->set_title("gBootRoot ERROR");
$error_window->border_width(15); $error_window->border_width(15);
my $label = new Gtk::Label($error); my $label = new Gtk::Label($output);
$label->set_justify("left") if $_[1]; #$label->set_justify("left") if $_[1];
$error_window->vbox->pack_start( $label, $true, $true, 15 ); $error_window->vbox->pack_start( $label, $true, $true, 15 );
$label->show(); $label->show();
my $button = new Gtk::Button("OK"); my $button = new Gtk::Button("OK");
@ -2371,6 +2384,81 @@ sub err_custom_perl {
} }
} }
# This monster needs different behavior than create_text.
sub verbosity_box {
if (not defined $verbosity_window) {
$verbosity_window = new Gtk::Window "toplevel";
$verbosity_window->signal_connect("destroy", \&destroy_window,
\$verbosity_window);
$verbosity_window->signal_connect("delete_event", \&destroy_window,
\$verbosity_window);
$verbosity_window->set_title("Help");
$verbosity_window->set_usize( 500, 600 );
$verbosity_window->set_policy( $true, $true, $false );
$verbosity_window->set_title( "Verbosity Box" );
$verbosity_window->border_width(0);
my $main_vbox = new Gtk::VBox( $false, 0 );
$verbosity_window->add( $main_vbox );
$main_vbox->show();
my $vbox = new Gtk::VBox( $false, 10 );
$vbox->border_width( 10 );
$main_vbox->pack_start( $vbox, $true, $true, 0 );
$vbox->show();
my $table = new Gtk::Table( 2, 2, $false );
$table->set_row_spacing( 0, 2 );
$table->set_col_spacing( 0, 2 );
$vbox->pack_start( $table, $true, $true, 0 );
$table->show( );
# Create the GtkText widget
my $text = new Gtk::Text( undef, undef );
$text->set_editable($false);
$table->attach( $text, 0, 1, 0, 1,
[ 'expand', 'shrink', 'fill' ],
[ 'expand', 'shrink', 'fill' ],
0, 0 );
$text->grab_focus();
$text->show();
text_insert($text); # yard thing
# Add a vertical scrollbar to the GtkText widget
my $vscrollbar = new Gtk::VScrollbar( $text->vadj );
$table->attach( $vscrollbar, 1, 2, 0, 1, 'fill',
[ 'expand', 'shrink', 'fill' ], 0, 0 );
my $logadj = $vscrollbar->get_adjustment();
logadj($logadj);
$vscrollbar->show();
my $separator = new Gtk::HSeparator();
$main_vbox->pack_start( $separator, $false, $true, 0 );
$separator->show();
$vbox = new Gtk::VBox( $false, 10 );
$vbox->border_width( 10 );
$main_vbox->pack_start( $vbox, $false, $true, 0 );
$vbox->show();
my $button = new Gtk::Button( "Close" );
$button->signal_connect( 'clicked',
sub { destroy $verbosity_window; } );
$vbox->pack_start( $button, $true, $true, 0 );
$button->can_default( $true );
$button->grab_default();
$button->show();
}
if (!visible $verbosity_window) {
show $verbosity_window;
} else {
destroy $verbosity_window;
}
} # end sub verbosity_box
################### ###################
# End Error Section # End Error Section
################### ###################

Loading…
Cancel
Save