view mrb/vm_login.sh @ 15:6bc5df5d2da4 default tip

New configuration for Redirect tests
author Sebastien Decugis <sdecugis@nict.go.jp>
date Tue, 22 Feb 2011 14:54:59 +0900
parents 9e5a3c884de6
children
line wrap: on
line source

#!/bin/bash +x

# Check params
if [ -z "$1" ]; then echo "Donnez le nom de la VM en parametre"; exit 1; fi

# Check if the user is already logged
if [  "$2" != "force" ]; then
VBoxManage guestproperty get "$1" /VirtualBox/GuestInfo/OS/NoLoggedInUsers| grep "^Value:\s*true" >/dev/null || {
	echo $1 already has a user logged in.
	exit 0
}
fi

# Scancodes for "root"
ROOT_SC="13 93 18 98 18 98 14 94"

# OK, now send "root" then enter
VBoxManage controlvm "$1" keyboardputscancode $ROOT_SC 1c 9c > /dev/null
sleep 1
# Sent the password
VBoxManage controlvm "$1" keyboardputscancode `cat /home/thedoc/priv/pass | grep -v //` 1c 9c > /dev/null
sleep 1

# Now check we are logged in
#VBoxManage guestproperty get "$1" /VirtualBox/GuestInfo/OS/NoLoggedInUsers | grep "^Value:\s*false" > /dev/null || {
#        echo Failed to login on $1
#        exit 1
#}

# Done!
"Welcome to our mercurial repository"