-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase
73 lines (61 loc) · 999 Bytes
/
base
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
function echoerr {
echo -e "\033[31m$1\033[39m"
}
function echoinfo {
echo -e "\033[34m$1\033[39m"
}
function echosuccess {
echo -e "\033[32m$1\033[39m"
}
function echook {
echosuccess "OK"
}
function backup {
if [ "$DT_BACKUP" == "true" ]; then
if [ -f "$1" ]; then
mv "$1" "$1.old"
fi
fi
}
function try_clone {
if [ ! -d "$2" ]; then
git clone "$1" "$2"
fi
}
# Exit if any command fails
set -e
. ./config
if [ -f /etc/os-release ]; then
distro=$(cat /etc/os-release | grep "^ID=" | sed 's/ID=//g')
else
# Might be mac
if [ "$(uname -s)" == "Darwin" ]; then
distro="darwin"
else
distro="unknown"
fi
fi
case $distro in
arch)
;;
ubuntu)
;;
darwin)
;;
*)
echo
echoerr "Unknown OS, exiting."
exit 1
;;
esac
if [[ "$DT_BACKUP" == t* ]]; then
DT_BACKUP="true"
elif [[ "$DT_BACKUP" == f* ]]; then
DT_BACKUP="false"
else
echo
echoerr "Unknown value for DT_BACKUP, exiting."
exit 1
fi
DT_DIR="$HOME/.devtools"