From 80c5962dba7f5ecd6b602aecd0df479bd04391b1 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Thu, 17 Feb 2022 13:46:51 -0500 Subject: Add containers-common spec and command to podman Since containers-common package is tied to specific versions of Podman, add tools to build the package into the contrib directory This should help other distributions to figure out which commont package to ship. Signed-off-by: Daniel J Walsh --- contrib/containers-common/containers-common.sh | 56 ++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 contrib/containers-common/containers-common.sh (limited to 'contrib/containers-common/containers-common.sh') diff --git a/contrib/containers-common/containers-common.sh b/contrib/containers-common/containers-common.sh new file mode 100755 index 000000000..9e7b445eb --- /dev/null +++ b/contrib/containers-common/containers-common.sh @@ -0,0 +1,56 @@ +#!/usr/bin/bash -e +# +# Script used for downloading man pages and config files from +# github.com/containers libraries (storage, common, image) +# +# Must be run from directory containing input specfile +# + +die() { + echo "$(basename $0): $*" >&2 + exit 1 +} + +branchversion() { + gomod=$(git rev-parse --show-toplevel)/go.mod + v=$(awk -v X=github.com/containers/$1 '$1 ~ X { print $2 }' <$gomod) + hash=$(expr "$v" : "v.*-[0-9.]\+-\([0-9a-f]\+\)") + if [[ -n "$hash" ]]; then + v="$hash" + fi + echo "$v" +} + + +SPECFILE=containers-common.spec +if [[ ! -e $SPECFILE.in ]]; then + die "Please run me from the same directory as $SPECFILE.in" +fi + +declare -A moduleversion +for module in common image storage; do + v=$(branchversion $module) + if [[ -z "$v" ]]; then + die "Could not find version for module '$v'" + fi + moduleversion[$module]=$v +done + +builddir=containers-common-${moduleversion[common]} +mkdir -p $builddir + +sed -e "s/COMMON_BRANCH/${moduleversion[common]}/g" \ + -e "s/IMAGE_BRANCH/${moduleversion[image]}/g" \ + -e "s/STORAGE_BRANCH/${moduleversion[storage]}/g" \ + <$SPECFILE.in >$builddir/$SPECFILE + +cd $builddir +spectool -fg $SPECFILE + +if [[ ! -e storage.conf ]]; then + die "spectool did not pull storage.conf" +fi + +echo "Changing storage.conf..." +sed -i -e 's/^driver.*=.*/driver = "overlay"/' -e 's/^mountopt.*=.*/mountopt = "nodev,metacopy=on"/' \ + storage.conf -- cgit v1.2.3-54-g00ecf