forked from mikeyp-dell/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·34 lines (32 loc) · 1.02 KB
/
bootstrap.sh
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
#!/bin/bash
set -e
# Figure out what we are running on.
if [[ -f /etc/system-release ]]; then
read DISTRIB_ID _t DISTRIB_RELEASE rest < /etc/system-release
elif [[ -f /etc/os-release ]]; then
. /etc/os-release
DISTRIB_ID="$ID"
DISTRIB_RELEASE="$VERSION_ID"
elif [[ -f /etc/lsb-release ]]; then
. /etc/lsb-release
else
echo "Cannot figure out what we are running on!"
fi
DISTRIB_ID="${DISTRIB_ID,,}"
OS_TOKEN="$DISTRIB_ID-$DISTRIB_RELEASE"
export OS_TOKEN DISTRIB_ID DISTRIB_RELEASE
if [[ -f bootstrap/${OS_TOKEN}.lib.sh ]]; then
. "bootstrap/${OS_TOKEN}.lib.sh"
elif [[ -f bootstrap/${DISTRIB_ID}.lib.sh ]]; then
. "bootstrap/${DISTRIB_ID}.lib.sh"
else
echo "Cannot source a bootstrap library for $OS_TOKEN!"
exit 1
fi
which curl &>/dev/null || \
install_prereqs
which chef-solo &>/dev/null || \
curl -L https://www.opscode.com/chef/install.sh | bash
chef-solo -c /opt/opencrowbar/core/bootstrap/chef-solo.rb -o 'recipe[crowbar-bootstrap]' && exit 0
echo "Chef-solo bootstrap run failed"
exit 1