mirror of
https://github.com/fspc/gbootroot.git
synced 2025-02-23 09:03:23 -05:00
Some even more elaborate changes so that the gui can be ran from the immediate
directory for testing using only the --home option. Also, made sure genext2fs can be found.
This commit is contained in:
parent
705d8a7856
commit
8827b1b0d4
@ -49,6 +49,7 @@ my $tmp1 = "/tmp"; # tmp should be default - Cristian
|
|||||||
my $lilo_conf = "/etc/lilo.conf";
|
my $lilo_conf = "/etc/lilo.conf";
|
||||||
my $pwd = `pwd`; chomp $pwd;
|
my $pwd = `pwd`; chomp $pwd;
|
||||||
my $home;
|
my $home;
|
||||||
|
$option{home} = $option{gui_mode} if $option{gui_mode};
|
||||||
$option{home} ? ($home = $pwd) : ($home = "$ENV{HOME}/.gbootroot");
|
$option{home} ? ($home = $pwd) : ($home = "$ENV{HOME}/.gbootroot");
|
||||||
my $uml_xterm = "xterm -e";
|
my $uml_xterm = "xterm -e";
|
||||||
|
|
||||||
@ -63,13 +64,16 @@ my $uml_xterm = "xterm -e";
|
|||||||
# and to make sure modules are correct in Initrd.gz
|
# and to make sure modules are correct in Initrd.gz
|
||||||
# apply special patches
|
# apply special patches
|
||||||
|
|
||||||
my $version = "1.3.6";
|
my $version = "1.4.0";
|
||||||
my $date = "03.10.2002";
|
my $date = "11.19.2002";
|
||||||
my $gtk_perl_version = "0.7002";
|
my $gtk_perl_version = "0.7002";
|
||||||
my $home_rootfs = "$home/root_filesystem/";
|
my $home_rootfs = "$home/root_filesystem/";
|
||||||
my $home_uml_kernel = "$home/uml_kernel/";
|
my $home_uml_kernel = "$home/uml_kernel/";
|
||||||
my $modules_directory = "/lib/modules";
|
my $modules_directory = "/lib/modules";
|
||||||
my $Initrd = "/usr/lib/bootroot/root_filesystem/Initrd.gz";
|
my $Initrd;
|
||||||
|
$option{gui_mode} ?
|
||||||
|
($Initrd = $home_rootfs . "Initrd.gz")
|
||||||
|
: ($Initrd = "/usr/lib/bootroot/root_filesystem/Initrd.gz");
|
||||||
|
|
||||||
# This is for experimental stuff .. basically so I can test
|
# This is for experimental stuff .. basically so I can test
|
||||||
# the boot fs as a normal user, since it's hard to create a boot disk
|
# the boot fs as a normal user, since it's hard to create a boot disk
|
||||||
@ -250,11 +254,10 @@ my $ars = {}; # anonymous hash
|
|||||||
|
|
||||||
sub start {
|
sub start {
|
||||||
|
|
||||||
if ( $> != 0 && -e "/usr/lib/bootroot/genext2fs" ) {
|
if ( $> != 0 && -e "/usr/lib/bootroot/genext2fs" ) {
|
||||||
$main::makefs = "genext2fs -z -r0"; # -i8192 not a good idea
|
$main::makefs = "genext2fs -z -r0"; # -i8192 not a good idea
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$SIG{INT} = \&signal;
|
$SIG{INT} = \&signal;
|
||||||
$SIG{ABRT} = \&signal;
|
$SIG{ABRT} = \&signal;
|
||||||
$SIG{TERM} = \&signal;
|
$SIG{TERM} = \&signal;
|
||||||
@ -350,7 +353,7 @@ my $verbosity = 1; # info & sys use this as Global
|
|||||||
$verbosefn = "$tmp/verbose"; # All verbosity
|
$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
|
||||||
|
|
||||||
if ( !%option ) {
|
if ( !%option || $option{gui_mode} ) {
|
||||||
if ( !$::commandline ) {
|
if ( !$::commandline ) {
|
||||||
|
|
||||||
# Need this before everything.
|
# Need this before everything.
|
||||||
@ -367,80 +370,87 @@ if ( !%option ) {
|
|||||||
# /tmp
|
# /tmp
|
||||||
home_builder($tmp1);
|
home_builder($tmp1);
|
||||||
|
|
||||||
|
# gbootroot will need to be run at least once without options to make these
|
||||||
|
# directories
|
||||||
|
if ( !%option ) {
|
||||||
|
|
||||||
|
|
||||||
# $HOME/.gbootroot/root_filesystem
|
# $HOME/.gbootroot/root_filesystem
|
||||||
home_builder($home_rootfs);
|
home_builder($home_rootfs);
|
||||||
|
|
||||||
# $HOME/.gbootroot/uml_kernel
|
# $HOME/.gbootroot/uml_kernel
|
||||||
home_builder($home_uml_kernel);
|
home_builder($home_uml_kernel);
|
||||||
symlink_builder("/usr/bin/linux","$home_uml_kernel/linux");
|
symlink_builder("/usr/bin/linux","$home_uml_kernel/linux");
|
||||||
if (!-e "$home_uml_kernel/.options") {
|
if (!-e "$home_uml_kernel/.options") {
|
||||||
open(OPTIONS,">$home_uml_kernel/.options")
|
open(OPTIONS,">$home_uml_kernel/.options")
|
||||||
or die "Couldn't write $home_uml_kernel/.options at $?\n";
|
or die "Couldn't write $home_uml_kernel/.options at $?\n";
|
||||||
# I removed mem=16M to make sure the optimal mem size was being chosen for the MTD Emulator
|
# I removed mem=16M to make sure the optimal mem size was being
|
||||||
# in case the user didn't know any better.
|
# chosen for the MTD Emulator
|
||||||
print OPTIONS "umid=bootroot root=/dev/ubd0\n";
|
# in case the user didn't know any better.
|
||||||
close(OPTIONS);
|
print OPTIONS "umid=bootroot root=/dev/ubd0\n";
|
||||||
|
close(OPTIONS);
|
||||||
|
}
|
||||||
|
|
||||||
|
# $HOME/.gbootroot/yard/templates
|
||||||
|
home_builder($template_dir);
|
||||||
|
if ( -d $global_yard_templates ) {
|
||||||
|
opendir(DIR,$global_yard_templates) if -d $template_dir;
|
||||||
|
# I decided this may be too restrictive, besides, everything
|
||||||
|
# is kept in its own directory.
|
||||||
|
#my @templates = grep { m,\.yard$, } readdir(DIR);
|
||||||
|
my @templates = grep { m,^\w+, } readdir(DIR);
|
||||||
|
closedir(DIR);
|
||||||
|
foreach ( @templates ) {
|
||||||
|
if (!-e "$template_dir/$_" && !-l "$template_dir/$_") {
|
||||||
|
symlink_builder("$global_yard_templates/$_","$template_dir/$_");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Arch indep replacements repository
|
||||||
|
# $HOME/.gbootroot/yard/Replacements
|
||||||
|
home_builder($home_yard_replacements);
|
||||||
|
if ( -d $global_yard_replacements_arch_indep ) {
|
||||||
|
if (-d $home_yard_replacements) {
|
||||||
|
find sub { ( my $replacement =
|
||||||
|
$File::Find::name ) =~ s/$global_yard_replacements_arch_indep\///;
|
||||||
|
if (!-e "$home_yard_replacements/$replacement") {
|
||||||
|
|
||||||
|
#system "cp -a $File::Find::name $home_yard_replacements/$replacement > /dev/null 2>&1";
|
||||||
|
system "mkdir $home_yard_replacements/$replacement > /dev/null 2>&1" if -d $File::Find::name;
|
||||||
|
symlink_builder( $File::Find::name,"$home_yard_replacements/$replacement") if !-d $File::Find::name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}, $global_yard_replacements_arch_indep;
|
||||||
|
|
||||||
|
|
||||||
# $HOME/.gbootroot/yard/templates
|
|
||||||
home_builder($template_dir);
|
|
||||||
if ( -d $global_yard_templates ) {
|
|
||||||
opendir(DIR,$global_yard_templates) if -d $template_dir;
|
|
||||||
# I decided this may be too restrictive, besides, everything
|
|
||||||
# is kept in its own directory.
|
|
||||||
#my @templates = grep { m,\.yard$, } readdir(DIR);
|
|
||||||
my @templates = grep { m,^\w+, } readdir(DIR);
|
|
||||||
closedir(DIR);
|
|
||||||
foreach ( @templates ) {
|
|
||||||
if (!-e "$template_dir/$_" && !-l "$template_dir/$_") {
|
|
||||||
symlink_builder("$global_yard_templates/$_","$template_dir/$_");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
# Arch dep replacements repository
|
||||||
# Arch indep replacements repository
|
if ( -d $global_yard_replacements_arch_dep ) {
|
||||||
# $HOME/.gbootroot/yard/Replacements
|
if (-d $home_yard_replacements) {
|
||||||
home_builder($home_yard_replacements);
|
find sub { ( my $replacement =
|
||||||
if ( -d $global_yard_replacements_arch_indep ) {
|
$File::Find::name ) =~ s/$global_yard_replacements_arch_dep\///;
|
||||||
if (-d $home_yard_replacements) {
|
if (!-e "$home_yard_replacements/$replacement") {
|
||||||
find sub { ( my $replacement =
|
|
||||||
$File::Find::name ) =~ s/$global_yard_replacements_arch_indep\///;
|
#system "cp -a $File::Find::name $home_yard_replacements/$replacement > /dev/null 2>&1";
|
||||||
if (!-e "$home_yard_replacements/$replacement") {
|
system "mkdir $home_yard_replacements/$replacement > /dev/null 2>&1" if -d $File::Find::name;
|
||||||
|
symlink_builder( $File::Find::name,"$home_yard_replacements/$replacement") if !-d $File::Find::name;
|
||||||
#system "cp -a $File::Find::name $home_yard_replacements/$replacement > /dev/null 2>&1";
|
}
|
||||||
system "mkdir $home_yard_replacements/$replacement > /dev/null 2>&1" if -d $File::Find::name;
|
|
||||||
symlink_builder( $File::Find::name,"$home_yard_replacements/$replacement") if !-d $File::Find::name;
|
}, $global_yard_replacements_arch_dep;
|
||||||
}
|
|
||||||
|
|
||||||
}, $global_yard_replacements_arch_indep;
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
# Arch dep replacements repository
|
} # !%options
|
||||||
if ( -d $global_yard_replacements_arch_dep ) {
|
|
||||||
if (-d $home_yard_replacements) {
|
|
||||||
find sub { ( my $replacement =
|
|
||||||
$File::Find::name ) =~ s/$global_yard_replacements_arch_dep\///;
|
|
||||||
if (!-e "$home_yard_replacements/$replacement") {
|
|
||||||
|
|
||||||
#system "cp -a $File::Find::name $home_yard_replacements/$replacement > /dev/null 2>&1";
|
|
||||||
system "mkdir $home_yard_replacements/$replacement > /dev/null 2>&1" if -d $File::Find::name;
|
|
||||||
symlink_builder( $File::Find::name,"$home_yard_replacements/$replacement") if !-d $File::Find::name;
|
|
||||||
}
|
|
||||||
|
|
||||||
}, $global_yard_replacements_arch_dep;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------
|
#-------------------------------
|
||||||
|
|
||||||
if ( !%option ) {
|
if ( !%option || $option{gui_mode} ) {
|
||||||
if ( !$::commandline ) {
|
if ( !$::commandline ) {
|
||||||
|
|
||||||
# Gtk::check_version expects different arguments than .7004 so will have
|
# Gtk::check_version expects different arguments than .7004 so will have
|
||||||
@ -462,8 +472,9 @@ if ( !%option ) {
|
|||||||
|
|
||||||
my $window;
|
my $window;
|
||||||
|
|
||||||
if ( !%option ) {
|
if ( !%option || $option{gui_mode} ) {
|
||||||
if ( !$::commandline ) {
|
if ( !$::commandline ) {
|
||||||
|
|
||||||
|
|
||||||
$window = Gtk::Window->new("toplevel");
|
$window = Gtk::Window->new("toplevel");
|
||||||
# special policy
|
# special policy
|
||||||
@ -929,7 +940,7 @@ if ( $method eq "yard" ) {
|
|||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
|
|
||||||
} # end if !$::commandline
|
} # end if !$::commandline || $option{gui_mode}
|
||||||
|
|
||||||
} # end start
|
} # end start
|
||||||
|
|
||||||
|
@ -1516,14 +1516,27 @@ sub create_expect_uml {
|
|||||||
|
|
||||||
|
|
||||||
my $expect_program;
|
my $expect_program;
|
||||||
$option{"expect-program"} ?
|
if ( !$option{gui_mode} ) {
|
||||||
($expect_program = $option{"expect-program"}) :
|
$option{"expect-program"} ?
|
||||||
($expect_program = "/usr/lib/bootroot/expect_uml");
|
($expect_program = $option{"expect-program"}) :
|
||||||
|
($expect_program = "/usr/lib/bootroot/expect_uml");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$expect_program = $option{home} . "/expect_uml";
|
||||||
|
}
|
||||||
|
|
||||||
my $version = "2.4";
|
my $version = "2.4";
|
||||||
|
|
||||||
my $ubd0;
|
my $ubd0;
|
||||||
$option{"root-fs-helper-location"} ?
|
if ( !$option{gui_mode} ) {
|
||||||
($ubd0 = "ubd0=" . $option{"root-fs-helper-location"}) :
|
$option{"root-fs-helper-location"} ?
|
||||||
($ubd0 = "ubd0=/usr/lib/bootroot/root_filesystem/root_fs_helper");
|
($ubd0 = "ubd0=" . $option{"root-fs-helper-location"}) :
|
||||||
|
($ubd0 = "ubd0=/usr/lib/bootroot/root_filesystem/root_fs_helper");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ubd0 = "ubd0=./" . "root_filesystem/root_fs_helper";
|
||||||
|
}
|
||||||
|
|
||||||
my $ubd1 = "ubd1=$device";
|
my $ubd1 = "ubd1=$device";
|
||||||
my $options = "root=/dev/ubd0"; # need to keep this 1
|
my $options = "root=/dev/ubd0"; # need to keep this 1
|
||||||
my $filesystem;
|
my $filesystem;
|
||||||
@ -1587,17 +1600,39 @@ sub create_expect_uml {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
elsif (
|
else {
|
||||||
sys("/usr/lib/bootroot/$main::makefs -b $fs_size -d $mount_point -D $device_table $device") !~
|
# This could have been done with one if statement --freesource
|
||||||
/^0$/ ) {
|
if ( $option{genext2fs} ) {
|
||||||
$error = error("Cannot $fs_type filesystem.\n");
|
|
||||||
return "ERROR" if $error && $error eq "ERROR";
|
my $command = $option{genext2fs} . "/genext2fs/$main::makefs";
|
||||||
}
|
|
||||||
|
if ( sys("$command -b $fs_size -d $mount_point -D $device_table $device") !~
|
||||||
|
/^0$/ ) {
|
||||||
|
$error = error("Cannot $fs_type filesystem.\n");
|
||||||
|
return "ERROR" if $error && $error eq "ERROR";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ( $option{gui_mode} ) {
|
||||||
|
|
||||||
|
my $command = $option{home} . "/genext2fs/$main::makefs";
|
||||||
|
if ( sys("$command -b $fs_size -d $mount_point -D $device_table $device") !~
|
||||||
|
/^0$/ ) {
|
||||||
|
$error = error("Cannot $fs_type filesystem.\n");
|
||||||
|
return "ERROR" if $error && $error eq "ERROR";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ( sys("/usr/lib/bootroot/$main::makefs -b $fs_size -d $mount_point -D $device_table $device") !~
|
||||||
|
/^0$/ ) {
|
||||||
|
$error = error("Cannot $fs_type filesystem.\n");
|
||||||
|
return "ERROR" if $error && $error eq "ERROR";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
info(0, "\nDone making the root filesystem. $Warnings warnings.\n",
|
info(0, "\nDone making the root filesystem. $Warnings warnings.\n",
|
||||||
"$device is now umounted from $mount_point\n\n");
|
"$device is now umounted from $mount_point\n\n");
|
||||||
|
|
||||||
#info(0, "All done!\n");
|
#info(0, "All done!\n");
|
||||||
#info(0, "You can run more tests with the UML kernel\n",
|
#info(0, "You can run more tests with the UML kernel\n",
|
||||||
|
12
gbootroot
12
gbootroot
@ -237,6 +237,12 @@ BEGIN {
|
|||||||
|
|
||||||
$::commandline = \%option if %option;
|
$::commandline = \%option if %option;
|
||||||
$::commandline = $ARGV[0] if $ARGV[0];
|
$::commandline = $ARGV[0] if $ARGV[0];
|
||||||
|
|
||||||
|
if ( $option{home} && !$option{template} ) {
|
||||||
|
undef $::commandline;
|
||||||
|
$option{gui_mode} = $option{home};
|
||||||
|
undef $option{home};
|
||||||
|
}
|
||||||
|
|
||||||
if ( $Getopt::Long::error > 0 ) {
|
if ( $Getopt::Long::error > 0 ) {
|
||||||
|
|
||||||
@ -244,8 +250,8 @@ BEGIN {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( !%option ) {
|
if ( !%option || $option{gui_mode}) {
|
||||||
if ( !$::commandline ) {
|
if ( !$::commandline ) {
|
||||||
|
|
||||||
use Gtk;
|
use Gtk;
|
||||||
@ -270,7 +276,7 @@ $main::sudo = "sudo";
|
|||||||
start();
|
start();
|
||||||
|
|
||||||
|
|
||||||
if ( !%option ) {
|
if ( !%option || $option{gui_mode} ) {
|
||||||
if ( !$::commandline ) {
|
if ( !$::commandline ) {
|
||||||
|
|
||||||
main Gtk;
|
main Gtk;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user