forked from crowbar/crowbar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·45 lines (36 loc) · 1.17 KB
/
install
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
#!/bin/bash
set -e
[[ $DEBUG ]] && export DEBUG
(( $UID == 0)) || {
echo "You must run this script as root!"
exit 1
}
# Figure out what OS we are running on.
if [[ -f /etc/centos-release ]] && grep -q '6\.2' /etc/centos-release; then
OUR_OS=centos-6.2
elif [[ -f /etc/redhat-release ]] && grep -q '6\.2' /etc/redhat-release; then
OUR_OS=redhat-6.2
elif [[ -f /etc/lsb-release ]]; then
. /etc/lsb-release
if [[ $DISTRIB_CODENAME = precise ]]; then
OUR_OS=ubuntu-12.04
fi
fi
if [[ ! $OUR_OS ]]; then
echo "This OS is not supported."
exit 1
fi
# Install prerequisites needed to run the dev tool
# Also adds repos that let us fetch nginx and the Chef bits we need.
./install-prereqs $OUR_OS || exit 1
if [[ ! -f /tftpboot/discovery/initrd0.img ]]; then
sudo mkdir -p /tftpboot/discovery
./build_sledgehammer.sh || exit 1
for f in vmlinuz0 initrd0.img pxelinux.cfg; do
sudo mv ~/.crowbar-build-cache/tftpboot/$f /tftpboot/discovery
done
sudo rm -rf "$HOME/.crowbar-build-cache"
fi
# Initialize ourselves and pull down the barclamps we need.
while ! ./dev switch; do sleep 5; done
./install-crowbar $OUR_OS || exit 1