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