28 lines
658 B
Bash
Executable File
28 lines
658 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Process a toolbox tarball to get vendored dependencies for the RHEL build.
|
|
#
|
|
# Yaakov Selkowitz <yselkowi@redhat.com> - 2022
|
|
|
|
SOURCE="$1"
|
|
DIRECTORY=`echo $SOURCE | sed 's/\.tar\.xz//'`
|
|
VENDOR_SOURCE="${DIRECTORY}-vendor.tar.xz"
|
|
|
|
error()
|
|
{
|
|
MESSAGE=$1
|
|
echo $MESSAGE
|
|
exit 1
|
|
}
|
|
|
|
rm -rf $DIRECTORY
|
|
tar xJf $SOURCE || error "Cannot unpack $SOURCE"
|
|
pushd $DIRECTORY/src > /dev/null || error "Cannot open directory \"$DIRECTORY\""
|
|
|
|
echo "Vendoring dependencies"
|
|
go mod vendor || error "Vendoring failed"
|
|
popd > /dev/null
|
|
|
|
tar cJf $VENDOR_SOURCE -C $DIRECTORY src/vendor || error "Unable to create $VENDOR_SOURCE"
|
|
echo "$VENDOR_SOURCE is ready to use"
|