Changeset 189 for nutchez-0.2/src


Ignore:
Timestamp:
Jun 15, 2010, 9:59:12 AM (14 years ago)
Author:
rock
Message:

英文版完成

Location:
nutchez-0.2/src/test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nutchez-0.2/src/test/client_install_func.sh

    r188 r189  
    2424function choose_lang(){
    2525
     26lang=$(locale | grep 'LANG=' | cut -d "=" -f2)
     27
     28# Default: source english
     29. lang_en_US_client_install
     30# if locale is zh then source chinese
     31echo $lang | grep 'zh' && source lang_zh_TW_nutchez
     32
     33# Ask language
    2634echo -e "\n$choose_lang_1"
    2735read -p "$choose_lang_2 " langChoice
     
    7785# 目前先檢查是否有/opt/nutchez 這個資料夾即可
    7886function check_nez_installed(){
    79   debug_info "chcheck_nez_installed"
     87  debug_info "$check_nez_1"
    8088  if [ -d /opt/nutchez ]; then
    81     show_info "System already had NutchEz."
    82     exit
    83   else
    84     show_info "System does not has NutchEz."
     89    show_info "$check_nez_2"
     90    exit
     91  else
     92    show_info "$check_nez_3"
    8593  fi
    8694}
     
    9199# (3)系統有安裝但Sun Java 在非預設路徑下 (4)以正確安裝 Sun JAVA 預設路徑下
    92100function check_sunJava(){
    93   debug_info "check_sunJava"
    94   debug_info "NutchEz need Sun Java JDK 1.6.x or above version"
     101  debug_info "$check_sunJava_1"
     102  debug_info "$check_sunJava_2"
    95103
    96104  javaPath="/usr"
     
    104112   
    105113  if [ "$JAVA_org" == "" ]; then
    106     show_info "Java is not Sun version, plz install sun Java 1.6.X"
    107     show_info "Please input your choice: "
    108     show_info "(1)System don't have Sun Java (2)Sun Java is in other path (3)Exit"
    109     read -p "plz input (1/2/3): " choice
     114    show_info "$check_sunJava_if_1"
     115    show_info "$check_sunJava_if_2"
     116    show_info "$check_sunJava_if_3"
     117    read -p "$check_sunJava_if_4" choice
    110118    case $choice  in
    111119      "1")
    112         show_info "Please install Sun Java manually!"
     120        show_info "$check_sunJava_if_5"
    113121        exit
    114122        ;;
    115123      "2")
    116         read -p "Input Sun Java home path(ex. '/usr/lib/jvm/java-6-sun-1.6.0.12' or using default '/usr' ): " javaPath
     124        read -p "$check_sunJava_if_6" javaPath
    117125        ;;
    118126        "*")
     
    127135             
    128136          if [ "$JAVA_org" == "" ]; then
    129             show_info "It is not Sun Java! Plz install Sun Java manually!"
     137            show_info "$check_sunJava_if_7"
    130138            exit
    131139            fi
     
    135143      large16=$(echo "$JAVA_version >= 1.6" | bc)
    136144      if [ "${large16}" == 0 ]; then
    137         show_info "Java version is too old (it need 1.6.X above)"
     145        show_info "$check_sunJava_if_8"
    138146        exit
    139147      fi 
    140148     
    141       show_info "System has Sun Java 1.6 above version."
    142   else
    143     show_info "Please install Sun JAVA 1.6.X or above version"
     149      show_info "$check_sunJava_if_9"
     150  else
     151    show_info "$check_sunJava_if_10"
    144152    exit
    145153  fi
     
    152160# 檢查是否有安裝openssh, openssh-server
    153161function check_ssh(){
    154   debug_info "check_ssh"
     162  debug_info "$check_ssh_1"
    155163  if [ -e /usr/bin/ssh ]; then
    156     show_info "System has ssh."
    157   else
    158     show_info "Please install ssh."
     164    show_info "$check_ssh_2"
     165  else
     166    show_info "$check_ssh_3"
    159167    exit
    160168  fi
    161169
    162170  if [ -e /usr/sbin/sshd ]; then
    163     show_info "System has ssh Server (sshd)."
    164   else
    165     show_info "Please install ssh Server (sshd)."
     171    show_info "$check_ssh_4"
     172  else
     173    show_info "$check_ssh_5"
    166174    exit
    167175  fi
     
    171179# 檢查是否有安裝dialog
    172180function check_dialog(){
    173   debug_info "check_dialog"
     181  debug_info "$check_dialog_1"
    174182  if [ -e /usr/bin/dialog ]; then
    175     show_info "System has dialog."
    176   else
    177     show_info "Please install dialog."
     183    show_info "$check_dialog_2"
     184  else
     185    show_info "$check_dialog_3"
    178186    exit
    179187  fi
     
    185193# 此步驟若無法連到 master 則跳出
    186194function scp_master_nutchuser_sshkey(){
    187   debug_info "scp_master_nutchuser_sshkey"
    188   debug_info "mkdir -p /home/nutchuser/"
     195  debug_info "$scp_sshkey_d1"
     196  debug_info "$scp_sshkey_d2"
    189197  mkdir -p /home/nutchuser/.ssh/
    190198  rm -fr /home/nutchuser/.ssh/*
    191199  unset Nutchuser_Passwd2
    192200
    193   debug_info "scp nutchuser@$1:~/.ssh /home/nutchuser/"
     201  debug_info "$scp_sshkey_d3"
    194202expect -c "spawn scp -r -o StrictHostKeyChecking=no nutchuser@$1:~/.ssh /home/nutchuser/
    195203expect \"*: \" { send \"$Nutchuser_Passwd\r\" }
    196 expect \"*: \" { send_user \"Password is error\" }
     204expect \"*: \" { send_user \"$scp_sshkey_expect_1\" }
    197205expect eof"
    198206
    199207  if [ -e "/home/nutchuser/.ssh/authorized_keys" ]; then
    200     show_info "scp correct."   
     208    show_info "$scp_sshkey_s1"   
    201209    else
    202       show_info "scp error,\n(1)plese check nutchuser password in server\n(2)nutchuser's authorized_keys in server\n(3)server's network status"
     210      show_info "$scp_sshkey_s2"
    203211    exit
    204212  fi
    205213  ssh-add /home/nutchuser/.ssh/id_rsa
    206   debug_info "chown -R nutchuser:nutchuser /home/nutchuser/.ssh"
     214  debug_info "$scp_sshkey_d4"
    207215  chown -R nutchuser:nutchuser /home/nutchuser/.ssh
    208216}
     
    210218# 新增nutchuser 帳號時用 Nutchuser_Passwd 當密碼
    211219function creat_nutchuser_account(){
    212   debug_info "creat_nutchuser_account"
     220  debug_info "$create_nutchuser_d1"
    213221  while [ "$Nutchuser_Passwd" != "$Nutchuser_Passwd2" ]
    214222  do
    215223      echo -e "\n"
    216       read -sp "Plz input nutchuser password of master node: " Nutchuser_Passwd
     224      read -sp "$create_nutchuser_1" Nutchuser_Passwd
    217225      echo
    218       read -sp "plz input nutchuser password, again: " Nutchuser_Passwd2
     226      read -sp "$create_nutchuser_2" Nutchuser_Passwd2
    219227      echo
    220228        if [ "$Nutchuser_Passwd" == "$Nutchuser_Passwd2" ]; then
    221           show_info "Two Passwords match."
     229          show_info "$create_nutchuser_3"
    222230        else
    223           show_info "Two passwords don't match, please re-input nutchuser's password."
     231          show_info "$create_nutchuser_4"
    224232        fi
    225233  done                                                                                                                                   
     
    227235
    228236  if [ $(cat /etc/passwd | grep nutchuser) ]; then
    229     show_info "System already has nutchuser, change nutchuser password."
     237    show_info "$create_nutchuser_s1"
    230238    expect -c "spawn passwd nutchuser
    231239    set timeout 1
     
    236244    expect eof"
    237245    else
    238       show_info "Create nutchuser and change password."
     246      show_info "$create_nutchuser_s2"
    239247      useradd -m nutchuser -s /bin/bash
    240248      expect -c "spawn passwd nutchuser
     
    251259# 目前僅需做到能無礙的複製遠端的/opt/nutchez/到local的/opt/
    252260function scp_packages(){
    253   debug_info "scp_packages"
     261  debug_info "$scp_packages_d1"
    254262  mkdir /opt/nutchez
    255263  mkdir /var/nutchez
     
    258266  mkdir /home/nutchuser/nutchez/system
    259267  chmod 777 /opt/nutchez
    260   debug_info "chown -R nutchuser:nutchuser /opt/nutchez"
     268  debug_info "$scp_packages_d2"
    261269  chown -R nutchuser:nutchuser /opt/nutchez
    262270  chown -R nutchuser:nutchuser /var/nutchez
    263271  chown -R nutchuser:nutchuser /home/nutchuser/nutchez
    264272  chmod 755 /opt/nutchez
    265   debug_info "scp -r nutchuser@$1:/opt/nutchez/NutchezForClientOf_$Master_IP_Address.tar.gz /home/nutchuser/nutchez/source"
     273  debug_info "$scp_packages_d3"
    266274  su nutchuser -c "scp -r -o StrictHostKeyChecking=no nutchuser@$1:/home/nutchuser/nutchez/source/NutchezForClientOf_$Master_IP_Address.tar.gz /home/nutchuser/nutchez/source"
    267275
     
    270278
    271279function install_nutch_package(){
    272   debug_info "install_nutch_package"
     280  debug_info "$install_nutch_package_d1"
    273281  tar -zxvf /home/nutchuser/nutchez/source/NutchezForClientOf_$Master_IP_Address.tar.gz -C /opt/nutchez
    274282  sed -i '1a '$Master_IP_Address' '$Master_Hostname'' /etc/hosts
     
    278286
    279287function recall_hostname_ip(){
    280   debug_info "recall_hostname_ip"
     288  debug_info "$recall_hostname_ip_d1"
    281289  net_interfaces=$(ifconfig | grep ^eth | cut -d " " -f1)
    282290  net_nu=$(echo $net_interfaces | wc -w)
     
    286294  net_address=$(ifconfig $net_interfaces | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1)
    287295  net_MacAddr=$(ifconfig $net_interfaces | grep 'HW' | sed 's/^.*HWaddr //g')
    288   show_info "net_address is $net_address"
    289   show_info "net_MacAddr is $net_MacAddr"
     296  show_info "$recall_hostname_ip_1 $net_address"
     297  show_info "$recall_hostname_ip_2 $net_MacAddr"
    290298
    291299  # 若有多個 eth 時
    292300    else
    293301      declare -i i=1
    294       show_info "System have multiple network device, which network use for this machine: "
     302      show_info "$recall_hostname_ip_3"
    295303       
    296304      for net in $net_interfaces
     
    300308      done
    301309       
    302       read -p "Please choice(1/2/3...): " net_choice
     310      read -p "$recall_hostname_ip_4" net_choice
    303311  if [ -z $net_choice ]; then
    304312    net_choice=1
     
    310318  net_address=$(ifconfig $net_interface | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1)
    311319  net_MacAddr=$(ifconfig $net_interface | grep 'HW' | sed 's/^.*HWaddr //g')
    312   show_info "net_address is $net_address"
    313   show_info "net_MacAddr is $net_MacAddr"
    314   fi
    315 
    316   debug_info "ssh nutchuser@$1 echo $net_address $(hostname) $net_MacAddr \>\> ~/nutchez/system/nutch_nodes"
     320  show_info "$recall_hostname_ip_1 $net_address"
     321  show_info "$recall_hostname_ip_2 $net_MacAddr"
     322  fi
     323
     324  debug_info "$recall_hostname_ip_d2"
    317325  su nutchuser -c "ssh nutchuser@$1 echo $net_address $(hostname) $net_MacAddr \>\> ~/nutchez/system/nutch_nodes"
    318326
  • nutchez-0.2/src/test/lang_en_US_client_install

    r188 r189  
    3636
    3737### [for check_nez_installed()] ###
     38check_nez_1="chcheck_nez_installed"
     39check_nez_2="System already had NutchEz."
     40check_nez_3="System does not has NutchEz."
    3841
    3942### [for check_sunJava()] ###
     43check_sunJava_1="check_sunJava"
     44check_sunJava_2="NutchEz need Sun Java JDK 1.6.x or above version"
     45check_sunJava_if_1="Java is not Sun version, plz install sun Java 1.6.X"
     46check_sunJava_if_2="Please input your choice: "
     47check_sunJava_if_3="(1)System don't have Sun Java (2)Sun Java is in other path (3)Exit"
     48check_sunJava_if_4="plz input (1/2/3): "
     49check_sunJava_if_5="Please install Sun Java manually!"
     50check_sunJava_if_6="Input Sun Java home path(ex. '/usr/lib/jvm/java-6-sun-1.6.0.12' or using default '/usr' ): "
     51check_sunJava_if_7="It is not Sun Java! Plz install Sun Java manually !"
     52check_sunJava_if_8="Java version is too old (it need 1.6.X above)"
     53check_sunJava_if_9="System has Sun Java 1.6 above version."
     54check_sunJava_if_10="Please install Sun JAVA 1.6.X or above version"
    4055
    4156### [for check_ssh()] ###
     57check_ssh_1="check_ssh"
     58check_ssh_2="System has ssh."
     59check_ssh_3="Please install ssh."
     60check_ssh_4="System has ssh Server (sshd)."
     61check_ssh_5="Please install ssh Server (sshd)."
    4262
    4363### [for check_dialog()] ###
     64check_dialog_1="check_dialog"
     65check_dialog_2="System has dialog."
     66check_dialog_3="Please install dialog."
     67
     68### scp_master_nutchuser_sshkey() ###
     69scp_sshkey_d1="scp_master_nutchuser_sshkey"
     70scp_sshkey_d2="mkdir -p /home/nutchuser/"
     71scp_sshkey_d3="scp nutchuser@master:~/.ssh /home/nutchuser/"
     72scp_sshkey_expect_1="Password is error"
     73scp_sshkey_s1="scp correct."
     74scp_sshkey_s2="scp error,\n(1)plese check nutchuser password in server\n(2)nutchuser's authorized_keys in server\n(3)server's network status"
     75scp_sshkey_d4="chown -R nutchuser:nutchuser /home/nutchuser/.ssh"
    4476
    4577### [for creat_nutchuser_account()] ###
     78create_nutchuser_d1="creat_nutchuser_account"
     79create_nutchuser_1="Plz input nutchuser password of master node: "
     80create_nutchuser_2="plz input nutchuser password, again: "
     81create_nutchuser_3="Two Passwords match."
     82create_nutchuser_4="Two passwords don't match, please re-input nutchuser's password."
     83create_nutchuser_s1="System already has nutchuser, change nutchuser password."
     84create_nutchuser_s2="Create nutchuser and change password."
     85
    4686### [for scp_packages()] ###
     87scp_packages_d1="scp_packages"
     88scp_packages_d2="chown -R nutchuser:nutchuser /opt/nutchez"
     89scp_packages_d3="scp -r nutchuser@\$1:/opt/nutchez/NutchezForClientOf_\$Master_IP_Address.tar.gz /home/nutchuser/nutchez/source"
     90
    4791### [for install_nutch_package()] ###
     92install_nutch_package_d1="install_nutch_package"
     93
    4894### [for recall_hostname_ip()] ###
     95recall_hostname_ip_d1="recall_hostname_ip"
     96recall_hostname_ip_1="net_address is"
     97recall_hostname_ip_2="net_MacAddr is"
     98recall_hostname_ip_3="System have multiple network device, which network use for this machine: "
     99recall_hostname_ip_4="Please choice(1/2/3...): "
     100recall_hostname_ip_d2="ssh nutchuser@\$1 echo \$net_address \$(hostname) \$net_MacAddr \>\> ~/nutchez/system/nutch_nodes"
    49101
Note: See TracChangeset for help on using the changeset viewer.