1 | #!/bin/bash |
---|
2 | # Program: |
---|
3 | # Path DRBL evironment to support Xen/KVM |
---|
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] |
---|
12 | source functions_drbl_virt |
---|
13 | source /opt/drbl-virt/conf/drbl-virt.conf |
---|
14 | |
---|
15 | # [Main] |
---|
16 | |
---|
17 | # = 1. Patch DRBL xen env for client = |
---|
18 | # == Shutdown all drbl client == |
---|
19 | echo "Please check all client are shutdown !!!" |
---|
20 | read -p "Push 'Enter' to continue......" |
---|
21 | |
---|
22 | # == Change xen kernel for drbl client == |
---|
23 | check_xen_nu |
---|
24 | Xen_Kernel=$(echo $Xen_Kernel | sed 's/^vmlinuz-//g' ) |
---|
25 | echo "/opt/drbl/sbin/drblsrv-offline -s $Xen_Kernel" |
---|
26 | #/opt/drbl/sbin/drblsrv-offline -s $Xen_Kernel |
---|
27 | echo "" |
---|
28 | |
---|
29 | # == Re-delpoy drbl client == |
---|
30 | echo "Re-delpoy drbl client" |
---|
31 | echo "/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf" |
---|
32 | #/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf |
---|
33 | echo "" |
---|
34 | |
---|
35 | # == Copy xen image to /tftpboot/nbi_img/ == |
---|
36 | echo "copy Xen image & Kernel to /tftpboot/nbi_img/" |
---|
37 | #cp /boot/*xen* /tftpboot/nbi_img/ |
---|
38 | #cp /boot/vmlinuz-${Xen_Kernel} /tftpboot/nbi_img/ |
---|
39 | #cp /boot/initrd.img-${Xen_Kernel} /tftpboot/nbi_img/ |
---|
40 | #cp /boot/config-${Xen_Kernel} /tftpboot/nbi_img/ |
---|
41 | echo "" |
---|
42 | |
---|
43 | # == Modify PXE booting menu == |
---|
44 | # backup generate-pxe-menu |
---|
45 | #cp /tftpboot/nbi_img/pxelinux.cfg/default /tftpboot/nbi_img/pxelinux.cfg/default.drbl-virt_bak |
---|
46 | #cp /opt/drbl/sbin/generate-pxe-menu /opt/drbl/sbin/generate-pxe-menu.drbl_virt_bak |
---|
47 | generate_PXE_menu="/opt/drbl/sbin/generate-pxe-menu" |
---|
48 | declare -i modify_line=$(cat -n $generate_PXE_menu | grep 'label drbl' | awk 'NR==1 {print $1}') |
---|
49 | # modify menu |
---|
50 | sed -i "${modify_line}i\label drbl-virt" $generate_PXE_menu |
---|
51 | modify_line=$modify_line+1 |
---|
52 | sed -i "${modify_line}i\ MENU DEFAULT" $generate_PXE_menu |
---|
53 | modify_line=$modify_line+1 |
---|
54 | sed -i "${modify_line}i\ MENU LABEL DRBL-Virtualization ($Xen, $Xen_Kernel)" $generate_PXE_menu |
---|
55 | modify_line=$modify_line+1 |
---|
56 | sed -i "${modify_line}i\ kernel mboot.c32" $generate_PXE_menu |
---|
57 | modify_line=$modify_line+1 |
---|
58 | sed -i "${modify_line}i\ append $Xen --- vmlinuz-pxe --- initrd-pxe.img devfs=nomount drblthincli=off selinux=0 nomodeset" $generate_PXE_menu |
---|
59 | modify_line=$modify_line+1 |
---|
60 | sed -i "${modify_line}i\ TEXT HELP" $generate_PXE_menu |
---|
61 | modify_line=$modify_line+1 |
---|
62 | sed -i "${modify_line}i\ ENDTEXT" $generate_PXE_menu |
---|
63 | modify_line=$modify_line+1 |
---|
64 | sed -i "${modify_line}i\ " $generate_PXE_menu |
---|
65 | |
---|
66 | |
---|
67 | # = 2. Patch DRBL initrd to support bridge = |
---|
68 | # == Patch /usr/bin/mkpxeinitrd-net (1)modules (2)xen network scripts == |
---|
69 | |
---|
70 | |
---|
71 | # == Copy xen netwrok scripts == |
---|
72 | |
---|
73 | # == run xen network scripts (/usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init) == |
---|
74 | |
---|
75 | |
---|
76 | |
---|