#!/bin/bash declare -i idx= first=1 rm -rf /local/target0/umltest mkdir -p /local/umltest/cow mkdir -p /local/umltest/hostfs if (( $# < 1 )); then idx=1 else idx=$1 fi root="/local/dbahi/root_fs.rh-9-full" swap="/local/dbahi/swap_fs.256" pipe="/local/umltest/pipe" linux="/view/dmerrill_linux/ccase/linux24/src/linux" if [[ ! -x "${linux}" ]]; then echo -ne "${linux}\n\nnot found or not executable!!!!\n" exit fi pause=5 mem="128M" nice="nice" screen="screen -DmS" xterm="xterm -e screen -r" tunctl="tunctl -b -u $USER" echo -ne "\n# Will launch $idx UML(s)...\n#\n#" echo -ne "\n# Launching tunctl for tap interface with command:\n#" echo -ne "\n# ${tunctl}\n#\n#" tapdev=$(${tunctl}) umlxcmd="/usr/bin/uml_switch -unix ${pipe} -tap ${tapdev}" tunrm="tunctl -d ${tapdev}" echo -ne "\n# Launching uml_switch with command:\n#" echo -ne "\n# ${screen} uml_switch -t uml_switch ${umlxcmd}\n#\n#" echo -ne "\n# Attaching uml_switch with command:\n#" echo -ne "\n# ${xterm} uml_switch\n#\n#" ${screen} uml_switch -t uml_switch ${umlxcmd} & ${xterm} uml_switch & cur=1 while (( $cur <= $idx )); do umid="uml_${cur}" mac=$(echo "ibase=10; obase=16; ${cur}" | bc) ubd0cow="/local/umltest/cow/ubd0_${cur}" ubd1cow="/local/umltest/cow/ubd1_${cur}" hfsdir="/local/umltest/hostfs/host_${cur}" eth="daemon,fe:fd:00:00:00:${mac},unix,${pipe}" cmd="${nice} ${linux} umid=${umid} ubd0=${ubd0cow},${root} ubd1=${ubd1cow},${swap} hostfs=${hfsdir} mem=${mem} eth0=${eth}" if (( $first > 0 )); then first=0 echo -ne "\n# Launching UML with commands like:\n#" echo -ne "\n# ${screen} ${umid} -t ${umid} ${cmd}\n#\n#" echo -ne "\n# Attaching UML with commands like:\n#" echo -ne "\n# ${xterm} ${umid}\n#\n#" echo -ne "\n# Use the following to shutdown:\n\n\n" echo -ne "pkill uml_switch\n\n" fi echo -ne "uml_mconsole ${umid} halt" mkdir -p ${hfsdir} ${screen} ${umid} -t ${umid} ${cmd} & ${xterm} ${umid} & if (( $cur < $idx )); then echo -ne " # pausing ."; slept=0 while (( $slept < $pause )); do sleep 1 echo -ne "." slept=$((slept + 1)) done fi echo -ne "\n" cur=$((cur + 1)) done echo -ne "\n$tunrm\n" echo -ne "\n\n# Done.\n"