-
Notifications
You must be signed in to change notification settings - Fork 164
/
Copy pathrebuild.sh
executable file
·47 lines (33 loc) · 1.03 KB
/
rebuild.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
47
#!/bin/bash -e
set -o pipefail
REBUILD_SCRIPT="https://raw.githubusercontent.com/envoyproxy/toolshed/refs/heads/main/sh/watch.sh"
# X-platform implementaion of working `realpath`
get_realpath() {
if command -v realpath >/dev/null 2>&1; then
realpath "$1" 2>/dev/null || echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
else
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
fi
}
REBUILD="~/.cache/envoy-website/watch.sh)"
CURRENT_DIR="$(get_realpath $(dirname "${BASH_SOURCE[0]}"))"
BUILD_SCRIPT="${CURRENT_DIR}/build-website.sh"
if [[ -n "$DEBUG" ]]; then
BAZEL_BUILD_OPTIONS+=" --config=debug"
fi
download_script () {
if [[ -e "$REBUILD" ]]; then
echo "Using cached watch.sh ($REBUILD)"
return
fi
rebuild_dir="$(dirname "$REBUILD")"
mkdir -p "$rebuild_dir"
echo "Downloading: ${REBUILD_SCRIPT}"
curl -sL "$REBUILD_SCRIPT" > "$REBUILD"
chmod +x "$REBUILD"
}
rebuild () {
download_script
"$REBUILD" "${CURRENT_DIR}/site" "$BUILD_SCRIPT"
}
rebuild