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