summaryrefslogtreecommitdiffstats
path: root/build/honeycomb-jar-replace.sh
blob: f89ddda773ce1a0793401d5d99bb9a21d886e4e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env bash
JARS=$(find /usr/share/java/ -type f -iname 'jvpp-*.jar')
if [ -z "$JARS" ]; then
  echo "ERROR: JARS to replace from vpp-api-java are empty!"
  exit 1
fi

for JAR in $JARS; do
  JAR_PREFIX=$(basename $JAR | sed -n 's/-[0-9]\+\.[0-9]\+\.jar$//p')
  JAR_VERSION=$(basename $JAR | grep -Eo '[0-9]+.[0-9]+')
  HC_JAR_DIR=/opt/honeycomb/lib/io/fd/vpp/${JAR_PREFIX}/${JAR_VERSION}-SNAPSHOT
  if [ ! -d "$HC_JAR_DIR" ]; then
    echo "ERROR: Honeycomb JAR destination directory does not exist!"
    exit 1
  else
    cp -f ${JAR} ${HC_JAR_DIR}/${JAR_PREFIX}-${JAR_VERSION}-SNAPSHOT.jar
    echo "INFO: VPP API JAR: ${JAR} copied to ${HC_JAR_DIR}"
  fi
done