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