Browse Source

This does it! Now non-root users can create complete boot/root sets ..the

only catch is lilo, but working that one out.
master
freesource 23 years ago
parent
commit
338370c319
  1. 66
      gbootroot

66
gbootroot

@ -2915,7 +2915,22 @@ else {
sub device2 {
my $device_size = (split(/\s+/,`df $mnt`))[8];
my $fs_type = (split(/\s/,$main::makefs))[0];
# Time to do a little calculations
my $device_size;
if ( $fs_type ne "genext2fs" ) {
$device_size = (split(/\s+/,`df $mnt`))[8];
}
else {
if ( !$root_device_size ) {
$device_size = $container[SIZE];
}
else {
$device_size = $root_device_size;
}
}
my $root_image_size = (stat($container[ROOT_FS]))[12]/2;
my $remain_root = $device_size - $root_image_size;
@ -2927,13 +2942,19 @@ sub device2 {
}
info(0, "Copy over the compressed filesystem\n");
if ( $fs_type ne "genext2fs" ) {
return if errrm(sys("rmdir $mnt/lost+found")) == 2;
}
my $broot_image = basename($container[ROOT_FS]);
# Status output, use FH, or genext2fs to create disk.
#----------------------------------------------------
my $FS = "filesystem";
my $line_count = `wc -l < $container[ROOT_FS]`; chomp $line_count;
my $half_line_count = $line_count/2;
my $count = 1;
if ( $fs_type ne "genext2fs" ) {
open(CF, ">$mnt/$broot_image") or error_window(
"gBootRoot: ERROR: Could not copy over the root filesystem") and return;
@ -2945,11 +2966,52 @@ sub device2 {
pb($FS,$count,$line_count) if $count < $half_line_count;
$count++;
}
close(CF); close(CR);
close(CF);
close(CR);
}
# genext2fs
else {
my $error;
# If genext2fs is being used clean $tmp/rootdisk if any garbage is
# found.
if ( $fs_type eq "genext2fs" ) {
if (-d "$tmp/rootdisk") {
sys("rm -rf $tmp/rootdisk");
}
if (!-d "$tmp/rootdisk") {
return if errmk(sys("mkdir $tmp/rootdisk")) == 2;
}
}
return if errcp( sys("cp -a $container[ROOT_FS] $tmp/rootdisk") ) == 2;
for ( $count .. $half_line_count ) {
pb($FS,$count,$line_count) if $count < $half_line_count;
$count++;
}
if (
sys("/usr/lib/bootroot/$main::makefs -b $device_size -d $tmp/rootdisk $entry_advanced[3]") !~
/^0$/ ) {
info( 0, "/usr/lib/bootroot/$main::makefs -b $device_size -d $tmp/rootdisk $entry_advanced[3]\n");
$error = error("Cannot $fs_type filesystem.\n");
return "ERROR" if $error && $error eq "ERROR";
}
}
#------------------------------------------------------
if ( $fs_type ne "genext2fs" ) {
return if
err_custom("umount $mnt",
"gBootRoot: ERROR: Root disk did not properly umount") == 2;
}
pb($FS,$count,$line_count);
info(0, "Finished!\n");

Loading…
Cancel
Save