source: drbl-virt/sbin/drbl_xen_patch.sh @ 247

Last change on this file since 247 was 221, checked in by rock, 14 years ago

Bugfix: fix copy sequence

  • Property svn:executable set to *
File size: 3.2 KB
RevLine 
[161]1#!/bin/bash
2# Program:
[210]3#   Patch DRBL evironment to support Xen
[161]4# Author:
5#   Jazz, Rock {jazz, rock}@nchc.org.tw
6# Version:
7#    1.0
8# History:                                                                                         
9#   2010/07/20  Rock    First release (1.0)
10
11# [Source]
[171]12source /opt/drbl-virt/conf/drbl-virt.conf
[175]13source $Work_Path/functions_drbl_virt
[161]14
15# [Main]
16
[171]17# = 1. Patch DRBL xen env for client =
18# == Shutdown all drbl client ==
[215]19echo -e "\nPlease shutdown all drbl client !!!"
20echo "You can use /opt/drbl/sbin/dcs to shutdown."
[213]21read -p "Push [Enter] to continue......"
[161]22
[171]23# == Change xen kernel for drbl client ==
24check_xen_nu
25Xen_Kernel=$(echo $Xen_Kernel | sed 's/^vmlinuz-//g' )
[188]26echo $Xen_Kernel > $Work_Home/etc/Xen_Kernel
[171]27# == Copy xen image to /tftpboot/nbi_img/ ==
28echo "copy Xen image & Kernel to /tftpboot/nbi_img/"
[174]29cp /boot/*xen* /tftpboot/nbi_img/
30cp /boot/vmlinuz-${Xen_Kernel} /tftpboot/nbi_img/
31cp /boot/initrd.img-${Xen_Kernel} /tftpboot/nbi_img/
32cp /boot/config-${Xen_Kernel} /tftpboot/nbi_img/
[171]33echo ""
34
35# == Modify PXE booting menu ==
[184]36# if menu doesn't has drbl-virt, then add it
[187]37cat /opt/drbl/sbin/generate-pxe-menu | grep "label drbl-virt" >> /dev/null
[184]38if [  $? != 0 ]; then
[173]39# backup generate-pxe-menu
[174]40cp /tftpboot/nbi_img/pxelinux.cfg/default /tftpboot/nbi_img/pxelinux.cfg/default.drbl-virt_bak
41cp /opt/drbl/sbin/generate-pxe-menu /opt/drbl/sbin/generate-pxe-menu.drbl-virt_bak
[184]42
[173]43generate_PXE_menu="/opt/drbl/sbin/generate-pxe-menu"
44declare -i modify_line=$(cat -n $generate_PXE_menu | grep 'label drbl' | awk 'NR==1 {print $1}')
[177]45# delete default
[189]46sed -i 's/^  MENU DEFAULT/  # MENU DEFAULT/g' $generate_PXE_menu
[173]47# modify menu
48sed -i "${modify_line}i\label drbl-virt" $generate_PXE_menu
49modify_line=$modify_line+1
50sed -i "${modify_line}i\  MENU DEFAULT" $generate_PXE_menu
51modify_line=$modify_line+1
[178]52sed -i "${modify_line}i\  # MENU HIDE" $generate_PXE_menu
53modify_line=$modify_line+1
[173]54sed -i "${modify_line}i\  MENU LABEL DRBL-Virtualization ($Xen, $Xen_Kernel)" $generate_PXE_menu
55modify_line=$modify_line+1
56sed -i "${modify_line}i\  kernel mboot.c32" $generate_PXE_menu
57modify_line=$modify_line+1
58sed -i "${modify_line}i\  append $Xen --- vmlinuz-pxe --- initrd-pxe.img devfs=nomount drblthincli=off selinux=0 nomodeset" $generate_PXE_menu
59modify_line=$modify_line+1
60sed -i "${modify_line}i\  TEXT HELP" $generate_PXE_menu
61modify_line=$modify_line+1
62sed -i "${modify_line}i\  ENDTEXT" $generate_PXE_menu
63modify_line=$modify_line+1
64sed -i "${modify_line}i\ " $generate_PXE_menu
[184]65fi
[171]66
67# = 2. Patch DRBL initrd to support bridge =
[174]68# == Patch /usr/bin/mkpxeinitrd-net (1)Xen network scripts (2)command (3)modules ==
[184]69# backup mkpxeinitrd-net. if already has "drbl-virt add", dones't sed
[217]70source $Work_Path/drbl_bridge_xen_patch
[171]71
[178]72# = 3. enable xend xendomains daemon in DRBL Client =
73if [ -e /opt/drbl/conf/client-extra-service ]; then
[219]74    grep 'service_extra_added="xend xendomains"' /opt/drbl/conf/client-extra-service
75    if [ $? -eq 1 ]; then
76        echo 'service_extra_added="xend xendomains"' >> /opt/drbl/conf/client-extra-service
77    fi
[178]78else
79    echo 'service_extra_added="xend xendomains"' > /opt/drbl/conf/client-extra-service
80fi
[175]81
[185]82# = 4. enable xend xendomains daemon afterr drblpush =
[178]83# /opt/drbl/sbin/drbl-client-service xend on
84
[185]85
Note: See TracBrowser for help on using the repository browser.