X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=virt-p2v.sh;fp=virt-p2v.sh;h=0007e54bec6e1d39d1235e0f575bc0640eebcaec;hb=733cfd03fb692fc76a8ea87018640cd2e9806409;hp=ae0d021a56ef953c29701100cbafec072b3028e6;hpb=bb190cb82bc62bb3f3097abb0dbf7142bcef3ae5;p=virt-p2v.git diff --git a/virt-p2v.sh b/virt-p2v.sh index ae0d021..0007e54 100755 --- a/virt-p2v.sh +++ b/virt-p2v.sh @@ -22,7 +22,11 @@ # # $Id$ +# Because we're running from a start-up script, we don't have much +# of a login environment, so set one up. export PATH=/usr/sbin:/sbin:/usr/local/bin:/usr/kerberos/bin:/usr/bin:/bin +export HOME=/root +export LOGNAME=root # The defaults here make a generic virt-p2v.sh script, but if you want # to build a partially-/fully-automatic P2V solution, then you can set @@ -96,12 +100,12 @@ function word_in_list { # Use the function read_line instead of the shell built-in read. # It reads from the console. function read_line { - read "$*" /dev/console 2>&1 + PS1='\u@\h:\w\$ ' bash } #---------------------------------------------------------------------- @@ -286,7 +290,7 @@ function auto_network { echo "(Hint: if not sure, there is a shell on console [ALT] [F2])" echo -n " (y/n) " local line - read_line line /dev/$1 +fi + # We can safely write files into /tmp without modifying anything. cd /tmp #---------------------------------------------------------------------- # Dialog with the user. -log -log virt-p2v starting up at `date` - if [ "$greeting" != "no" ]; then dialog \ --title "virt-p2v" \ @@ -647,7 +658,8 @@ for dev in $devices_to_send; do ;; tcp) echo "p2v $name $sectors" > header - cat header - | nc "$remote_host" "$remote_port" + echo > newline + cat header - newline | nc "$remote_host" "$remote_port" ;; esac done