mirror of
https://github.com/fspc/gbootroot.git
synced 2025-02-23 00:53:23 -05:00
Makes a more effecient root_fs_helper by not making logon mandatory,
and using uml_mconsole halt for a quick halt rather than shutdown -h now.
This commit is contained in:
parent
584ff4c566
commit
806baff56e
@ -7,6 +7,9 @@
|
|||||||
# Changes:
|
# Changes:
|
||||||
# 12/15/2001 Changed UML to BootRoot::UML
|
# 12/15/2001 Changed UML to BootRoot::UML
|
||||||
# Can now set password to "" to allow no password.
|
# Can now set password to "" to allow no password.
|
||||||
|
#
|
||||||
|
# 02/18/2003 Now login isn't mandatory which allows login-free
|
||||||
|
# inits like /bin/bash.
|
||||||
|
|
||||||
package BootRoot::UML;
|
package BootRoot::UML;
|
||||||
|
|
||||||
@ -76,8 +79,11 @@ sub boot {
|
|||||||
$log = $me->open_log($log_file);
|
$log = $me->open_log($log_file);
|
||||||
$me->{expect_handle}->log_stdout(0);
|
$me->{expect_handle}->log_stdout(0);
|
||||||
}
|
}
|
||||||
$me->{expect_handle}->expect(undef, "$me->{login_prompt}");
|
|
||||||
$me->{expect_handle}->print("$me->{login}\n");
|
if ( $me->{login_prompt} ne "" ) {
|
||||||
|
$me->{expect_handle}->expect(undef, "$me->{login_prompt}");
|
||||||
|
$me->{expect_handle}->print("$me->{login}\n");
|
||||||
|
}
|
||||||
|
|
||||||
# It's o.k. not to have a password .. password_prompt will be ignored.
|
# It's o.k. not to have a password .. password_prompt will be ignored.
|
||||||
# --freesource
|
# --freesource
|
||||||
@ -86,7 +92,11 @@ sub boot {
|
|||||||
$me->{expect_handle}->print("$me->{password}\n");
|
$me->{expect_handle}->print("$me->{password}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$me->{expect_handle}->expect(undef, "-re", "$me->{prompt}");
|
$me->{expect_handle}->expect(undef, "-re", "$me->{prompt}");
|
||||||
|
$me->{expect_handle}->print("echo Let's make you're root_fs!\r");
|
||||||
|
$me->{expect_handle}->print("\r");
|
||||||
|
|
||||||
return($log);
|
return($log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1925,10 +1925,11 @@ sub create_expect_uml {
|
|||||||
if ( !$option{template} ) {
|
if ( !$option{template} ) {
|
||||||
$options = "root=/dev/ubd0 " . "mode=" .
|
$options = "root=/dev/ubd0 " . "mode=" .
|
||||||
BootRoot::BootRoot::skas_or_tt() . " " .
|
BootRoot::BootRoot::skas_or_tt() . " " .
|
||||||
$option{"uml-options"};
|
$option{"uml-options"} . " umid=root_fs_helper init=/bin/bash";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$options = "root=/dev/ubd0 " . $option{"uml-options"};
|
$options = "root=/dev/ubd0 " . $option{"uml-options"} .
|
||||||
|
" umid=root_fs_helper init=/bin/bash";
|
||||||
}
|
}
|
||||||
my $filesystem;
|
my $filesystem;
|
||||||
if ( $fs_type eq "genext2fs" ) {
|
if ( $fs_type eq "genext2fs" ) {
|
||||||
|
21
expect_uml
21
expect_uml
@ -56,6 +56,8 @@ if ( !$ARGV[0] ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $arguments = "$ARGV[0] $ARGV[1] $ARGV[2]";
|
my $arguments = "$ARGV[0] $ARGV[1] $ARGV[2]";
|
||||||
|
$ARGV[2] =~ /umid=([\w_]+)\s*/;
|
||||||
|
my $umid = $1;
|
||||||
my $mount_point = "$ARGV[3]";
|
my $mount_point = "$ARGV[3]";
|
||||||
my $preserve_ownership = "$ARGV[4]";
|
my $preserve_ownership = "$ARGV[4]";
|
||||||
my $uml_kernel = "$ARGV[5]";
|
my $uml_kernel = "$ARGV[5]";
|
||||||
@ -81,6 +83,9 @@ for ( 6 .. $#ARGV ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=pod
|
||||||
my $uml =
|
my $uml =
|
||||||
BootRoot::UML->new( login_prompt => "bootroot login: ",
|
BootRoot::UML->new( login_prompt => "bootroot login: ",
|
||||||
kernel => $uml_kernel,
|
kernel => $uml_kernel,
|
||||||
@ -91,6 +96,19 @@ my $uml =
|
|||||||
prompt => "bootroot:.*# ",
|
prompt => "bootroot:.*# ",
|
||||||
halt => "shutdown -h now"
|
halt => "shutdown -h now"
|
||||||
);
|
);
|
||||||
|
=cut
|
||||||
|
|
||||||
|
|
||||||
|
my $uml =
|
||||||
|
BootRoot::UML->new( login_prompt => "",
|
||||||
|
kernel => $uml_kernel,
|
||||||
|
arguments => $arguments,
|
||||||
|
login => "root",
|
||||||
|
password_prompt => "Password: ",
|
||||||
|
password => "",
|
||||||
|
prompt => ".*# ",
|
||||||
|
halt => "shutdown -h now"
|
||||||
|
);
|
||||||
|
|
||||||
$uml->boot();
|
$uml->boot();
|
||||||
# Make the GID/UID 0 FS
|
# Make the GID/UID 0 FS
|
||||||
@ -155,4 +173,7 @@ elsif ( $filesystem =~ /^mkfs\.jffs/ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$uml->command("umount /mnt1; umount /mnt2");
|
$uml->command("umount /mnt1; umount /mnt2");
|
||||||
|
# The fast way
|
||||||
|
system "uml_mconsole $umid halt";
|
||||||
|
# Fall through
|
||||||
$uml->halt()
|
$uml->halt()
|
||||||
|
@ -87,6 +87,11 @@ Mandrake should use the mdk rpm. Distributions which require Gtk-Perl and
|
|||||||
only require perl for perl such as Red Hat should use the rpm not marked
|
only require perl for perl such as Red Hat should use the rpm not marked
|
||||||
as mdk.
|
as mdk.
|
||||||
|
|
||||||
|
There are some variations on this theme. Suse is a Red Hat type of
|
||||||
|
distribution, however it prepends perl to Gtk-Perl, so if
|
||||||
|
perl-Gtk-Perl is installed on your system you can just add the
|
||||||
|
--nodeps option when doing an install.
|
||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -n gbootroot-%{version}
|
%setup -n gbootroot-%{version}
|
||||||
|
@ -85,6 +85,11 @@ Mandrake should use the mdk rpm. Distributions which require Gtk-Perl and
|
|||||||
only require perl for perl such as Red Hat should use the rpm not marked
|
only require perl for perl such as Red Hat should use the rpm not marked
|
||||||
as mdk.
|
as mdk.
|
||||||
|
|
||||||
|
There are some variations on this theme. Suse is a Red Hat type of
|
||||||
|
distribution, however it prepends perl to Gtk-Perl, so if
|
||||||
|
perl-Gtk-Perl is installed on your system you can just add the
|
||||||
|
--nodeps option when doing an install.
|
||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -n gbootroot-%{version}
|
%setup -n gbootroot-%{version}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user