-
Notifications
You must be signed in to change notification settings - Fork 3
/
bootstrap
executable file
·43 lines (33 loc) · 1.28 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
#!/bin/bash
# Bootstrap the setup of chef on the current host.
set -o errexit -o pipefail -o nounset
if [ "$EUID" -ne 0 ]; then
echo "This script must be run as root."
exit 1
fi
# Source configuration file
config_file="$(dirname "${BASH_SOURCE[0]}")/configuration.bash"
if [ ! -r "$config_file" ]; then
echo "Could not read configuration file '$config_file'."
echo "Copy one from '${config_file}.example'."
exit 1
fi
. "$config_file"
echo "Installing curl and git"
apt-get update
apt-get install -y curl git
# Create a tempfile so the user has the opportunity to review the omnitruck script.
omnitruck_script="$(mktemp --suffix=.bash)"
curl -L 'https://omnitruck.cinc.sh/install.sh' > "$omnitruck_script"
if [ -z "${RUN_OMNITRUCK:-}" ]; then
echo "This script uses the omnitruck installation from the https://cinc.sh"
echo "The omnitruck install script has been downloaded to $omnitruck_script"
echo "You may wish to review the script in another terminal before running it"
read -rsp "Press enter to run the installation script or ^C to exit." _discard
fi
# If no chef version then defaults to 17
CHEF_VERSION="${CHEF_VERSION:=17}"
# Fresh arg will override configuration values
CHEF_VERSION="${1:-$CHEF_VERSION}"
bash "$omnitruck_script" -v "$CHEF_VERSION"
echo "Chef bootstrap complete"