Changeset 209


Ignore:
Timestamp:
Oct 12, 2010, 4:59:37 PM (14 years ago)
Author:
rock
Message:

Modify: divide drbl bridg patch from drbl_xen_patch.sh (drbl_bridge_patch.sh)

Location:
drbl-virt/sbin
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • drbl-virt/sbin/drbl_xen_patch.sh

    r205 r209  
    6969# == Patch /usr/bin/mkpxeinitrd-net (1)Xen network scripts (2)command (3)modules ==
    7070# backup mkpxeinitrd-net. if already has "drbl-virt add", dones't sed
    71 cat /usr/bin/mkpxeinitrd-net | grep "# drbl-virt add" >> /dev/null
    72 if [ $? != 0 ]; then
    73 cp /usr/bin/mkpxeinitrd-net /usr/bin/mkpxeinitrd-net.drbl-virt_bak
    74 # copy Xen network scripts
    75 cp /etc/xen/scripts/network-bridge /usr/lib/mkpxeinitrd-net/initrd-skel/bin/
    76 cp /etc/xen/scripts/xen-network-common.sh /usr/lib/mkpxeinitrd-net/initrd-skel/bin/
    77 cp /etc/xen/scripts/xen-script-common.sh /usr/lib/mkpxeinitrd-net/initrd-skel/bin/
    78 # patch it to copy command
    79 declare -i modify_line=$(cat -n /usr/bin/mkpxeinitrd-net | grep 'include_bin_prog_from_server=' | awk '{print $1}')
    80 modify_file="/usr/bin/mkpxeinitrd-net"
    81 sed -i "${modify_line}c\include_bin_prog_from_server='sleep lspci insmod modprobe rmmod lsmod pkill strings brctl ip egrep awk gawk seq fgrep dirname expr bash'" $modify_file
    82 sed -i "${modify_line}i# drbl-virt add" $modify_file
    83 # patch it to copy modules
    84 declare -i modify_line=$(cat -n /usr/bin/mkpxeinitrd-net | grep "# Deal with firmwares" | awk '{print $1}')
    85 sed -i "${modify_line}i# drbl-virt add" $modify_file
    86 modify_line=$modify_line+1
    87 sed -i "${modify_line}icp -a --parents kernel/net/bridge/bridge.ko \$initrd/lib/modules/\$kernel_ver/" $modify_file
    88 modify_line=$modify_line+1
    89 sed -i "${modify_line}icp -a --parents kernel/drivers/xen/netback/netloop.ko \$initrd/lib/modules/\$kernel_ver/" $modify_file
    90 
    91 # == Add start_xen_bridge.sh to run Xen network-bridge (/usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init) ==
    92 cat <<EOF >/usr/lib/mkpxeinitrd-net/initrd-skel/bin/start_xen_bridge.sh
    93 #!/bin/bash
    94 # drbl-virt add
    95 NICs=\$(/sbin/ifconfig | grep eth | awk '{print \$1}')
    96 declare -i NICs_nu=\$(echo \$NICs |wc -l)
    97 NIC=""
    98 
    99 if [ \$NICs_nu -lt 1  ]; then
    100     for (( i=0 ; i<\$NICs_nu ; i++ ))
    101     do
    102         NIC_IP=\$(ifconfig eth\${i} | grep "inet addr" | sed 's/inet addr://g' | sed 's/Bcast.*$//g')
    103         if [ -n \$NIC_IP ]; then
    104             NIC="eth\${i}"
    105             break
    106         fi
    107     done
    108 else
    109     NIC=\$NICS
    110 fi
    111 
    112 bash /bin/network-bridge start netdev=\$NIC
    113 EOF
    114 fi
    115 # == Run start_xen_bridge.sh when booting  ==
    116 cat /usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init | grep "bash /bin/start_xen_bridge.sh" >> /dev/null
    117 if [ $? != 0 ]; then
    118     # backup linuxrc-or-init
    119     cp /usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init /usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init.drbl-virt_bak
    120     declare -i modify_line=$(cat -n /usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init | grep "# clean the tag file" | awk '{print $1}')
    121     modify_file="/usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init"
    122 
    123     sed -i "${modify_line}i# drbl-virt add" $modify_file
    124     modify_line=$modify_line+1
    125     sed -i "${modify_line}ibash /bin/start_xen_bridge.sh" $modify_file
    126 fi
    127 
     71source $Work_Path/drbl_bridge_patch.sh
    12872
    12973# = 3. enable xend xendomains daemon in DRBL Client =
Note: See TracChangeset for help on using the changeset viewer.