-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·51 lines (38 loc) · 896 Bytes
/
setup.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
#!/usr/bin/env bash
# utilities
get_os() {
local os=""
local kernelName=""
kernelName="$(uname -s)"
if [ "$kernelName" == "Darwin" ]; then
os="macos"
elif [ "$kernelName" == "Linux" ] && \
[ -e "/etc/os-release" ]; then
os="$(. /etc/os-release; printf "%s" "$ID")"
else
os="$kernelName"
fi
printf "%s" "$os"
}
# run installer for the specific OS
main() {
local OS
OS="$(get_os)"
src_dir="$(cd "$(dirname "$0")" >/dev/null 2>&1; pwd -P)/src"
dst_dir="${1:-$HOME}"
if [ ! -d "$src_dir/$OS" ]; then
echo >&2 "=> Installer not found for '$OS'"
exit 2
fi
echo ""
echo "=> Set destination to '$dst_dir'"
echo "=> Running installer for '$OS'"
echo ""
"$src_dir/$OS/main.sh" "$src_dir" "$dst_dir"
echo ""
echo "=> Close and reopen your terminal allowing"
echo "=> the changes to take effect"
echo ""
return
}
main "$@"