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