1 | #!/bin/bash |
---|
2 | # Program: |
---|
3 | # Remove DRBL virt module |
---|
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 /opt/drbl-virt/conf/drbl-virt.conf |
---|
13 | source $Work_Path/functions_drbl_virt |
---|
14 | |
---|
15 | # [Main] |
---|
16 | check_systemInfo |
---|
17 | |
---|
18 | # = 1. Install Hypervisior = |
---|
19 | case $Linux_Distribution in |
---|
20 | # for Ubuntu |
---|
21 | "Ubuntu") |
---|
22 | echo "Only support Debain" |
---|
23 | exit |
---|
24 | ;; |
---|
25 | # for Debian |
---|
26 | "Debian") |
---|
27 | # check xen package |
---|
28 | check_debian_xen_pkg="" |
---|
29 | check_debian_xen |
---|
30 | #echo $check_debian_xen_pkg |
---|
31 | |
---|
32 | if [ $check_debian_xen_pkg == "no" ]; then |
---|
33 | echo -e "Don'f find Xen package, please check APT sources.list" |
---|
34 | exit 0 |
---|
35 | fi |
---|
36 | |
---|
37 | # check bit |
---|
38 | echo $Linux_bit | grep 64 > /dev/null |
---|
39 | if [ $? == 0 ]; then |
---|
40 | Linux_bit="amd64" |
---|
41 | else |
---|
42 | Linux_bit="686" |
---|
43 | fi |
---|
44 | |
---|
45 | # check version |
---|
46 | echo $Linux_Version | grep "^5" > /dev/null |
---|
47 | if [ $? == 0 ]; then |
---|
48 | hypervisior="" |
---|
49 | check_hypervisior |
---|
50 | #echo $hypervisior |
---|
51 | |
---|
52 | if [ $hypervisior == "Xen" ]; then |
---|
53 | echo "" |
---|
54 | echo "[Install Xen Hypervisior]" |
---|
55 | echo "" |
---|
56 | aptitude install xen-linux-system-2.6.26-2-xen-${Linux_bit} xen-tools bridge-utils python-xml ipcalc xtightvncviewer sun-java6-jre |
---|
57 | |
---|
58 | # setup java |
---|
59 | update-java-alternatives -s java-6-sun |
---|
60 | |
---|
61 | cp $Work_Home/conf/debian-lenny_xend-config.sxp /etc/xen/xend-config.sxp |
---|
62 | # change java |
---|
63 | if [ $1 == "stop" ]; then |
---|
64 | echo "" |
---|
65 | echo "DRBL server default will not enabled xend." |
---|
66 | echo "DRBL client default will enabled xend." |
---|
67 | update-rc.d xend remove |
---|
68 | update-rc.d xendomains remove |
---|
69 | elif [ $1 == "start" ]; then |
---|
70 | update-rc.d xend defaults |
---|
71 | update-rc.d xendomains defaults |
---|
72 | fi |
---|
73 | |
---|
74 | else |
---|
75 | aptitude install kvm |
---|
76 | fi |
---|
77 | |
---|
78 | fi |
---|
79 | ;; |
---|
80 | # for Fedora |
---|
81 | "Fedora") |
---|
82 | echo "Only support Debain" |
---|
83 | exit |
---|
84 | ;; |
---|
85 | *) |
---|
86 | echo "Only support Debain" |
---|
87 | exit |
---|
88 | ;; |
---|
89 | esac |
---|
90 | |
---|