Blame SOURCES/create_dependency_bundle.sh

44cbad
#!/bin/bash -eu
8f9145
8f9145
SRC=$(readlink -f "${1:?Usage: $0 source destination}")
8f9145
DEST=$(readlink -f "${2:?Usage: $0 source destination}")
8f9145
8f9145
if [ -f "$DEST" ]; then
8f9145
    echo "File $DEST exists already."
8f9145
    exit 0
8f9145
fi
8f9145
if [ "$#" -gt 2 ]; then
8f9145
    PATCHES=$(readlink -f "${@:3}")
8f9145
else
8f9145
    PATCHES=""
8f9145
fi
8f9145
44cbad
pushd "$(mktemp -d)"
8f9145
8f9145
echo Extracting sources...
44cbad
tar xfz "$SRC"
8f9145
cd grafana-pcp-*
8f9145
8f9145
echo Applying patches...
8f9145
for patch in $PATCHES
8f9145
do
8f9145
    patch -p1 < $patch
8f9145
done
8f9145
8f9145
echo Installing dependencies...
8f9145
yarn install
8f9145
8f9145
echo Removing files with licensing issues...
8f9145
rm -rf node_modules/node-notifier
8f9145
8f9145
echo Compressing...
44cbad
XZ_OPT=-9 tar cJf "$DEST" node_modules
8f9145
8f9145
popd