Hello World

File create_container_package_list of Package build

#!/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
if test -x "$tmpdir/unpack/rootfs/usr/bin/rpm" ; then
    chroot $tmpdir/unpack/rootfs rpm -qa --qf '[%{NAME}|%{EPOCH}|%{VERSION}|%{RELEASE}|%{ARCH}|%{DISTURL}|%{LICENSE}\n]'
else
    rpm --root "$tmpdir/unpack/rootfs" -qa --qf '[%{NAME}|%{EPOCH}|%{VERSION}|%{RELEASE}|%{ARCH}|%{DISTURL}|%{LICENSE}\n]'
fi