Index: /drbl-virt/sbin/add_value
===================================================================
--- /drbl-virt/sbin/add_value	(revision 186)
+++ /drbl-virt/sbin/add_value	(revision 187)
@@ -13,9 +13,9 @@
 
 # delete
-sed -i "/# drbl-virt $eth add/d" $2
-sed -i "/# drbl-virt $eth end/d" $2
+sed -i "/# drbl-virt $3 add/d" $2
+sed -i "/# drbl-virt $3 end/d" $2
 
 #
-echo "# Crawlzilla $eth add" >> $2
+echo "# drbl-virt $3 add" >> $2
 cat $1 >> $2
-echo "# Crawlzilla $eth end" >> $2
+echo "# drbl-virt $3 end" >> $2
Index: /drbl-virt/sbin/drbl_virt.sh
===================================================================
--- /drbl-virt/sbin/drbl_virt.sh	(revision 186)
+++ /drbl-virt/sbin/drbl_virt.sh	(revision 187)
@@ -18,11 +18,15 @@
 VMM_select
 
-# [Install VMM/Hypervisior] 1=Xen, 2=KVM
+# = 1.[Install VMM/Hypervisior] 1=Xen, 2=KVM =
 if [ $VMM_select == 1 ]; then
-    bash "xen_install.sh start"
+    $Work_Path/xen_install.sh start
 else
-    bash "kvm_install.sh"
+    $Work_Path/kvm_install.sh
 fi
 
-# [DRBL Environment Configuration]
+# = 2. Patch DRBL =                                                                                                                
+$Work_Path/drbl_xen_patch.sh
+ 
+# = 3. drbl_xen_repush.sh =
+$Work_Path/drbl_xen_repush.sh
 
Index: /drbl-virt/sbin/drbl_xen_patch.sh
===================================================================
--- /drbl-virt/sbin/drbl_xen_patch.sh	(revision 186)
+++ /drbl-virt/sbin/drbl_xen_patch.sh	(revision 187)
@@ -35,5 +35,5 @@
 # == Modify PXE booting menu ==
 # if menu doesn't has drbl-virt, then add it
-cat /opt/drbl/sbin/generate-pxe-menu | grep "label drbl-virt"
+cat /opt/drbl/sbin/generate-pxe-menu | grep "label drbl-virt" >> /dev/null
 if [  $? != 0 ]; then
 # backup generate-pxe-menu
@@ -68,5 +68,5 @@
 # == Patch /usr/bin/mkpxeinitrd-net (1)Xen network scripts (2)command (3)modules ==
 # backup mkpxeinitrd-net. if already has "drbl-virt add", dones't sed
-cat /usr/bin/mkpxeinitrd-net | grep "# drbl-virt add"
+cat /usr/bin/mkpxeinitrd-net | grep "# drbl-virt add" >> /dev/null
 if [ $? != 0 ]; then
 cp /usr/bin/mkpxeinitrd-net /usr/bin/mkpxeinitrd-net.drbl-virt_bak
@@ -113,6 +113,6 @@
 fi
 # == Run start_xen_bridge.sh when booting  ==
-cat linuxrc-or-init | grep "bash /bin/start_xen_bridge.sh"
-if [ $? !=0 ]; then
+cat /usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init | grep "bash /bin/start_xen_bridge.sh" >> /dev/null
+if [ $? != 0 ]; then
     # backup linuxrc-or-init
     cp /usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init /usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init.drbl-virt_bak 
@@ -140,4 +140,4 @@
     mkdir /home/domains
 fi
-cp /boot/*{Xen_Kernel}* /home/domains
+cp /boot/*${Xen_Kernel}* /home/domains
 
Index: /drbl-virt/sbin/drbl_xen_repush.sh
===================================================================
--- /drbl-virt/sbin/drbl_xen_repush.sh	(revision 186)
+++ /drbl-virt/sbin/drbl_xen_repush.sh	(revision 187)
@@ -57,4 +57,7 @@
     VM_hosts=$(cat /opt/drbl-virt/etc/IP_VM_$eth | awk '{print $2}')
     VM_MACs=$(cat /opt/drbl-virt/etc/macadr-VM-$eth.txt)
+
+    echo -e "VM_IPs=$VM_IPs \n VM_IPs_nu=$VM_IPs_nu \n VM_hosts=$VM_hosts \n VM_MACs=$VM_MACs"
+
     # delete duplicating value(ip,hostname) in IP_HOST_TABLE
     if [ -e /etc/drbl/IP_HOST_TABLE ]; then
@@ -62,5 +65,5 @@
     fi
     # add ip & hostname
-    $Work_Path/add_value /opt/drbl-virt/etc/IP_VM_$eth /etc/drbl/IP_HOST_TABLE
+    $Work_Path/add_value /opt/drbl-virt/etc/IP_VM_$eth /etc/drbl/IP_HOST_TABLE $eth
     
     # == Add Mac address to macadr-ethX.txt ==
@@ -68,5 +71,5 @@
     $Work_Path/duplicate_del_MAC /etc/drbl/macadr-$eth.txt
     fi
-
+    cat /opt/drbl-virt/etc/macadr-VM-$eth.txt >> /etc/drbl/macadr-$eth.txt
 done 
      
Index: /drbl-virt/sbin/duplicate_del_MAC
===================================================================
--- /drbl-virt/sbin/duplicate_del_MAC	(revision 186)
+++ /drbl-virt/sbin/duplicate_del_MAC	(revision 187)
@@ -1,5 +1,5 @@
 #!/bin/bash
 # Program:
-#   Delete duplicating ip & hostname
+#   Delete duplicating VM MAC
 # Author: 
 #   Rock {waue, shunfa, rock}@nchc.org.tw
@@ -15,15 +15,15 @@
 cp $1 $1.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak 
 
-# Delete duplating VM IP
-for vm_ip in $(echo $VM_IPs)
+# Delete duplating VM MAC
+for vm_mac in $(echo $VM_MACs)
 do
-    vm_ip_lines=$(cat -n $1 | grep $vm_ip | awk '{print $1}' )
+    vm_mac_lines=$(cat -n $1 | grep $vm_mac | awk '{print $1}' )
     # no duplicated vlaue, doesn't do it
-    if [ -n $vm_ip_lines ]; then
-        vm_ip_count=$(echo $vm_ip_lines | wc -w)
+    if [ -n $vm_mac_lines ]; then
+        vm_mac_count=$(echo $vm_mac_lines | wc -w)
 
-        for (( i=1; i<=${VM_ip_count}; i++ ))
+        for (( i=1; i<=${VM_mac_count}; i++ ))
         do
-            del_line=$(echo $vm_ip_lines | cut -d " " -f${i})
+            del_line=$(echo $vm_mac_lines | cut -d " " -f${i})
             sed -i "${del_line}d" $1
         done
@@ -31,19 +31,3 @@
 done
   
-# Dlete duplicating hostname in file
-for vm_host in $(echo $VM_hosts)
-do
-    # line numbers
-    vm_host_lines=$(cat -n $1 | grep "$vm_host" | awk '{print $1}')
-    # no duplicated vlaue, doesn't do it
-    if [ -n $vm_host_lines ]; then
-        vm_host_count=$(echo $vm_host_lines | wc -w)
-  
-        for (( i=1; i<=${vm_host_count}; i++ ))
-        do
-            del_line=$(echo $vm_host_lines | cut -d " " -f${i})
-            sed -i "${del_line}d" $1
-        done                                                                                                                                                             
-    fi
-done
 
Index: /drbl-virt/sbin/functions_drbl_virt
===================================================================
--- /drbl-virt/sbin/functions_drbl_virt	(revision 186)
+++ /drbl-virt/sbin/functions_drbl_virt	(revision 187)
@@ -80,5 +80,5 @@
 aptitude update
 check_debian_xen_pkg=$(aptitude search xen-linux-system)
-if [ -n $check_debian_xen_pkg  ]; then
+if [ -n "$check_debian_xen_pkg"  ]; then
     check_debian_xen_pkg="yes"
 else
Index: /drbl-virt/sbin/xen_install.sh
===================================================================
--- /drbl-virt/sbin/xen_install.sh	(revision 186)
+++ /drbl-virt/sbin/xen_install.sh	(revision 187)
@@ -27,5 +27,5 @@
         check_debian_xen_pkg=""
         check_debian_xen
-        echo $check_debian_xen_pkg
+        #echo $check_debian_xen_pkg
 
         if [ $check_debian_xen_pkg == "no" ]; then
@@ -47,10 +47,10 @@
             hypervisior=""
             check_hypervisior
-            echo $hyprtvisior
+            #echo $hypervisior
 
             if [ $hypervisior == "Xen" ]; then
                 echo ""
                 echo "Install Xen Hypervisior"
-                aptitude install xen-linux-system-2.6.26-2-xen-${Linux_bit} xen-tools bridge-utils python-xml
+                aptitude install xen-linux-system-2.6.26-2-xen-${Linux_bit} xen-tools bridge-utils python-xml ipcalc
                 cp $Work_Home/conf/debian-lenny_xend-config.sxp /etc/xen/xend-config.sxp
                 if [ $1 == "stop" ]; then
@@ -80,7 +80,2 @@
 esac
 
-# = 2. Patch DRBL = 
-$Work_Path/drbl_xen_patch.sh
-
-# = 3. drbl_xen_repush.sh =
-$Work_Path/drbl_xen_repush.sh
