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