Refresh docker image definition
[releng/builder.git] / vagrant / docker / bootstrap.sh
1 #!/bin/bash
2
3 # vim: sw=4 ts=4 sts=4 et :
4
5 fedora_changes() {
6     # make sure we're fully updated
7     echo "---> Updating OS"
8     dnf clean all
9     dnf update -y -q
10
11     # install docker and enable it
12     echo "---> Installing docker"
13     dnf install -y docker supervisor bridge-utils
14     systemctl enable docker
15
16     # configure docker networking so that it does not conflict with LF
17     # internal networks
18     cat <<EOL > /etc/sysconfig/docker-network
19 # /etc/sysconfig/docker-network
20 DOCKER_NETWORK_OPTIONS='--bip=10.250.0.254/24'
21 EOL
22
23     # docker group doesn't get created by default for some reason
24     groupadd docker
25 }
26
27 el_changes() {
28     # make sure we're fully updated
29     echo "---> Updating OS"
30     yum clean all
31     yum update -q -y
32 }
33
34 ubuntu_changes() {
35     # make sure we're fully updated
36     echo "---> Updating OS"
37     apt-get update
38     apt-get upgrade -y -qq
39 }
40
41 OS=`/usr/bin/facter operatingsystem`
42 case "$OS" in
43     Fedora)
44         fedora_changes
45     ;;
46     Centos|RedHat)
47         el_changes
48     ;;
49     Ubuntu)
50         ubuntu_changes
51     ;;
52     *)
53         echo "${OS} has no configuration changes"
54     ;;
55 esac
56
57 echo "***************************************************"
58 echo "*   PLEASE RELOAD THIS VAGRANT BOX BEFORE USE     *"
59 echo "***************************************************"