ebafa994f23555aaf444e2e3a29a32c4653514c7
[releng/builder.git] / vagrant / docker / bootstrap.sh
1 #!/bin/bash
2
3 # vim: sw=4 ts=4 sts=4 et :
4
5 rh_changes() {
6     # make sure we're fully updated
7     echo "---> Updating OS"
8     yum clean all
9     yum update -y -q
10
11     # install docker and enable it
12     echo "---> Installing docker"
13     yum 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     # configure docker daemon to listen on port 5555 enabling remote
23     # managment
24     sed -i -e "s#='--selinux-enabled'#='--selinux-enabled -H unix:///var/run/docker.sock -H tcp://0.0.0.0:5555'#g" /etc/sysconfig/docker
25
26     # docker group doesn't get created by default for some reason
27     groupadd docker
28 }
29
30 ubuntu_changes() {
31     # make sure we're fully updated
32     echo "---> Updating OS"
33     apt-get update
34     apt-get upgrade -y -qq
35 }
36
37 OS=`/usr/bin/facter operatingsystem`
38 case "$OS" in
39     CentOS|Fedora|RedHat)
40         rh_changes
41     ;;
42     Ubuntu)
43         ubuntu_changes
44     ;;
45     *)
46         echo "${OS} has no configuration changes"
47     ;;
48 esac
49
50 echo "***************************************************"
51 echo "*   PLEASE RELOAD THIS VAGRANT BOX BEFORE USE     *"
52 echo "***************************************************"