github.com/containers/podman/v4@v4.9.4/contrib/cirrus/logcollector.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  set -e
     4  
     5  # shellcheck source=contrib/cirrus/lib.sh
     6  source $(dirname $0)/lib.sh
     7  
     8  req_env_vars CIRRUS_WORKING_DIR OS_RELEASE_ID
     9  
    10  # Assume there are other log collection commands to follow - Don't
    11  # let one break another that may be useful, but also keep any
    12  # actual script-problems fatal so they are noticed right away.
    13  showrun() {
    14      echo '+ '$(printf " %q" "$@")
    15      set +e
    16      echo '------------------------------------------------------------'
    17      "$@"
    18      local status=$?
    19      [[ $status -eq 0 ]] || \
    20          echo "[ rc = $status -- proceeding anyway ]"
    21      echo '------------------------------------------------------------'
    22      set -e
    23  }
    24  
    25  case $1 in
    26      audit)
    27          case $OS_RELEASE_ID in
    28              debian) showrun cat /var/log/kern.log ;;
    29              fedora) showrun cat /var/log/audit/audit.log ;;
    30              *) bad_os_id_ver ;;
    31          esac
    32          ;;
    33      df) showrun df -lhTx tmpfs ;;
    34      journal) showrun journalctl -b ;;
    35      podman) showrun ./bin/podman system info ;;
    36      packages)
    37          # These names are common to Fedora and Debian
    38          PKG_NAMES=(\
    39                      buildah
    40                      conmon
    41                      containernetworking-plugins
    42                      containers-common
    43                      criu
    44                      crun
    45                      golang
    46                      podman
    47                      runc
    48                      skopeo
    49                      slirp4netns
    50          )
    51          case $OS_RELEASE_ID in
    52              fedora)
    53                  cat /etc/fedora-release
    54                  PKG_LST_CMD='rpm -q --qf=%{N}-%{V}-%{R}-%{ARCH}\n'
    55                  PKG_NAMES+=(\
    56                      aardvark-dns
    57                      container-selinux
    58                      libseccomp
    59                      netavark
    60                      passt
    61                  )
    62                  ;;
    63              debian)
    64                  cat /etc/issue
    65                  PKG_LST_CMD='dpkg-query --show --showformat=${Package}-${Version}-${Architecture}\n'
    66                  PKG_NAMES+=(\
    67                      cri-o-runc
    68                      libseccomp2
    69                  )
    70                  ;;
    71              *) bad_os_id_ver ;;
    72          esac
    73          echo "Kernel: " $(uname -r)
    74          echo "Cgroups: " $(stat -f -c %T /sys/fs/cgroup)
    75          # Any not-present packages will be listed as such
    76          $PKG_LST_CMD "${PKG_NAMES[@]}" | sort -u
    77          ;;
    78      time)
    79          # Assumed to be empty/undefined outside of Cirrus-CI (.cirrus.yml)
    80          # shellcheck disable=SC2154
    81          if [[ -r "$STATS_LOGFILE" ]]; then cat "$STATS_LOGFILE"; fi
    82          ;;
    83      *) die "Warning, $(basename $0) doesn't know how to handle the parameter '$1'"
    84  esac