X-Git-Url: http://lab.mitty.jp/git/?a=blobdiff_plain;f=vmware%2Fhotaddbridge;h=8a7d4cfc2f1af5d55264d28d7ed531ee22fc6d50;hb=013d01080b5b91d0f7b5f85d22a90619d264c745;hp=a79fe2409760545e9306d647f0fb078ef3d19c4a;hpb=dd21d694b03f2dfcbcc47bab664cef6c8ca7d9ec;p=lab.git diff --git a/vmware/hotaddbridge b/vmware/hotaddbridge index a79fe24..8a7d4cf 100755 --- a/vmware/hotaddbridge +++ b/vmware/hotaddbridge @@ -10,15 +10,15 @@ echo "Locating Existing Devices" for dev in $(ls /dev/vmnet*); do -echo " Found $dev" + echo " Found $dev" done echo printf "Please enter a device number that does not exist in this list: " read num # Check if it exists -if [ -f /dev/vmnet$num ];then -echo "/dev/vmnet$num exists! Exiting." -exit 1 +if [ -e /dev/vmnet$num ];then + echo "/dev/vmnet$num exists! Exiting." + exit 1 fi @@ -27,7 +27,7 @@ echo echo "Locating interfaces to bridge" for int in $(ifconfig |grep "^[a-z,A-Z]" |cut -d' ' -f1); do -echo $int + echo $int done printf "Please enter a interface: " read interface @@ -36,14 +36,19 @@ read interface ifconfig $interface >/dev/null 2>&1 ret=$? if [ $ret != 0 ];then -echo "Can't find interface. Exiting!" -exit 1 + if [ "$1" != "-d" ]; then + echo "Can't find interface. Exiting!" + exit 1 + else + echo "Use dummy device: $interface" + dummy="Dummy " + fi fi # Create device echo "Creating device /dev/vmnet$num" -mknod /dev/vmnet$num c 119 $num +mknod --mode=600 /dev/vmnet$num c 119 $num # Add to vmware netmap configuration # open netmap.conf and get next number in list @@ -51,9 +56,14 @@ let nextnetnum=$(cat /etc/vmware/netmap.conf | tail -1 | cut -d'.' -f1 | sed -e echo "Adding network$nextnetnum to /etc/vmware/netmap.conf" -echo "network$nextnetnum.name=\"$interface\"">> /etc/vmware/netmap.conf -echo "network$nextnetnum.device=\"vmnet$num\"">> /etc/vmware/netmap.conf +echo "network$nextnetnum.name = \"${dummy}Bridged to $interface\"">> /etc/vmware/netmap.conf +echo "network$nextnetnum.device = \"vmnet$num\"">> /etc/vmware/netmap.conf +# Add to vmware locations configuration +echo "answer VNET_${num}_NAME ${dummy}Bridged to $interface" >> /etc/vmware/locations +echo "answer VNET_${num}_INTERFACE $interface" >> /etc/vmware/locations +echo "remove_file /dev/vmnet$num" >> /etc/vmware/locations +echo "file /dev/vmnet$num" >> /etc/vmware/locations # Start Service -vmnet-bridge -d /var/run/vmnet-bridge-$num.pid -n $num -i $interface +`which vmnet-bridge` -d /var/run/vmnet-bridge-$num.pid -n $num -i $interface