Index: /nutchez-0.1/bin/nutchez
===================================================================
--- /nutchez-0.1/bin/nutchez	(revision 68)
+++ /nutchez-0.1/bin/nutchez	(revision 69)
@@ -4,16 +4,11 @@
 # Description: Eazily use for Nutch
 # .
-export NUTCH_CONF_DIR=~/.nutchez
-NUTCHEZ_SCRIPT_PATH="${NUTCHEZ_SCRIPT_PATH:-/opt/nutch}"
 
-. ./nutchez-func.sh
+# begining ..
+bin=`dirname "$0"`
+bin=`cd "$bin"; pwd`
 
-
-# root ?
-#check_if_root
-
-# show url lists
-
-setup_nutchez
+. "$bin"/nutchez-func.sh
+init_nutchez
 
 CHECK=0
Index: /nutchez-0.1/bin/nutchez-func.sh
===================================================================
--- /nutchez-0.1/bin/nutchez-func.sh	(revision 68)
+++ /nutchez-0.1/bin/nutchez-func.sh	(revision 69)
@@ -5,10 +5,23 @@
 # .
 
-. /etc/nutch/hadoop-env.sh || . $NUTCHEZ_SCRIPT_PATH/conf/hadoop-env.sh
 
 : ${DIALOG=dialog}
 
-# display more for debug
-VERB=0
+# set 1 to display more for debug, 
+VERB=1
+
+init_nutchez () {
+  if ! [ -e ~/.nutchez ] ;then
+    # copy from /etc/nutch
+    mkdir ~/.nutchez
+    cp -rf /etc/nutch/* ~/.nutchez
+    mkdir ~/.nutchez/log
+    chown -R $LOGNAME:$LOGNAME ~/.nutchez
+  fi
+  export NUTCH_CONF_DIR=~/.nutchez
+  export HADOOP_CONF_DIR=~/.nutchez
+  export HADOOP_LOG_DIR=~/.nutchez/log
+  . ~/.nutchez/hadoop-env.sh || . /etc/nutch/hadoop-env.sh
+}
 
 echo_vb () {
@@ -38,8 +51,8 @@
   echo_vb "7. chang tmp as txt"
   rm ~/.nutchez/sav/n.*.txt
-  mv /tmp/n.url.tmp ~/.nutchez/sav/
-  mv /tmp/n.robot.tmp ~/.nutchez/sav/
-  mv /tmp/n.crawler.tmp ~/.nutchez/sav/
-  mv /tmp/n.tomcat.tmp ~/.nutchez/sav/
+  mv /tmp/n.urls.tmp ~/.nutchez/sav/n.urls.txt
+  mv /tmp/n.robot.tmp ~/.nutchez/sav/n.robot.txt
+  mv /tmp/n.crawler.tmp ~/.nutchez/sav/n.crawler.txt
+  mv /tmp/n.tomcat.tmp ~/.nutchez/sav/n.tomcat.txt
 }
 
@@ -47,12 +60,4 @@
   echo_vb "7. delete tmp"
   rm /tmp/n.*.tmp
-}
-
-init_nutchez () {
-  if ! [ -e ~/.nutchez ] ;then
-    # copy from /etc/nutch
-    cp -rf /etc/nutch/* ~/.nutchez
-    chown -R $LOGNAME:$LOGNAME ~/.nutchez
-  fi
 }
 
@@ -71,5 +76,5 @@
   if [ -e ~/.nutchez/nutch-site.xml ] ; then
     # set nutch-site.xml
-    sed -ie "s/>user</>$ROBOT</" ~/.nutchez/nutch-site.xml
+    sed -i -e "4s/<value>[a-zA-Z0-9]*</<value>$ROBOT</" ~/.nutchez/nutch-site.xml
   fi
 
@@ -86,5 +91,6 @@
     fi
     # change explorer port
-    sed -ie "s/8080/>$PORT</" ~/.nutchez/tomcat/conf/server.xml
+    sed -i -e "s/<Connector port=\"[0-9]*\"/<Connector port=\"$PORT\"/" ~/.nutchez/tomcat/conf/server.xml
+  fi
 }
 
@@ -93,10 +99,10 @@
   # show urls : ok =0 ,cancel = 1
   echo_vb "2. show_urls !"
-  test_file  ~/.nutchez/sav/n.url.txt
+  test_file  ~/.nutchez/sav/n.urls.txt
   echo_vb "2.1 test_file ~/.nutchez/sav return : $?"
   # dialog begin
-  dialog  --editbox ~/.nutchez/sav/n.url.txt 16 51 2>/tmp/n.url.tmp
+  dialog  --editbox ~/.nutchez/sav/n.urls.txt 16 51 2>/tmp/n.urls.tmp
   RET=$?
-  echo_vb "2.1 cat url: `cat /tmp/n.url.tmp`"
+  echo_vb "2.1 cat url: `cat /tmp/n.urls.tmp`"
   return $RET
 }
@@ -126,9 +132,8 @@
 final_confirm () {
   echo_vb "6. final_confirm : start =0 , back =1 "
-  tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/n.finalcheck.tmp
-  #trap "rm -f $tempfile" 0 1 2 5 15
+  tempfile=/tmp/n.finalcheck.tmp
 
   echo " \n 1. The url list is : \n " > $tempfile
-  cat /tmp/n.url.tmp >> $tempfile
+  cat /tmp/n.urls.tmp >> $tempfile
   echo " \n 2. The robot name is : \n" >> $tempfile
   cat /tmp/n.robot.tmp >> $tempfile
@@ -142,5 +147,5 @@
   #read READ
   $DIALOG --title "Check It !!" --clear \
-        --yesno "$MSG" 16 51
+        --yesno "$MSG" 26 51
   RET=$?
   echo_vb "final return = $RET"
@@ -152,19 +157,26 @@
 start_crawl () {
 
-  ROBOT=`cat ~/.nutchez/sav`
-  URLS=`cat ~/.nutchez/sav`
-  DEPTH=`cat ~/.nutchez/sav`
-  PORT=`cat ~/.nutchez/sav`
+  ROBOT=`cat ~/.nutchez/sav/n.robot.txt`
+  URLS=`cat ~/.nutchez/sav/n.urls.txt`
+  DEPTH=`cat ~/.nutchez/sav/n.crawler.txt`
+  PORT=`cat ~/.nutchez/sav/n.tomcat.txt`
 
   echo_vb "7. start_crawl"
-  setup_nutch
+  setup_nutchez
   install_tomcat
-  # /opt/nutch/bin/nutch crawl ~/.nutchez/urls -dir ~/.nutchez/search -depth $DEPTH
-  echo "/opt/nutch/bin/nutch crawl ~/.nutchez/urls -dir ~/.nutchez/search -depth $DEPTH"
+  echo_vb "/opt/nutch/bin/nutch crawl ~/.nutchez/urls -dir ~/.nutchez/search -depth $DEPTH"
+  echo_vb "$NUTCH_CONF_DIR"
+  /opt/nutch/bin/nutch crawl ~/.nutchez/urls -dir ~/.nutchez/search -depth $DEPTH
 }
 
 start_tomcat () {
   echo_vb "8. start_tomcat "
-  /opt/nutch/tomcat/bin/startup.sh
+  echo_vb "/opt/nutch/tomcat/bin/startup.sh"
+  if [ -e /tmp/search ]
+    rm -rf /tmp/search
+  fi
+  ln -sf ~/.nutchez/search/ /tmp/
+  ~/.nutchez/tomcat/bin/shutdown.sh
+  ~/.nutchez/tomcat/bin/startup.sh
 }
 
@@ -173,8 +185,10 @@
   FIREFOX=`which firefox`
   RET=$?
-  if [ RET == 0 ];then 
+  if [ $RET == 0 ];then 
     $FIREFOX -D 0.0 http://localhost:$PORT
-  else
-    $DIALOG --msgbox "Congratulations! \n you can explore the url: \n  http://localhost:8080" 0 0 
+    RET=$?
+  fi
+  if ! [ $RET == 0 ];then
+    $DIALOG --msgbox "Congratulations! \n you can explore the url: \n  http://localhost:$PORT" 0 0 
   fi
 }
Index: /nutchez-0.1/debian/nutchez.postinst
===================================================================
--- /nutchez-0.1/debian/nutchez.postinst	(revision 68)
+++ /nutchez-0.1/debian/nutchez.postinst	(revision 69)
@@ -9,4 +9,5 @@
 
 ln -sf /opt/nutch/bin/nutchez /usr/local/sbin/
+ln -sf /opt/nutch/bin/nutchez-func.sh /usr/local/sbin/
 
 setup_hdfsadm_user() {
Index: /nutchez-0.1/debian/nutchez.postrm
===================================================================
--- /nutchez-0.1/debian/nutchez.postrm	(revision 68)
+++ /nutchez-0.1/debian/nutchez.postrm	(revision 69)
@@ -3,13 +3,14 @@
 echo "$1"
 
-if [ "$1" != remove ]
-then
+if [ "$1" != remove ]; then
   exit 0
 fi
 
-rm -rf /tmp/hsperfdata*
 if [ -e HOME/.nutchez ]; then
   rm -rf $HOME/.nutchez
 fi
-rm /usr/local/sbin/nutchez*
 
+rm -f /usr/local/sbin/nutchez*
+
+rm -rf /tmp/search
+
Index: /nutchez-0.1/debian/nutchez.prerm
===================================================================
--- /nutchez-0.1/debian/nutchez.prerm	(revision 68)
+++ /nutchez-0.1/debian/nutchez.prerm	(revision 69)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-/opt/nutch/bin/stop-all.sh
+#/opt/nutch/bin/stop-all.sh
 #su -c /opt/nutch/bin/stop-all.sh hdfsadm -
Index: /nutchez-0.1/tomcat/conf/server.xml
===================================================================
--- /nutchez-0.1/tomcat/conf/server.xml	(revision 68)
+++ /nutchez-0.1/tomcat/conf/server.xml	(revision 69)
@@ -20,5 +20,5 @@
      Documentation at /docs/config/server.html
  -->
-<Server port="8005" shutdown="SHUTDOWN">
+<Server port="8083" shutdown="SHUTDOWN">
 
   <!--APR library loader. Documentation at /docs/apr.html -->
@@ -65,5 +65,5 @@
          Define a non-SSL HTTP/1.1 Connector on port 8080
     -->
-    <Connector port="8080" protocol="HTTP/1.1" 
+    <Connector port="8083" protocol="HTTP/1.1" 
                connectionTimeout="20000" 
                redirectPort="8443" URIEncoding="UTF-8"
@@ -72,5 +72,5 @@
     <!--
     <Connector executor="tomcatThreadPool"
-               port="8080" protocol="HTTP/1.1" 
+               port="8083" protocol="HTTP/1.1" 
                connectionTimeout="20000" 
                redirectPort="8443" />
@@ -81,5 +81,5 @@
          described in the APR documentation -->
     <!--
-    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
+    <Connector port="8083" protocol="HTTP/1.1" SSLEnabled="true"
                maxThreads="150" scheme="https" secure="true"
                clientAuth="false" sslProtocol="TLS" URIEncoding="UTF-8"/>
@@ -87,5 +87,5 @@
 
     <!-- Define an AJP 1.3 Connector on port 8009 -->
-    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
+    <Connector port="8083" protocol="AJP/1.3" redirectPort="8443" />
 
 
Index: /nutchez-0.1/tomcat/webapps/ROOT/WEB-INF/classes/nutch-site.xml
===================================================================
--- /nutchez-0.1/tomcat/webapps/ROOT/WEB-INF/classes/nutch-site.xml	(revision 68)
+++ /nutchez-0.1/tomcat/webapps/ROOT/WEB-INF/classes/nutch-site.xml	(revision 69)
@@ -6,5 +6,5 @@
     <property>
         <name>searcher.dir</name>
-        <value>../../../../../search</value>
+        <value>/tmp/search</value>
     </property>
 </configuration>
