From 953854a5a4f7d75ced0e59b5ec912e415398f3cb Mon Sep 17 00:00:00 2001 From: freesource Date: Wed, 11 Dec 2002 18:45:36 +0000 Subject: [PATCH] This gets everything working properly. Now --home works properly both for gui-mode and cli, and all executables can be properly specified. Ex: ./gbootroot --home . --template Example-Mini.yard --uml-exclusively on --expect-program ./expect_uml --uml-kerneluser-mode-linux/usr/bin/linux --root-fs-helper root_filesystem/root_fs_helper ./gbootroot --home . --template Example-Mini.yard --genext2fs-dir genext2fs/ --filesystem-command "genext2fs -z -r0" --- BootRoot/BootRoot.pm | 30 +++++++++++++++++++++++------- BootRoot/Options.pm | 2 +- BootRoot/Yard.pm | 22 ++++++++++++++++------ gbootroot | 1 - 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/BootRoot/BootRoot.pm b/BootRoot/BootRoot.pm index 6db85b6..52bf8b3 100644 --- a/BootRoot/BootRoot.pm +++ b/BootRoot/BootRoot.pm @@ -68,10 +68,16 @@ my $version = "1.4.0"; my $date = "11.19.2002"; my $gtk_perl_version = "0.7002"; my $home_rootfs = "$home/root_filesystem/"; + +# here's where the value of linux can be set my $home_uml_kernel; $option{gui_mode} ? ($home_uml_kernel = "$home/user-mode-linux/usr/bin/") : ($home_uml_kernel = "$home/uml_kernel/"); -$option{"uml-kernel"} = $home_uml_kernel . "linux" if !$option{"uml-kernel"}; +sub uml_kernel { + $home_uml_kernel = $home_uml_kernel . "linux" if !$option{"uml-kernel"}; + return $home_uml_kernel; +} + my $modules_directory = "/lib/modules"; my $Initrd; $option{gui_mode} ? @@ -257,9 +263,12 @@ my $ars = {}; # anonymous hash sub start { - if ( $> != 0 && -e "/usr/lib/bootroot/genext2fs" ) { - $main::makefs = "genext2fs -z -r0"; # -i8192 not a good idea -} + + if ( ($> != 0 && -e "/usr/lib/bootroot/genext2fs") || + ($> != 0 && ( $option{gui_mode} || $option{template}) ) || + ($> != 0 && ( $option{help} || $option{h} ) ) ) { + $main::makefs = "genext2fs -z -r0"; # -i8192 not a good idea + } $SIG{INT} = \&signal; $SIG{ABRT} = \&signal; @@ -811,6 +820,8 @@ else { # return if $error && $error eq "ERROR"; # # create_uml() create_expect_uml($filesystem_size, $tmp, $filename); +# +# something like this does the trick: ./gbootroot --home . --template Example-Mini.yard --uml-exclusively on --expect-program ./expect_uml --uml-kernel user-mode-linux/usr/bin/linux --root-fs-helper root_filesystem/root_fs_helper ######################################################## # What to do if somebody specifies help @@ -833,7 +844,12 @@ else { print " (system kernel options)\n"; print " --kernel=path specify different system kernel\n"; print " --kernel-version=version specify alternative version\n"; - print " --genext2fs-dir=dir /usr/lib/bootroot/\n\n"; + print " --genext2fs-dir=dir /usr/lib/bootroot/\n"; + print " --expect-program=path /usr/lib/bootroot/expect_uml\n"; + print " --root-fs-helper=path /usr/lib/bootroot/root_filesystem/root_fs_helper\n"; + print " --home=dir gui mode = without other options\n"; + print " cl mode = with other options\n"; + print " min: --template\n\n"; print " (print options)\n"; print " --no-stdout don't print to console\n\n"; print "filesytem-commands supported by root_fs_helper:\n"; @@ -846,8 +862,8 @@ else { # Let's read in the ARGV -### die "specify a template found in $template_dir\nuse --template\n" -### if !$option{template}; + die "specify a template found in $template_dir\nuse --template\n" + if !$option{template}; start_logging_output($verbosefn,$verbosity); # Yard "tmp dir name" diff --git a/BootRoot/Options.pm b/BootRoot/Options.pm index e6aba11..f52a5f1 100644 --- a/BootRoot/Options.pm +++ b/BootRoot/Options.pm @@ -67,7 +67,7 @@ sub option { "home=s", # by itself = GUI # path relative to `pwd` usually "." - "root-fs-helper-location=s", # full path or rel path + "root-fs-helper=s", # full path or rel path # in Yard $ubd0 "expect-program=s", # i.e. ./expect_uml diff --git a/BootRoot/Yard.pm b/BootRoot/Yard.pm index 698481b..d86e9b6 100644 --- a/BootRoot/Yard.pm +++ b/BootRoot/Yard.pm @@ -1,4 +1,4 @@ -########################################################################### +########################################################################## ## ## Yard.pm combining ## MAKE_ROOT_FS, CHECK_ROOT_FS, and YARD_UTILS.PL by Tom Fawcett @@ -1529,8 +1529,8 @@ sub create_expect_uml { my $ubd0; if ( !$option{gui_mode} ) { - $option{"root-fs-helper-location"} ? - ($ubd0 = "ubd0=" . $option{"root-fs-helper-location"}) : + $option{"root-fs-helper"} ? + ($ubd0 = "ubd0=" . $option{"root-fs-helper"}) : ($ubd0 = "ubd0=/usr/lib/bootroot/root_filesystem/root_fs_helper"); } else { @@ -1548,10 +1548,20 @@ sub create_expect_uml { } my $x_count = 1; + + my $command_line; + + if ( $option{"uml-kernel"} ) { + $command_line = "$expect_program $ubd0 $ubd1 $options " . + "$mount_point $preserve_ownership " . + $option{"uml-kernel"} . " $filesystem"; + } + else { + $command_line = "$expect_program $ubd0 $ubd1 $options " . + "$mount_point $preserve_ownership " . + BootRoot::BootRoot::uml_kernel() . " $filesystem"; + } - my $command_line = "$expect_program $ubd0 $ubd1 $options " . - "$mount_point $preserve_ownership " . - $option{"uml-kernel"} . " $filesystem"; info(0,"\nUsing helper root_fs to $fs_type the filesystem:\n\n"); info(0,"$command_line\n\n"); diff --git a/gbootroot b/gbootroot index 5e515e8..85d2c2e 100755 --- a/gbootroot +++ b/gbootroot @@ -274,7 +274,6 @@ $main::sudo = "sudo"; start(); - if ( !%option || $option{gui_mode} ) { if ( !$::commandline ) {