de7ddf
#!/bin/bash
de7ddf
# This script delivers current documentation/configs and assures it has the intended
de7ddf
# settings for a particular branch/release.
de7ddf
# For questions reach to Jindrich Novy <jnovy@redhat.com>
de7ddf
de7ddf
ensure() {
de7ddf
  if grep ^$2[[:blank:]].*= $1 > /dev/null
de7ddf
  then
de7ddf
    sed -i "s;^$2[[:blank:]]=.*;$2 = $3;" $1
de7ddf
  else
de7ddf
    if grep ^\#.*$2[[:blank:]].*= $1 > /dev/null
de7ddf
    then
de7ddf
      sed -i "/^#.*$2[[:blank:]].*=/a \
de7ddf
$2 = $3" $1
de7ddf
    else
de7ddf
      echo "$2 = \"$3\"" >> $1
de7ddf
    fi
de7ddf
  fi
de7ddf
}
de7ddf
de7ddf
#./pyxis.sh
de7ddf
#./update-vendored.sh
de7ddf
spectool -f -g containers-common.spec
de7ddf
ensure storage.conf    driver                        \"overlay\"
de7ddf
ensure storage.conf    mountopt                      \"nodev,metacopy=on\"
de7ddf
ensure containers.conf events_logger                 \"file\"
de7ddf
if pwd | grep rhel-8 > /dev/null
de7ddf
then
de7ddf
ensure registries.conf unqualified-search-registries [\"registry.fedoraproject.org\",\ \"registry.access.redhat.com\",\ \"registry.centos.org\",\ \"docker.io\"]
de7ddf
ensure registries.conf short-name-mode               \"permissive\"
de7ddf
ensure containers.conf infra_image                   \"registry.access.redhat.com/ubi8/pause\"
de7ddf
ensure containers.conf runtime                       \"runc\"
de7ddf
else
de7ddf
ensure registries.conf unqualified-search-registries [\"registry.fedoraproject.org\",\ \"registry.access.redhat.com\",\ \"registry.centos.org\",\ \"quay.io\",\ \"docker.io\"]
de7ddf
ensure registries.conf short-name-mode               \"enforcing\"
de7ddf
ensure containers.conf infra_image                   \"registry.access.redhat.com/ubi8/pause\"
de7ddf
ensure containers.conf runtime                       \"crun\"
de7ddf
fi
de7ddf
[ `grep "keyctl" seccomp.json | wc -l` == 0 ] && sed -i '/\"kill\",/i \
de7ddf
				"keyctl",' seccomp.json
de7ddf
sed -i '/\"socketcall\",/i \
de7ddf
				"socket",' seccomp.json
de7ddf
if ! grep \"NET_RAW\" containers.conf > /dev/null
de7ddf
then
de7ddf
  sed -i '/^default_capabilities/a \
de7ddf
    "NET_RAW",' containers.conf
de7ddf
fi