-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·38 lines (33 loc) · 894 Bytes
/
setup.sh
File metadata and controls
executable file
·38 lines (33 loc) · 894 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
# Resolve symlinks so this script works when invoked via npm's .bin/ shim
SCRIPT_PATH="${BASH_SOURCE[0]}"
while [ -L "$SCRIPT_PATH" ]; do
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
SCRIPT_PATH="$(readlink "$SCRIPT_PATH")"
[[ $SCRIPT_PATH != /* ]] && SCRIPT_PATH="$SCRIPT_DIR/$SCRIPT_PATH"
done
REPO_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
SETUP_DIR="${REPO_DIR}/scripts/setup"
run_setup() {
local script="$1"
shift || true
if [[ ! -f "${SETUP_DIR}/${script}" ]]; then
echo "ERROR: missing setup script: ${SETUP_DIR}/${script}" >&2
exit 1
fi
VIBEGUARD_REPO_DIR="${REPO_DIR}" bash "${SETUP_DIR}/${script}" "$@"
}
case "${1:-}" in
--check)
shift || true
run_setup "check.sh" "$@"
;;
--clean)
shift || true
run_setup "clean.sh" "$@"
;;
*)
run_setup "install.sh" "$@"
;;
esac