#!/bin/bash
# 語言的選擇
# source ./language_choise.sh
# 匯入功能函數
source ./install_func.sh
source ./client_install_func.sh
### real code #####
main () {
  check_root
  check_systemInfo
  check_nez_installed
  #check_sunJava
  #check_ssh
  #check_dialog
  #check_php

  #set install mode
  set_install_information
  show_info
  read -p "Please confirm your install infomation: 1.Yes 2.No  " confirm
  if [ $confirm -eq 1 ]; then

    # create_nutchuser_account
    # make_ssh_key
  
    # 解壓縮
    # tar -zxvf nutchez-0.2-20100524.tar.gz 
    # mv -r nutchez /opt/
    Install_Nutch
    Install_Tomcat
    # chown -R nutchuser:nutchuser /opt/nutchez
    # make_client_install

    format_HDFS
    start_up_NutchEZ
    start_up_tomcat

    # 安裝流程結束，並進入網頁管理頁面設定爬網網址...等  
    echo "Install Successfully!!"
    echo "Visit http://$MasterIP_Address:8080"
  elif [ $confirm -eq 2 ]; then
    main
  fi
}

main
