diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2022-02-17 13:46:51 -0500 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2022-02-22 14:38:57 -0500 |
commit | 80c5962dba7f5ecd6b602aecd0df479bd04391b1 (patch) | |
tree | a1d7fada738182c2eb8cd6993f33625ae704ba94 /contrib/containers-common/containers-common.sh | |
parent | d3903a85910979d8212028cf814574047015db58 (diff) | |
download | podman-80c5962dba7f5ecd6b602aecd0df479bd04391b1.tar.gz podman-80c5962dba7f5ecd6b602aecd0df479bd04391b1.tar.bz2 podman-80c5962dba7f5ecd6b602aecd0df479bd04391b1.zip |
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 <dwalsh@redhat.com>
Diffstat (limited to 'contrib/containers-common/containers-common.sh')
-rwxr-xr-x | contrib/containers-common/containers-common.sh | 56 |
1 files changed, 56 insertions, 0 deletions
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 |