github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/.ubuntu_prepare.sh (about)

     1  #!/bin/bash
     2  set -xeuo pipefail
     3  
     4  export GOPATH=/go
     5  export PATH=$HOME/gopath/bin:$PATH:$GOPATH/bin
     6  
     7  runc=0
     8  conmon=0
     9  cni=0
    10  podman_conf=0
    11  
    12  conmon_source=/go/src/github.com/containers/conmon
    13  cni_source=/go/src/github.com/containernetworking/plugins
    14  runc_source=/go/src/github.com/opencontainers/runc
    15  podman_source=/var/tmp/checkout
    16  
    17  while getopts "cnrf" opt; do
    18      case "$opt" in
    19          c) conmon=1
    20              ;;
    21          f) podman_conf=1
    22              ;;
    23          n) cni=1
    24              ;;
    25          r) runc=1
    26              ;;
    27          *) echo "Nothing to do ... exiting."
    28              exit 0
    29              ;;
    30          esac
    31  done
    32  
    33  if [ $conmon -eq 1 ]; then
    34      # Build and install conmon from source
    35      echo "Building conmon ..."
    36      git clone http://github.com/containers/conmon $conmon_source
    37      cd $conmon_source && make install PREFIX=/usr
    38  fi
    39  
    40  
    41  if [ $cni -eq 1 ]; then
    42      # Build and install containernetworking plugins from source
    43      echo "Building containernetworking-plugins..."
    44      git clone http://github.com/containernetworking/plugins $cni_source
    45      cd $cni_source
    46      ./build.sh
    47      mkdir -p /usr/libexec/cni
    48      cp -v bin/* /usr/libexec/cni/
    49  fi
    50  
    51  
    52  if [ $runc -eq 1 ]; then
    53      # Build and install runc
    54      echo "Building runc..."
    55      git clone http://github.com/opencontainers/runc $runc_source
    56      cd $runc_source
    57      make install PREFIX=/usr
    58  fi
    59  
    60  if [ $podman_conf -eq 1 ]; then
    61      # Install various configuration files required by libpod
    62  
    63      # Install CNI conf file for podman
    64      mkdir -p /etc/cni/net.d
    65      cp -v $podman_source/cni/87-podman-bridge.conflist /etc/cni/net.d/
    66  
    67      # Install registries.conf
    68      mkdir -p /etc/containers
    69      cp -v $podman_source/test/registries.conf /etc/containers/
    70      cp -v $podman_source/test/policy.json /etc/containers/
    71  fi