1 #!/bin/bash 2 # Usage: uml-enter <memory> [ <command and options> ] 3 4 # Configuration: 5 if [ -e userinstall-defaults-uml ]; then 6 source userinstall-defaults-uml 7 elif [ -e /etc/default/userinstall-uml ]; then 8 source /etc/default/userinstall-uml 9 else 10 echo "No defaults found for userinstall (UML)." 11 exit 1 12 fi 13 14 if [[ ! $1 ]]; then 15 echo "$0 <memory>" 16 exit 1 17 fi 18 19 export IMAGE=$UMLROOT/rootfs 20 export SWAPIMAGE=$UMLROOT/swap 21 export UML_MEMORY=$1 22 export THIS_DIR=`dirname $0` 23 24 # Discard the memory argument. 25 26 shift 1 27 28 # Test for networking. 29 30 if [[ $1 == '--net' ]]; then 31 export UML_NETWORKING="$NETDEVICE=tuntap,$TUNDEVICE,fe:fd:0:0:0:1,$HOSTADDRESS" 32 xhost +$GUESTADDRESS 33 shift 1 34 fi 35 36 # Now we start the virtual machine... 37 38 $THIS_DIR/linux ubd0=$IMAGE ubd1=$SWAPIMAGE mem=$UML_MEMORY $UML_NETWORKING $*