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 | ;; |
---|
24 | # for Debian |
---|
25 | "Debian") |
---|
26 | # check xen package |
---|
27 | check_debian_xen_pkg="" |
---|
28 | check_debian_xen |
---|
29 | #echo $check_debian_xen_pkg |
---|
30 | |
---|
31 | if [ $check_debian_xen_pkg == "no" ]; then |
---|
32 | echo -e "Don'f find Xen package, please check APT sources.list" |
---|
33 | exit 0 |
---|
34 | fi |
---|
35 | |
---|
36 | # check bit |
---|
37 | echo $Linux_bit | grep 64 > /dev/null |
---|
38 | if [ $? == 0 ]; then |
---|
39 | Linux_bit="amd64" |
---|
40 | else |
---|
41 | Linux_bit="686" |
---|
42 | fi |
---|
43 | |
---|
44 | # check version |
---|
45 | echo $Linux_Version | grep "^5" > /dev/null |
---|
46 | if [ $? == 0 ]; then |
---|
47 | hypervisior="" |
---|
48 | check_hypervisior |
---|
49 | #echo $hypervisior |
---|
50 | |
---|
51 | if [ $hypervisior == "Xen" ]; then |
---|
52 | echo "" |
---|
53 | echo "[Install Xen Hypervisior]" |
---|
54 | echo "" |
---|
55 | aptitude install xen-linux-system-2.6.26-2-xen-${Linux_bit} xen-tools bridge-utils python-xml ipcalc xtightvncviewer |
---|
56 | cp $Work_Home/conf/debian-lenny_xend-config.sxp /etc/xen/xend-config.sxp |
---|
57 | if [ $1 == "stop" ]; then |
---|
58 | echo "" |
---|
59 | echo "DRBL server default will not enabled xend." |
---|
60 | echo "DRBL client default will enabled xend." |
---|
61 | update-rc.d xend remove |
---|
62 | update-rc.d xendomains remove |
---|
63 | elif [ $1 == "start" ]; then |
---|
64 | update-rc.d xend defaults |
---|
65 | update-rc.d xendomains defaults |
---|
66 | fi |
---|
67 | |
---|
68 | else |
---|
69 | aptitude install kvm |
---|
70 | fi |
---|
71 | |
---|
72 | fi |
---|
73 | ;; |
---|
74 | # for Fedora |
---|
75 | "Fedora") |
---|
76 | echo "Only support Debain" |
---|
77 | ;; |
---|
78 | *) |
---|
79 | echo "Only support Debain" |
---|
80 | ;; |
---|
81 | esac |
---|
82 | |
---|