-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·52 lines (39 loc) · 1015 Bytes
/
bootstrap.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
48
49
50
51
52
#!/usr/bin/env bash
set -o nounset -o pipefail -o errexit
if [[ ${TRACE:-0} == "1" ]]; then
set -o xtrace
fi
main() {
local REMOTE_DEPENDENCIES_URL="https://raw.githubusercontent.com/ViBiOh/scripts/main/"
local SCRIPTS_PATH="./scripts"
printf -- "Bootstrapping to %s\n" "${SCRIPTS_PATH}"
local SCRIPTS_CLEAN
OPTIND=0
while getopts ":c" option; do
case "${option}" in
c)
SCRIPTS_CLEAN="true"
;;
:)
printf -- "option -%s requires a value\n" "${OPTARG}" >&2
return 1
;;
\?)
printf -- "option -%s is invalid\n" "${OPTARG}" >&2
return 2
;;
esac
done
shift $((OPTIND - 1))
if [[ ${SCRIPTS_CLEAN:-} == "true" ]]; then
rm -rf "${SCRIPTS_PATH}"
fi
mkdir -p "${SCRIPTS_PATH}"
(
cd "${SCRIPTS_PATH}"
curl --disable --silent --show-error --location --max-time 30 --output "./meta" -- "${REMOTE_DEPENDENCIES_URL}/functions/meta"
source "./meta" && meta_init "${@}"
)
}
shift $((OPTIND - 1))
main "${@}"