Ignore:
Timestamp:
Aug 26, 2010, 2:14:50 PM (14 years ago)
Author:
rock
Message:

Modify: push arch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • drbl-virt/sbin/functions_drbl_virt

    r183 r184  
    174174fi
    175175
    176 # get eth network
    177 eth_address=$(/opt/drbl/bin/drbl-get-ipadd $eth)
    178 eth_netmask=$(/opt/drbl/bin/drbl-get-netmask $eth)
    179 eth_network=$(/opt/drbl/bin/drbl-get-network $eth_address $eth_netmask)
     176# get eth network X.X.X
    180177eth_network_f3=$(echo $eth_network | cut -d "." -f 1-3)
    181178
     
    214211    done
    215212
    216     read -p "Input Prefix name for VM for $eth (ex. drblvm): " VM_prefix_name
     213    #read -p "Input Prefix name for VM for $eth (ex. drblvm): " VM_prefix_name
     214    VM_prefix_name=$(cat /etc/drbl/drblpush.conf  | grep hostname= | sed 's/hostname=//')
    217215    read -p "Is it correct? (yes/no): " jude
    218216done
     
    238236VM_Host_totoal_nu=$((${Host_last_IP_4}-1+${VM_IP_range}))
    239237if [ -e /opt/drbl-virt/etc/IP_VM_$eth ]; then
    240     mv /opt/drbl-virt/etc/IP_VM_$eth /opt/drbl-virt/etc/IP_VM_${eth}.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak
     238    mv -f /opt/drbl-virt/etc/IP_VM_$eth /opt/drbl-virt/etc/IP_VM_${eth}.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak
    241239fi
    242240declare -i VM_IP_0=$VM_prefix_eth
     
    275273            echo "${eth_network_f3}.${VM_IP_1} ${VM_prefix_name}${VM_IP_0}${VM_IP_1}" >> /opt/drbl-virt/etc/IP_VM_$eth
    276274        fi
    277 
    278275    done
    279276
     
    297294
    298295# backup
    299 mv /opt/drbl-virt/etc/macadr-VM-$eth.txt /opt/drbl-virt/etc/macadr-VM-$eth.txt.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak
     296mv -f /opt/drbl-virt/etc/macadr-VM-$eth.txt /opt/drbl-virt/etc/macadr-VM-$eth.txt.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak
    300297
    301298# generate MAC
     
    318315    fi
    319316done
    320 
    321 
    322 }
    323 
    324 
     317}
     318
     319function add_VM_dhcpd_conf(){
     320# backup dhcpd.conf
     321if [ -e /etc/dhcp3/dhcpd.conf ]; then
     322cp -f /etc/dhcp3/dhcpd.conf /etc/dhcp3/dhcpd.conf.drbl-virt_bak
     323fi
     324
     325subnet_lines=$(cat -n /etc/dhcp3/dhcpd.conf | grep $eth_network | awk '{print $1}')
     326host_lines=$(cat -n /etc/dhcp3/dhcpd.conf | grep 'host ' | grep '{' | awk '{print $1}')
     327
     328for subnet_line in $subnet_lines
     329do
     330    host_lines cat -n /etc/dhcp3/dhcpd.conf | sed -n "$subnet_line,\$p" | grep 'host .* {' | awk '{print $1}'
     331
     332done
     333
     334}
Note: See TracChangeset for help on using the changeset viewer.