mirror of
https://github.com/fspc/gbootroot.git
synced 2025-04-04 07:43:22 -04:00
orrected bugs in sub norm_root_device
This commit is contained in:
parent
531735f884
commit
fa082738aa
193
gBootRoot
193
gBootRoot
@ -33,31 +33,40 @@ init Gtk;
|
|||||||
|
|
||||||
# If you want gBootRoot to do it's stuff somewhere else, change the
|
# If you want gBootRoot to do it's stuff somewhere else, change the
|
||||||
# value for $tmp1.
|
# value for $tmp1.
|
||||||
my $tmp1 = "/tmp"; # tmp should be default - Cristian
|
my $tmp1 = "/tmp"; # tmp should be default - Cristian
|
||||||
my $lilo_conf = "/etc/lilo.conf";
|
my $lilo_conf = "/etc/lilo.conf";
|
||||||
|
|
||||||
# CHANGES
|
# CHANGES
|
||||||
# 1.0.3 - 08.09.2000
|
# 1.0.3a - 08.23.2000
|
||||||
# * Tmp and mnt are now created on the fly,
|
# * corrected bugs in norm_root_device (returned always 'hda1')
|
||||||
# along with a new error function for mkdir(),
|
# a) now closes LIL
|
||||||
# Gtk clean-up for this, and clean-up by signal handler
|
# b) chomps all lines in one go
|
||||||
# which should please Perlish and helpful Cristian.
|
# c) the 'default' value is just a label, not a dev
|
||||||
|
# d) sane regexp magic
|
||||||
|
# e) "there's one more bug(tm)": does not cope with multiple
|
||||||
|
# root device occurences (which might be present in each
|
||||||
|
# 'image=' block
|
||||||
|
# 1.0.3 - 08.09.2000
|
||||||
|
# * Tmp and mnt are now created on the fly,
|
||||||
|
# along with a new error function for mkdir(),
|
||||||
|
# Gtk clean-up for this, and clean-up by signal handler
|
||||||
|
# which should please Perlish and helpful Cristian.
|
||||||
#
|
#
|
||||||
# 1.0.2 - 08.06.2000
|
# 1.0.2 - 08.06.2000
|
||||||
# * Changed logic slightly in submit() with returns rather
|
# * Changed logic slightly in submit() with returns rather
|
||||||
# than a scalar to resolve a minor bug caused by some
|
# than a scalar to resolve a minor bug caused by some
|
||||||
# changes in the previous version.
|
# changes in the previous version.
|
||||||
#
|
#
|
||||||
# 1.0.1 - 08.05.2000
|
# 1.0.1 - 08.05.2000
|
||||||
# * Zas provided a correction for a Perl 5.6 error complaint.
|
# * Zas provided a correction for a Perl 5.6 error complaint.
|
||||||
# * Zas found some unecessary GDK lines causing some Gtk
|
# * Zas found some unecessary GDK lines causing some Gtk
|
||||||
# warnings; these were commented out.
|
# warnings; these were commented out.
|
||||||
# * Cristian Ionescu-Idbohrn found a bug caused by putting
|
# * Cristian Ionescu-Idbohrn found a bug caused by putting
|
||||||
# the Kernel or RootImage below the mount point. An error
|
# the Kernel or RootImage below the mount point. An error
|
||||||
# check and error dialog were added.
|
# check and error dialog were added.
|
||||||
#
|
#
|
||||||
# 1.0.0 - 08.02.2000
|
# 1.0.0 - 08.02.2000
|
||||||
# * First public release
|
# * First public release
|
||||||
#
|
#
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
@ -92,9 +101,9 @@ my $norm_root_device;
|
|||||||
# My own creation - the roots touch the ground if three lines are added.
|
# My own creation - the roots touch the ground if three lines are added.
|
||||||
my @xpm_data = (
|
my @xpm_data = (
|
||||||
"32 45 3 1",
|
"32 45 3 1",
|
||||||
" c None",
|
" c None",
|
||||||
". c SaddleBrown",
|
". c SaddleBrown",
|
||||||
"X c black",
|
"X c black",
|
||||||
" ... ... ",
|
" ... ... ",
|
||||||
" ... ... ",
|
" ... ... ",
|
||||||
" ... ... ",
|
" ... ... ",
|
||||||
@ -347,27 +356,32 @@ sub signal {
|
|||||||
# Cristian's idea - bug 111579 enh for brlilo
|
# Cristian's idea - bug 111579 enh for brlilo
|
||||||
sub norm_root_device {
|
sub norm_root_device {
|
||||||
|
|
||||||
if (!-d $lilo_conf) {
|
my $root_dev = 'hda1';
|
||||||
if (-e $lilo_conf) {
|
|
||||||
|
if (!-d $lilo_conf) {
|
||||||
|
if (-e $lilo_conf) {
|
||||||
open(LIL, $lilo_conf);
|
open(LIL, $lilo_conf);
|
||||||
my @lilo_lines = <LIL>;
|
my @lilo_lines = <LIL>;
|
||||||
for (@lilo_lines) {
|
close(LIL);
|
||||||
if ( m<^\s*[^#]+\s*default\s*=\s*/dev/([\w\d]+)\s*.*$> ) {
|
chomp(@lilo_lines);
|
||||||
chomp, return $1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (@lilo_lines) {
|
|
||||||
if ( m<^\s*[^#]+\s*root\s*=\s*/dev/([\w\d]+)\s*.*$> ) {
|
|
||||||
chomp, return $1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
for (@lilo_lines) {
|
||||||
|
next if m/^\s*[#]/;
|
||||||
|
|
||||||
|
if (m#\s*root\s*=\s*/dev/(.+)\s*#) {
|
||||||
|
$root_dev = $1;
|
||||||
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
open(VFN, ">> $verbosefn") or die "Oops! Can't open $verbosefn,";
|
||||||
|
print VFN "Root device found: $root_dev\n";
|
||||||
|
close(VFN);
|
||||||
|
|
||||||
return "hda1";
|
return $root_dev;
|
||||||
|
|
||||||
}
|
} # end sub norm_root_device
|
||||||
|
|
||||||
sub create_text {
|
sub create_text {
|
||||||
|
|
||||||
@ -434,9 +448,9 @@ sub create_text {
|
|||||||
$button->show();
|
$button->show();
|
||||||
}
|
}
|
||||||
if (!visible $text_window) {
|
if (!visible $text_window) {
|
||||||
show $text_window;
|
show $text_window;
|
||||||
} else {
|
} else {
|
||||||
destroy $text_window;
|
destroy $text_window;
|
||||||
}
|
}
|
||||||
} # end sub create_text
|
} # end sub create_text
|
||||||
|
|
||||||
@ -457,16 +471,16 @@ sub fileselect {
|
|||||||
|
|
||||||
if (not defined $file_dialog) {
|
if (not defined $file_dialog) {
|
||||||
# Create a new file selection widget
|
# Create a new file selection widget
|
||||||
$file_dialog = new Gtk::FileSelection( "$name" );
|
$file_dialog = new Gtk::FileSelection( "$name" );
|
||||||
$file_dialog->signal_connect( "destroy",
|
$file_dialog->signal_connect( "destroy",
|
||||||
\&destroy_window, \$file_dialog);
|
\&destroy_window, \$file_dialog);
|
||||||
$file_dialog->signal_connect( "delete_event",
|
$file_dialog->signal_connect( "delete_event",
|
||||||
\&destroy_window, \$file_dialog);
|
\&destroy_window, \$file_dialog);
|
||||||
|
|
||||||
# Connect the ok_button to file_ok_sel function
|
# Connect the ok_button to file_ok_sel function
|
||||||
$file_dialog->ok_button->signal_connect( "clicked",
|
$file_dialog->ok_button->signal_connect( "clicked",
|
||||||
\&file_ok_sel,
|
\&file_ok_sel,
|
||||||
$file_dialog,$ent,$order);
|
$file_dialog,$ent,$order);
|
||||||
|
|
||||||
# Connect the cancel_button to destroy the widget
|
# Connect the cancel_button to destroy the widget
|
||||||
$file_dialog->cancel_button->signal_connect( "clicked",
|
$file_dialog->cancel_button->signal_connect( "clicked",
|
||||||
@ -496,8 +510,8 @@ 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 = system "which file > /dev/null 2>&1";
|
my $file = system "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]|"); # no error check here
|
||||||
while (<F>) {
|
while (<F>) {
|
||||||
if (/gzip/) {
|
if (/gzip/) {
|
||||||
$gz_toggle->set_active( $true );
|
$gz_toggle->set_active( $true );
|
||||||
@ -555,7 +569,7 @@ sub entry {
|
|||||||
if (defined $num) {
|
if (defined $num) {
|
||||||
my $todo;
|
my $todo;
|
||||||
if ($num == 1) {
|
if ($num == 1) {
|
||||||
$todo = "the Kernel";
|
$todo = "the Kernel";
|
||||||
}
|
}
|
||||||
elsif ($num == 2) {
|
elsif ($num == 2) {
|
||||||
$todo = "the Compressed Filesystem";
|
$todo = "the Compressed Filesystem";
|
||||||
@ -656,7 +670,7 @@ elsif (defined $container[0] && defined $container[1]
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (defined $container[4]) {
|
if (defined $container[4]) {
|
||||||
$size = $container[4];
|
$size = $container[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
# pretty unlikely
|
# pretty unlikely
|
||||||
@ -678,19 +692,19 @@ elsif (defined $container[0] && defined $container[1] &&
|
|||||||
splice(@temp_container,1,1);
|
splice(@temp_container,1,1);
|
||||||
my %diff;
|
my %diff;
|
||||||
grep($diff{$_}++,@temp_container);
|
grep($diff{$_}++,@temp_container);
|
||||||
my @diff = grep(!$diff{$_},@original_container);
|
my @diff = grep(!$diff{$_},@original_container);
|
||||||
if ($#diff >= 0) {
|
if ($#diff >= 0) {
|
||||||
# unlink initrd_image.gz, do initrd()
|
# unlink initrd_image.gz, do initrd()
|
||||||
$ok = 1;
|
$ok = 1;
|
||||||
$initrd = "initrd_image";
|
$initrd = "initrd_image";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$ok = 2; # this is actually first (1 = diff, 0 = same)
|
$ok = 2; # this is actually first (1 = diff, 0 = same)
|
||||||
$initrd = "initrd_image";
|
$initrd = "initrd_image";
|
||||||
}
|
}
|
||||||
# reset
|
# reset
|
||||||
@original_container = ($container[0],$root_image,$device,$size,$compress);
|
@original_container = ($container[0],$root_image,$device,$size,$compress);
|
||||||
@ -910,7 +924,7 @@ sub lilo_put_it_together {
|
|||||||
pb($B,7);
|
pb($B,7);
|
||||||
chdir("$mnt"); #"boot_root: ERROR: Could not change directories\n";
|
chdir("$mnt"); #"boot_root: ERROR: Could not change directories\n";
|
||||||
if (err_custom("lilo -v -C brlilo.conf -r $mnt",
|
if (err_custom("lilo -v -C brlilo.conf -r $mnt",
|
||||||
"gBootRoot: ERROR: lilo failed") == 2) {
|
"gBootRoot: ERROR: lilo failed") == 2) {
|
||||||
chdir($pwd); return;
|
chdir($pwd); return;
|
||||||
}
|
}
|
||||||
$remain_boot = $remain_boot - (stat("$mnt/boot/map"))[12]/2;
|
$remain_boot = $remain_boot - (stat("$mnt/boot/map"))[12]/2;
|
||||||
@ -967,7 +981,7 @@ sub device2 {
|
|||||||
open(CR, "$root_image") or error_window(
|
open(CR, "$root_image") or error_window(
|
||||||
"gBootRoot: ERROR: Could not copy over the root filesystem") and return;
|
"gBootRoot: ERROR: Could not copy over the root filesystem") and return;
|
||||||
while (<CR>) {
|
while (<CR>) {
|
||||||
print CF $_;
|
print CF $_;
|
||||||
pb($FS,$count,$line_count) if $count < $half_line_count;
|
pb($FS,$count,$line_count) if $count < $half_line_count;
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
@ -1043,10 +1057,10 @@ sub pb {
|
|||||||
|
|
||||||
# Will have to count by hand
|
# Will have to count by hand
|
||||||
if ($_[0] eq "initrd") {
|
if ($_[0] eq "initrd") {
|
||||||
$pbar->configure( 10, 0, 10 );
|
$pbar->configure( 10, 0, 10 );
|
||||||
}
|
}
|
||||||
elsif ($_[0] eq "boot") {
|
elsif ($_[0] eq "boot") {
|
||||||
$pbar->configure( 10, 0, 10 );
|
$pbar->configure( 10, 0, 10 );
|
||||||
}
|
}
|
||||||
elsif ($_[0] eq "filesystem") {
|
elsif ($_[0] eq "filesystem") {
|
||||||
$pbar->configure($_[2], 0, $_[2]);
|
$pbar->configure($_[2], 0, $_[2]);
|
||||||
@ -1195,14 +1209,14 @@ sub mtab{
|
|||||||
my $dialog = "BOOTDISK:\n"
|
my $dialog = "BOOTDISK:\n"
|
||||||
."Press OK when the drive and its storage medium is ready.\n"
|
."Press OK when the drive and its storage medium is ready.\n"
|
||||||
."The Boot Disk will now be made. All data already on\n"
|
."The Boot Disk will now be made. All data already on\n"
|
||||||
."the storage medium will be erased.";
|
."the storage medium will be erased.";
|
||||||
mtab_window($dialog,1,$_[0],1);
|
mtab_window($dialog,1,$_[0],1);
|
||||||
}
|
}
|
||||||
elsif ($_[0] == 1) {
|
elsif ($_[0] == 1) {
|
||||||
my $dialog = "ROOTDISK:\n"
|
my $dialog = "ROOTDISK:\n"
|
||||||
."Press OK when the drive and its storage medium is ready.\n"
|
."Press OK when the drive and its storage medium is ready.\n"
|
||||||
."The Root Disk will now be made. All data already on\n"
|
."The Root Disk will now be made. All data already on\n"
|
||||||
."the storage medium will be erased.";
|
."the storage medium will be erased.";
|
||||||
mtab_window($dialog,1,$_[0],1);
|
mtab_window($dialog,1,$_[0],1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1423,60 +1437,3 @@ Little things you may want to know:
|
|||||||
HELP
|
HELP
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user