forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 2
/
configgen.sh
executable file
·46 lines (39 loc) · 1.07 KB
/
configgen.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -e
CONFIGGEN="$1"
shift
TARGETFILE="$1"
shift
OUT_DIR="$1"
shift
mkdir -p "$OUT_DIR/certs"
mkdir -p "$OUT_DIR/lib"
mkdir -p "$OUT_DIR/protos"
if [[ "$CONFIGGEN" != "NO_CONFIGGEN" ]]; then
"$CONFIGGEN" "$OUT_DIR"
fi
for FILE in "$@"; do
case "$FILE" in
*.pem|*.der)
cp "$FILE" "$OUT_DIR/certs"
;;
*.lua|*.wasm|*.so)
cp "$FILE" "$OUT_DIR/lib"
;;
*.pb)
cp "$FILE" "$OUT_DIR/protos"
;;
*)
FILENAME="$(echo "$FILE" | sed -e 's/.*examples\///g')"
# Configuration filenames may conflict. To avoid this we use the full path.
cp "$FILE" "$OUT_DIR/${FILENAME//\//_}"
;;
esac
done
# tar is having issues with -C for some reason so just cd into OUT_DIR.
# Ignore files that don't exist so this script works for both core and contrib.
# shellcheck disable=SC2046
# shellcheck disable=SC2035
# TODO(mattklein123): I can't make this work when using the shellcheck suggestions. Try
# to fix this.
(cd "$OUT_DIR"; tar -hcf "$TARGETFILE" -- $(ls *.yaml certs/*.pem certs/*.der protos/*.pb lib/*.so lib/*.wasm lib/*.lua 2>/dev/null))