-
Notifications
You must be signed in to change notification settings - Fork 3
/
bootstrap.sh
executable file
·46 lines (36 loc) · 1.04 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
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
set -e
set -x
ISO="http://boot.ipxe.org/ipxe.iso"
NATNET_NAME="warewulf-natnet"
NATNET_PREFIX="192.168"
NATNET_SUBNET="15"
NATNET_NETWORK="${NATNET_PREFIX}.${NATNET_SUBNET}.0/24"
# Download iPXE ISO to support warewulf bzImage
mkdir -p iso
pushd ./iso
test -f "$(basename "${ISO}")" || curl -LOR "$ISO"
popd
# Add vagrant plugins
set +e
vagrant plugin list | grep -q "vagrant-reload"
ret=$?
set -e
if [[ $ret -ne 0 ]]; then
vagrant plugin install vagrant-reload
fi
# Add VirtualBox NAT Network
# NOTE: This needs something to detect natnetwork SUBNET collision with any
# existing natnetwork along with auto-modification or notice to modify
# vagrant-settings.yaml appropriately.
set +e
VBoxManage list natnets | grep "${NATNET_NAME}" >/dev/null 2>&1
ret=$?
set -e
if [[ $ret -ne 0 ]]; then
VBoxManage natnetwork add --netname "${NATNET_NAME}" --network "${NATNET_NETWORK}" --enable --dhcp off
VBoxManage natnetwork start --netname "${NATNET_NAME}"
else
printf "NAT network %s already exists.\n" "${NATNET_NAME}"
fi
exit 0