Index: nutchez-0.2/src/test/install
===================================================================
--- nutchez-0.2/src/test/install	(revision 163)
+++ nutchez-0.2/src/test/install	(revision 164)
@@ -10,10 +10,14 @@
 # *.sh及nutchez-0.2-0531.tar.gz均在同一目錄下
 
+function show_info () {
+  if [ $? -eq 0 ]; then
+    echo -e "\033[1;32;40m $1 \033[0m"
+  fi
+}
 
 main () {
   check_info
-  echo "歡迎使用NutchEZ, 此安裝程序會為您新建一個nutchuser帳號"
+  show_info "歡迎使用NutchEZ, 此安裝程序會為您新建一個nutchuser帳號並協助您設定密碼"
   set_install_information
-  show_info
   read -p "Please confirm your install infomation: 1.Yes 2.No  " confirm
   if [ $confirm -eq 1 ]; then
@@ -39,6 +43,6 @@
     start_up_tomcat    
     # 安裝流程結束，並進入網頁管理頁面設定爬網網址...等  
-    echo "Install Successfully!!"
-    echo "Visit http://$MasterIP_Address:8080"
+    show_info "Install Successfully!!"
+    show_info "Visit http://$MasterIP_Address:8080"
     client_install_command
   elif [ $confirm -eq 2 ]; then
@@ -47,5 +51,3 @@
 }
 
-# todo: 處理/etc/hosts
-# 多張網卡時的bug
 main
Index: nutchez-0.2/src/test/install_func.sh
===================================================================
--- nutchez-0.2/src/test/install_func.sh	(revision 163)
+++ nutchez-0.2/src/test/install_func.sh	(revision 164)
@@ -32,5 +32,12 @@
 
 
-function debug_echo () {
+function debug_info () {
+  if [ $? -eq 0 ]; then
+    echo -e "\033[1;35;40m info - $1 \033[0m"
+  fi
+}
+
+
+function show_info () {
   if [ $? -eq 0 ]; then
     echo -e "\033[1;32;40m $1 \033[0m"
@@ -79,24 +86,24 @@
   else
     declare -i i=1
-    echo -e "\nSystem have multiple network device, which network use for this machine: "
+    show_info  "\nSystem have multiple network device, which network use for this machine: "
 
     for net in $net_interfaces
       do
-        echo "($i)  $net  $(ifconfig $net | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1)"
+        show_info "($i)  $net  $(ifconfig $net | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1)"
         i=i+1
       done
 
-      read -p "Plz choice(1/2/3...): " net_choice
+      read -p "Please choice(1/2/3...): " net_choice
     if [ -z $net_choice ]; then
       net_choice=1
     fi
 
-    echo "Your choice is $net_choice"
+    show_info "Your choice is $net_choice"
     net_interface=$(echo $net_interfaces | cut -d " " -f $net_choice)
     #ifconfig $net_interface | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1
     net_address=$(ifconfig $net_interface | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1)
-    net_MacAddr=$(ifconfig $net_interfaces | grep 'HW' | sed 's/^.*HWaddr //g')
-    echo "net_address is $net_address"
-    echo "net_MacAddr is $net_MacAddr"
+    net_MacAddr=$(ifconfig $net_interface | grep 'HW' | sed 's/^.*HWaddr //g')
+    show_info "net_address is $net_address"
+    show_info "net_MacAddr is $net_MacAddr"
   fi
 }
@@ -104,6 +111,6 @@
 
 function show_info () {
-  echo "The Master IP Address is $MasterIP_Address"
-  echo "The Master MacAddr is $net_MacAddr"
+  show_info "The Master IP Address is $MasterIP_Address"
+  show_info "The Master MacAddr is $net_MacAddr"
 }
 
@@ -113,14 +120,14 @@
 
 function make_ssh_key () {
-  debug_echo "Make ssh key(begin...)"
+  debug_info "Make ssh key(begin...)"
   su nutchuser -c 'ssh-keygen -t rsa -f ~/.ssh/id_rsa -P ""'
   su nutchuser -c "cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys"
   su nutchuser -c "ssh-add /home/nutchuser/.ssh/id_rsa"
-  debug_echo "Make ssh key(done!)"
+  debug_info "Make ssh key(done!)"
 }
 
 
 function set_haoop-site () {
-  debug_echo "set hadoop-site.xml(begin...)"
+  debug_info "set hadoop-site.xml(begin...)"
   cd $Nutch_HOME/conf/
   cat > hadoop-site.xml << EOF
@@ -140,38 +147,49 @@
 </configuration>
 EOF
-  debug_echo "set hadoop-site.xml(done!)"
+  debug_info "set hadoop-site.xml(done!)"
 }
 
 # 修改nutch-site.xml中-http.agent.url, http.agent.email
 function set_nutch-site () {
-  debug_echo "set nutch-site.xml(begin...)"
+  debug_info "set nutch-site.xml(begin...)"
   Line_NO=`cat $Nutch_HOME'/conf/nutch-site.xml' | grep -n 'http.agent.url' | sed 's/:.*//g'`
-  debug_echo "debug...http.agent.url line number = $Line_NO..."
+  debug_info "debug...http.agent.url line number = $Line_NO..."
   sed -i ''$((Line_NO+1))'d' $Nutch_HOME/conf/nutch-site.xml
-  debug_echo "debug...edit http.agent.url delete line $((Line_NO+1))..."
+  debug_info "debug...edit http.agent.url delete line $((Line_NO+1))..."
   sed -i ''$Line_NO'a <value>'$MasterIP_Address'</value>' $Nutch_HOME/conf/nutch-site.xml
-  debug_echo "debug...edit http.agent.url done..."
+  debug_info "debug...edit http.agent.url done..."
 
   Line_NO=`cat $Nutch_HOME'/conf/nutch-site.xml' | grep -n 'http.agent.email' | sed 's/:.*//g'`
-  debug_echo "debug...http.agent.email line number = $Line_NO..."
+  debug_info "debug...http.agent.email line number = $Line_NO..."
 
   sed -i ''$((Line_NO+1))'d' $Nutch_HOME/conf/nutch-site.xml
-  debug_echo "debug...edit http.agent.email delete line $((Line_NO+1))..."
+  debug_info "debug...edit http.agent.email delete line $((Line_NO+1))..."
   sed -i ''$Line_NO'a <value>'$Admin_email'</value>' $Nutch_HOME/conf/nutch-site.xml
-  debug_echo "debug...edit http.agent.email done..."
-  debug_echo "set nutch-site.xml(done!)"
+  debug_info "debug...edit http.agent.email done..."
+  debug_info "set nutch-site.xml(done!)"
 }
 
 function format_HDFS () {
-  debug_echo "format HDFS..."
+  debug_info "format HDFS..."
   su nutchuser -c "$Nutch_HOME/bin/hadoop namenode -format"
 }
 
 function start_up_NutchEZ (){
-  debug_echo "start up NutchEZ..."
+  debug_info "start up NutchEZ..."
   su nutchuser -c "$Nutch_HOME/bin/start-all.sh"
 }
 
+
+function set_hosts () {
+  Line_NO=`cat /etc/hosts | grep -n $(hostname) | sed 's/:.*//g'`
+  content=$(cat /etc/hosts | awk 'NR=='$Line_NO'{printf "# " ; print}' )
+  sed -i ""$Line_NO"c $content" /etc/hosts
+  sed -i '1i '$MasterIP_Address' '$(hostname)'' /etc/hosts
+}
+
 function Install_Nutch () {
+  debug_info "MasterIP_Address=$MasterIP_Address"
+  debug_info "Master_Hostname=$(hostname)"
+  set_hosts
   set_haoop-site
   set_nutch-site
@@ -182,9 +200,9 @@
   cd $Start_PATH
   Line_NO=`cat client_install | grep -n '# Master IP here' | sed 's/:.*//g'`
-  debug_echo "debug...Master IP here line number = $Line_NO..."
+  debug_info "debug...Master IP here line number = $Line_NO..."
   sed -i ''$((Line_NO+1))'d' client_install
-  debug_echo "debug...edit Master IP at line $((Line_NO+1))..."
+  debug_info "debug...edit Master IP at line $((Line_NO+1))..."
   sed -i ''$Line_NO'a Master_IP_Address='$MasterIP_Address'' client_install
-  debug_echo "edit client_install done..."
+  debug_info "edit client_install done..."
 }
 
@@ -193,9 +211,9 @@
   cd $Start_PATH
   Line_NO=`cat client_install | grep -n '# Master Hostname here' | sed 's/:.*//g'`
-  debug_echo "debug...Master hostname here line number = $Line_NO..."
+  debug_info "debug...Master hostname here line number = $Line_NO..."
   sed -i ''$((Line_NO+1))'d' client_install
-  debug_echo "debug...edit Master Hostname at line $((Line_NO+1))..."
+  debug_info "debug...edit Master Hostname at line $((Line_NO+1))..."
   sed -i ''$Line_NO'a Master_Hostname='$(hostname)'' client_install
-  debug_echo "edit client_install done..."
+  debug_info "edit client_install done..."
 }
 
@@ -207,9 +225,9 @@
   # 將Master_IP_Address給client
   # 打包安裝目錄(不含tomcat)
-  echo "function make_client_install..."
+  debug_info "function make_client_install..."
   client_PassMasterIPAddr
   client_PassMaster_Hostname
   cd /opt/nutchez/
-  su nutchuser -c "tar -cvzf NutchezForClientOf_$Master_IP_Address.tar.gz  nutch"
+  su nutchuser -c "tar -cvzf NutchezForClientOf_"$MasterIP_Address".tar.gz  nutch"
   
   # 複製檔案至$User_HOME/source目錄下
@@ -219,8 +237,14 @@
 
 function start_up_tomcat () {
-  debug_echo "start up tomcat..."
-  sleep 10s
+  debug_info "start up tomcat..."
+  i=10
+  until [ $i -lt 1 ]
+    do
+      sleep 1s
+      debug_info "wait $i sec..."
+      i=`expr $i - 1`
+    done
   su nutchuser -c "$Tomcat_HOME/bin/startup.sh"
-  debug_echo "tomcat has been started..."
+  debug_info "tomcat has been started..."
 }
 
@@ -228,9 +252,9 @@
 # client簡易步驟
 function client_install_command () {
-  echo "Client Install Command as Follows:"
-  echo "cd ~"
-  echo "mkdir nutchez_client_install"
-  echo "cd nutchez_client_install"
-  echo "scp nutchuser@masterIP:/home/nutchuser/nutchez/source/* ."
-  echo "./client_install"
-}
+  show_info "Client Install Command as Follows:"
+  show_info "cd ~"
+  show_info "mkdir nutchez_client_install"
+  show_info "cd nutchez_client_install"
+  show_info "scp nutchuser@$Master_IP_Address:/home/nutchuser/nutchez/source/* ."
+  show_info "./client_install"
+}
