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
7d010a
      echo "$2 = $3" >> $1
fa61e0
    fi
fa61e0
  fi
fa61e0
}
fa61e0
fa61e0
#./pyxis.sh
fa61e0
#./update-vendored.sh
fa61e0
spectool -f -g containers-common.spec
7d010a
for FILE in *; do
7d010a
  [ -s "$FILE" ]
7d010a
  if [ $? == 1 ] && [ "$FILE" != "sources" ]; then
7d010a
    echo "empty file: $FILE"
7d010a
    exit 1
7d010a
  fi
7d010a
done
fa61e0
ensure storage.conf    driver                        \"overlay\"
fa61e0
ensure storage.conf    mountopt                      \"nodev,metacopy=on\"
fa61e0
if pwd | grep rhel-8 > /dev/null
fa61e0
then
7d010a
awk -i inplace '/#default_capabilities/,/#\]/{gsub("#","",$0)}1' containers.conf
462880
ensure registries.conf unqualified-search-registries [\"registry.access.redhat.com\",\ \"registry.redhat.io\",\ \"docker.io\"]
fa61e0
ensure registries.conf short-name-mode               \"permissive\"
fa61e0
ensure containers.conf runtime                       \"runc\"
617262
ensure containers.conf events_logger                 \"file\"
617262
ensure containers.conf log_driver                    \"k8s-file\"
0106cf
ensure containers.conf network_backend               \"cni\"
7d010a
if ! grep \"NET_RAW\" containers.conf > /dev/null
7d010a
then
7d010a
  sed -i '/^default_capabilities/a \
7d010a
  "NET_RAW",' containers.conf
7d010a
fi
fa61e0
else
462880
ensure registries.conf unqualified-search-registries [\"registry.access.redhat.com\",\ \"registry.redhat.io\",\ \"docker.io\"]
fa61e0
ensure registries.conf short-name-mode               \"enforcing\"
fa61e0
ensure containers.conf runtime                       \"crun\"
fa61e0
fi
7d010a
[ `grep \"keyctl\", seccomp.json | wc -l` == 0 ] && sed -i '/\"kill\",/i \
fa61e0
				"keyctl",' seccomp.json
7d010a
[ `grep \"socket\", seccomp.json | wc -l` == 0 ] && sed -i '/\"socketcall\",/i \
fa61e0
				"socket",' seccomp.json