File: create_container_package_list

package info (click to toggle)
obs-build 20190710-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,660 kB
  • sloc: perl: 10,153; sh: 3,084; ansic: 284; makefile: 170
file content (28 lines) | stat: -rwxr-xr-x 778 bytes parent folder | download
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
#!/bin/bash

container="$1"

if test -z "$container" ; then
  echo "usage: create_container_package_list <container>"
  exit 1
fi
if ! test -s "$container" ; then
  echo "no such container: $container" >&2
  exit 1
fi

tmpdir=$(mktemp -d)
trap "rm -rf $tmpdir" EXIT

case "$container" in
  *.tar) cat < "$container" > $tmpdir/cont ;;
  *.tar.gz) gunzip < "$container" > $tmpdir/cont ;;
  *.tar.xz) xzdec < "$container" > $tmpdir/cont ;;
  *) echo "unsuppored container name $container" >&2 ; exit 1 ;;
esac

skopeo copy docker-archive:$tmpdir/cont oci:$tmpdir/image:latest >/dev/null
rm -f $tmpdir/cont
umoci unpack --image $tmpdir/image:latest $tmpdir/unpack >/dev/null
chroot $tmpdir/unpack/rootfs rpm -qa --qf '[%{NAME}|%{EPOCH}|%{VERSION}|%{RELEASE}|%{ARCH}|%{DISTURL}\n]'