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