Changeset 150 for nutchez-0.2/src


Ignore:
Timestamp:
Jun 3, 2010, 5:17:27 PM (14 years ago)
Author:
shunfa
Message:

加入多張網卡時ip設定

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

Legend:

Unmodified
Added
Removed
  • nutchez-0.2/src/test/install

    r146 r150  
    66source ./client_install_func.sh
    77### real code #####
     8
     9# 前置作業
     10# *.sh及nutchez-0.2-0531.tar.gz均在同一目錄下
    811
    912# 執行環境檢查
  • nutchez-0.2/src/test/install_func.sh

    r144 r150  
    2626  set_nutchuser_passwd
    2727  read -p "Please enter Administrator's e-mail address: " Admin_email
    28   read -p "Please enter the Master DNS:  " MasterDNS
     28  select_eth
     29  MasterIP_Address=$net_address
     30  # read -p "Please enter the Master DNS:  " MasterDNS
    2931}
    3032
     
    3739}
    3840
     41
     42function select_eth () {
     43  net_interfaces=$(ifconfig | grep ^eth | cut -d " " -f1)
     44  net_nu=$(echo $net_interfaces | wc -w)
     45
     46  # 若只有一個 eth 時
     47  if [ "$net_nu" == "1" ]; then
     48    ifconfig $net_interfaces | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1
     49    net_address=$(ifconfig $net_interfaces | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1)
     50  #  echo "net_address is $net_address"
     51
     52  # 若有多個 eth 時
     53  else
     54    declare -i i=1
     55    echo -e "\nSystem have multiple network device, which network use for this machine: "
     56
     57    for net in $net_interfaces
     58      do
     59        echo "($i)  $net  $(ifconfig $net | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1)"
     60        i=i+1
     61      done
     62
     63      read -p "Plz choice(1/2/3...): " net_choice
     64    if [ -z $net_choice ]; then
     65      net_choice=1
     66    fi
     67
     68    echo "Your choice is $net_choice"
     69    net_interface=$(echo $net_interfaces | cut -d " " -f $net_choice)
     70    ifconfig $net_interface | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1
     71    net_address=$(ifconfig $net_interface | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1)
     72    echo "net_address is $net_address"
     73  fi
     74}
     75
     76
    3977function show_info () {
    4078  echo "Administrator's e-mail address is $Admin_email."
    41   echo "The master DNS is: $MasterDNS"
     79  echo "The Master IP Address is: $MasterDNS"
    4280}
    4381
     
    132170}
    133171
     172# client簡易步驟
    134173function client_install_command () {
    135   WhereAmI=pwd
    136174  echo "Client Install Command as Follows:"
    137175  echo "cd ~"
    138176  echo "mkdir NutchezClientInstall"
    139   echo "scp $WhereAmI/* ~/NutchezClientInstall"
     177  echo "scp 安裝的shell檔所在路徑/PATH/ ~/NutchezClientInstall"
    140178  echo "./client_install"
    141179}
Note: See TracChangeset for help on using the changeset viewer.