forked from ceph/teuthology
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap
executable file
·120 lines (114 loc) · 4.1 KB
/
bootstrap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/sh
set -e
if [ $# -eq 0 ]; then
install=false
else
if [ "$1" = "install" ]; then
install=true
else
echo "Invalid command, supported commands are: 'install'"
exit 1
fi
fi
case "$(uname -s)" in
Linux)
case "$(lsb_release --id --short)" in
Ubuntu|Debian)
# Note that we install the system version of python-libvirt here
# instead of relying on PyPI for that particular module. THe reason for
# this is that Ubuntu Precise ships libvirt 0.9.8, and PyPI's
# python-libvirt packages require libvirt >= 1.0.2.
# Some options for resolving this situation would be choosing some or
# all of the following:
# A) Removing support for Precise,
# B) Removing support for downburst,
# C) Adding "Precise" conditionals somewhere, eg. conditionalizing
# this bootstrap script to only use the python-libvirt package on
# Ubuntu Precise.
for package in qemu-utils python-dev libssl-dev python-pip python-virtualenv libev-dev python-libvirt libmysqlclient-dev libffi-dev libyaml-dev ; do
if [ "$(dpkg --status -- $package|sed -n 's/^Status: //p')" != "install ok installed" ]; then
# add a space after old values
missing="${missing:+$missing }$package"
fi
done
if [ -n "$missing" ]; then
echo "$0: missing required packages:" 1>&2
echo "$missing"
if [ "$install" = true ]; then
echo "Installing missing packages..."
sudo apt-get -y install $missing
else
echo "Please install missing packages or run './bootstrap install' if you have sudo"
echo "sudo apt-get -y install $missing"
exit 1
fi
fi
;;
Fedora)
for package in python-pip python-virtualenv libev-devel libvirt-python community-mysql-devel libffi-devel; do
if [ "$(rpm -q $package)" == "package $package is not installed" ]; then
missing="${missing:+$missing }$package"
fi
done
if [ -n "$missing" ]; then
echo "$0: missing required packages:" 1>&2
echo "$missing"
if [ "$install" = true ]; then
echo "Installing missing packages..."
sudo yum -y install $missing
else
echo "Please install missing packages or run './bootstrap install' if you have sudo"
echo "sudo yum -y install $missing"
exit 1
fi
fi
;;
"openSUSE project"|"SUSE LINUX")
for package in python-pip python-virtualenv libev-devel libvirt-python libmysqlclient-devel libffi-devel; do
if [ "$(rpm -q $package)" == "package $package is not installed" ]; then
missing="${missing:+$missing }$package"
fi
done
if [ -n "$missing" ]; then
echo "$0: missing required packages, please install them:" 1>&2
echo "sudo zypper install $missing"
exit 1
fi
;;
*)
echo "This script does not support your Linux distribution yet. Patches encouraged!"
exit 1
;;
esac
;;
Darwin)
if ! which brew > /dev/null; then
echo "You need Homebrew: http://brew.sh/"
exit 1
fi
for keg in python libvirt libev mysql; do
if brew list $keg >/dev/null 2>&1; then
echo "Found $keg"
else
brew install $keg
fi
done
;;
*)
echo "This script does not support your OS yet. Patches encouraged!"
exit 1
;;
esac
if [ -z "$NO_CLOBBER" ] || [ ! -e ./virtualenv ]; then
if ! which virtualenv > /dev/null; then
pip install virtualenv
fi
# site packages needed because libvirt python bindings are not nicely
# packaged
virtualenv --system-site-packages --setuptools virtualenv
# avoid pip bugs
./virtualenv/bin/pip install --upgrade pip
# work-around change in pip 1.5
./virtualenv/bin/pip install 'setuptools<18.6' --no-use-wheel --upgrade
fi
./virtualenv/bin/pip install --upgrade -r requirements.txt