From 3f7df32e64c769343b5d55bc0947dc069eeba825 Mon Sep 17 00:00:00 2001 From: freesource Date: Thu, 20 Feb 2003 05:28:29 +0000 Subject: [PATCH] Had to add more changes to expect_uml and UML so that there will be an established PATH, and so that uml_mconsole's system command won't be issued until the last line is actually come to via a new method. --- BootRoot/UML.pm | 11 ++++++++++- expect_uml | 31 ++++++++++++------------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/BootRoot/UML.pm b/BootRoot/UML.pm index 786d77a..182f775 100644 --- a/BootRoot/UML.pm +++ b/BootRoot/UML.pm @@ -9,7 +9,8 @@ # 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. +# inits like /bin/bash. Added a new method so that +# the last line can be discerned before halting. package BootRoot::UML; @@ -179,6 +180,14 @@ sub halt { $me->{expect_handle}->expect(undef); } +sub close_no_init { + my $me = shift; + + $me->{expect_handle}->print("Shutting down\s\s\n"); + $me->{expect_handle}->expect(undef, "-re", "Shutting down"); + +} + sub kill { my $me = shift; diff --git a/expect_uml b/expect_uml index e971a81..2b6de27 100755 --- a/expect_uml +++ b/expect_uml @@ -84,21 +84,6 @@ for ( 6 .. $#ARGV ) { } - -=pod -my $uml = - BootRoot::UML->new( login_prompt => "bootroot login: ", - kernel => $uml_kernel, - arguments => $arguments, - login => "root", - password_prompt => "Password: ", - password => "", - prompt => "bootroot:.*# ", - halt => "shutdown -h now" - ); -=cut - - my $uml = BootRoot::UML->new( login_prompt => "", kernel => $uml_kernel, @@ -107,10 +92,16 @@ my $uml = password_prompt => "Password: ", password => "", prompt => ".*# ", - halt => "shutdown -h now" + halt => "exit" ); $uml->boot(); + +# Establish PATH, some compilations of bash ignore some important paths +$uml->command("PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:."); + +$uml->command("mount -t proc proc /proc"); + # Make the GID/UID 0 FS if ( $filesystem =~ /^mkcramfs/ || $filesystem =~ /^genromfs/ || $filesystem =~ /^mkfs\.jffs/ ) { @@ -173,7 +164,9 @@ elsif ( $filesystem =~ /^mkfs\.jffs/ ) { } $uml->command("umount /mnt1; umount /mnt2"); -# The fast way -system "uml_mconsole $umid halt"; + # Fall through -$uml->halt() +$uml->close_no_init(); + +# Wait until the last line +system "uml_mconsole $umid halt";