2022-06-01 13:17:49 -07:00
|
|
|
#!/usr/bin/env bash
|
2026-05-11 20:53:55 -07:00
|
|
|
# Copyright IBM Corp. 2020, 2026
|
2023-01-03 17:19:20 -05:00
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
|
2022-06-01 13:17:49 -07:00
|
|
|
#
|
|
|
|
|
# This script builds the required plugins.
|
|
|
|
|
set -e
|
|
|
|
|
|
2022-06-06 11:28:24 -07:00
|
|
|
if [[ -z "$GOOS" ]]; then
|
|
|
|
|
echo "Must provide GOOS in environment" 1>&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ -z "GOARCH" ]]; then
|
|
|
|
|
echo "Must provide GOARCH in environment" 1>&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2022-06-01 13:17:49 -07:00
|
|
|
BINARY_SUFFIX=""
|
|
|
|
|
if [ "${GOOS}x" = "windowsx" ]; then
|
|
|
|
|
BINARY_SUFFIX=".exe"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Get the parent directory of where this script is.
|
|
|
|
|
SOURCE="${BASH_SOURCE[0]}"
|
|
|
|
|
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
|
|
|
|
|
export DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
|
|
|
|
|
|
2022-06-06 11:28:24 -07:00
|
|
|
echo "==> Building kms plugins for ${GOOS}-${GOARCH}..."
|
|
|
|
|
rm -f $DIR/plugins/kms/assets/${GOOS}/${GOARCH}/boundary-plugin-kms-*
|
2022-06-01 13:17:49 -07:00
|
|
|
for CURR_PLUGIN in $(ls $DIR/plugins/kms/mains); do
|
|
|
|
|
echo "==> Building $CURR_PLUGIN plugin..."
|
|
|
|
|
cd $DIR/plugins/kms/mains/$CURR_PLUGIN;
|
2022-06-06 11:28:24 -07:00
|
|
|
go build -v -o $DIR/plugins/kms/assets/${GOOS}/${GOARCH}/boundary-plugin-kms-${CURR_PLUGIN}${BINARY_SUFFIX} .;
|
2022-06-01 13:17:49 -07:00
|
|
|
cd $DIR;
|
|
|
|
|
done;
|
2022-06-06 11:28:24 -07:00
|
|
|
cd $DIR/plugins/kms/assets/${GOOS}/${GOARCH};
|
|
|
|
|
for CURR_PLUGIN in $(ls boundary-plugin-kms-*); do
|
2022-06-01 13:17:49 -07:00
|
|
|
echo "==> gzip $CURR_PLUGIN plugin..."
|
|
|
|
|
gzip -f -9 $CURR_PLUGIN;
|
|
|
|
|
done;
|
|
|
|
|
cd $DIR;
|