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
if pwd | grep rhel-8 > /dev/null
5dd126
then
2b1b9b
ensure registries.conf unqualified-search-registries [\"registry.access.redhat.com\",\ \"registry.redhat.io\",\ \"docker.io\"]
5dd126
ensure registries.conf short-name-mode               \"permissive\"
5dd126
ensure containers.conf runtime                       \"runc\"
21a30b
ensure containers.conf events_logger                 \"file\"
21a30b
ensure containers.conf log_driver                    \"k8s-file\"
e2e81a
ensure containers.conf network_backend               \"cni\"
5dd126
else
2b1b9b
ensure registries.conf unqualified-search-registries [\"registry.access.redhat.com\",\ \"registry.redhat.io\",\ \"docker.io\"]
5dd126
ensure registries.conf short-name-mode               \"enforcing\"
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