forked from openSUSE/obs-build
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_container_package_list
More file actions
executable file
·39 lines (31 loc) · 1.03 KB
/
create_container_package_list
File metadata and controls
executable file
·39 lines (31 loc) · 1.03 KB
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
#!/bin/bash
qf='[%{NAME}|%{EPOCH}|%{VERSION}|%{RELEASE}|%{ARCH}|%{DISTURL}|%{LICENSE}\n]'
if test "$1" = "--summaries" ; then
qf='[%{NAME}|%{EPOCH}|%{VERSION}|%{RELEASE}|%{ARCH}|%{SUMMARY}\n]'
shift
fi
container="$1"
if test -z "$container" ; then
echo "usage: create_container_package_list [--summaries] <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
if test -x "$tmpdir/unpack/rootfs/usr/bin/rpm" ; then
chroot $tmpdir/unpack/rootfs rpm -qa --qf "$qf"
else
rpm --root "$tmpdir/unpack/rootfs" -qa --qf "$qf"
fi