summaryrefslogtreecommitdiff
path: root/.ubuntu_prepare.sh
blob: 1a5d1140fdc68eb74fe963c1559d3a4df171c86c (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
set -xeuo pipefail

export GOPATH=/go
export PATH=$HOME/gopath/bin:$PATH:$GOPATH/bin

runc=0
conmon=0
cni=0
podman_conf=0

conmon_source=/go/src/github.com/containers/conmon
cni_source=/go/src/github.com/containernetworking/plugins
runc_source=/go/src/github.com/opencontainers/runc
podman_source=/var/tmp/checkout

while getopts "cnrf" opt; do
    case "$opt" in
        c) conmon=1
            ;;
        f) podman_conf=1
            ;;
        n) cni=1
            ;;
        r) runc=1
            ;;
        *) echo "Nothing to do ... exiting."
            exit 0
            ;;
        esac
done

if [ $conmon -eq 1 ]; then
    # Build and install conmon from source
    echo "Building conmon ..."
    git clone https://github.com/containers/conmon $conmon_source
    cd $conmon_source && make install PREFIX=/usr
fi


if [ $cni -eq 1 ]; then
    # Build and install containernetworking plugins from source
    echo "Building containernetworking-plugins..."
    git clone https://github.com/containernetworking/plugins $cni_source
    cd $cni_source
    ./build.sh
    mkdir -p /usr/libexec/cni
    cp -v bin/* /usr/libexec/cni/
fi


if [ $runc -eq 1 ]; then
    # Build and install runc
    echo "Building runc..."
    git clone https://github.com/opencontainers/runc $runc_source
    cd $runc_source
    make install PREFIX=/usr
fi

if [ $podman_conf -eq 1 ]; then
    # Install various configuration files required by libpod

    # Install CNI conf file for podman
    mkdir -p /etc/cni/net.d
    cp -v $podman_source/cni/87-podman-bridge.conflist /etc/cni/net.d/

    # Install registries.conf
    mkdir -p /etc/containers
    cp -v $podman_source/test/registries.conf /etc/containers/
    cp -v $podman_source/test/policy.json /etc/containers/
fi