File: update-config-files.sh

package info (click to toggle)
golang-github-containers-common 0.64.1%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 5,932 kB
  • sloc: makefile: 132; sh: 111
file content (49 lines) | stat: -rwxr-xr-x 1,564 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
# This script delivers current documentation/configs and assures it has the intended
# settings for a particular branch/release.

set -exo pipefail

ensure() {
  if [[ ! -f $1 ]]; then
      echo "File not found:" $1
      exit 1
  fi
  if grep ^$2[[:blank:]].*= $1 > /dev/null
  then
    sed -i "s;^$2[[:blank:]]=.*;$2 = $3;" $1
  else
    if grep ^\#.*$2[[:blank:]].*= $1 > /dev/null
    then
      sed -i "/^#.*$2[[:blank:]].*=/a \
$2 = $3" $1
    else
      echo "$2 = $3" >> $1
    fi
  fi
}

# Common options enabled across all fedora, centos, rhel
# TBD: Can these be enabled by default upstream?
ensure registries.conf              short-name-mode     \"enforcing\"

ensure storage.conf                 driver              \"overlay\"
ensure storage.conf                 mountopt            \"nodev,metacopy=on\"

ensure pkg/config/containers.conf   runtime             \"crun\"
ensure pkg/config/containers.conf   log_driver          \"journald\"

FEDORA=$(rpm --eval '%{?fedora}')
RHEL=$(rpm --eval '%{?rhel}')

# Set search registries
if [[ -n "$FEDORA" ]]; then
    ensure registries.conf unqualified-search-registries [\"registry.fedoraproject.org\",\ \"registry.access.redhat.com\",\ \"docker.io\"]
else
    ensure registries.conf unqualified-search-registries [\"registry.access.redhat.com\",\ \"registry.redhat.io\",\ \"docker.io\"]
fi

# Set these on all Fedora and RHEL 10+
if [[ -n "$FEDORA" ]] || [[ "$RHEL" -ge 10 ]]; then
    sed -i -e '/^additionalimagestores\ =\ \[/a "\/usr\/lib\/containers\/storage",' storage.conf
fi