Ignore:
Timestamp:
Aug 10, 2010, 4:40:41 PM (14 years ago)
Author:
rock
Message:

Add: Check for Xen & kernel version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • drbl-virt/sbin/functions_drbl_virt

    r171 r172  
    9797function check_xen_nu(){
    9898Kernels=$(ls /boot | grep vmlinuz)
     99declare -i Kernels_nu=$(echo $Kernels | wc -w)
    99100Kernel_choose=""
     101
     102Xens=$(ls /boot | grep -i ^xen)
     103declare -i Xen_nu=$(echo $Xen | wc -w)
     104Xen_choose=""
     105
    100106jude="no"
    101107
     
    103109do
    104110    declare -i i=1
     111    declare -i j=1
    105112    echo ""
    106113   
    107     for Kernel in $Kernels
    108     do
    109         echo "($i) $Kernel"
    110         i=i+1
    111     done
     114    if [ $Kernels_nu -gt 1  ]; then
     115        for Kernel in $Kernels
     116        do
     117            echo "($i) $Kernel"
     118            i=i+1
     119        done
    112120
    113     read -p "Xen Kenrel is (1/2/...): " Kernel_choose
     121        read -p "Xen Kenrel is (1/2/...): " Kernel_choose
     122        Xen_Kernel=$(echo $Kernels | cut -d " " -f${Kernel_choose})
     123
     124    else
     125        Xen_Kernel=$Kernels
     126    fi
     127
     128    if [ $Xen_nu -gt 1  ]; then
     129        for Xen in $Xens
     130        do
     131            echo "($i) $Xen"
     132            j=j+1
     133        done
     134
     135        read -p "Xen is (1/2/...): " Xen_choose
     136        Xen=$(echo $Xens | cut -d " " -f${Xen_choose})
     137    else
     138        Xen=$Xens
     139    fi
     140
    114141    read -p "Are you sure (yes/no): " jude
    115142done
    116143
    117 Xen_Kernel=$(echo $Kernels | cut -d " " -f${Kernel_choose})
     144
    118145#echo "debug: Xen_Kernel=$Xen_Kernel"
    119146}
Note: See TracChangeset for help on using the changeset viewer.