-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap.sh
executable file
·73 lines (63 loc) · 1.48 KB
/
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
#
# Test platforms: RHEL 6, 7, Ubuntu 16.04, 18.04, SuSE 12
# To keep it simple, this script doesn't install any package that
# should usually be installed via package manager for the distribution
#
set -e
set_log_color() {
# Use colors, but only if connected to a terminal, and that terminal
# supports them.
if which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
fi
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)"
MAGENTA="$(tput setaf 5)"
BOLD="$(tput bold)"
NORMAL="$(tput sgr0)"
else
RED=""
GREEN=""
YELLOW=""
BLUE=""
MAGENTA=""
BOLD=""
NORMAL=""
fi
}
info() {
printf "${MAGENTA}$1${NORMAL}"
}
warn() {
printf "${YELLOW}$1${NORMAL}"
}
success() {
printf "${GREEN}$1${NORMAL}"
}
main() {
DOT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
if [ ${UID-notset} = "notset" ]; then
UID=$(id -u)
fi
info "stow...\n"
if command -v stow >/dev/null 2>&1; then
STOW="stow"
elif command -v xstow >/dev/null 2>&1; then
STOW="xstow"
else
warn "command stow or xstow not found!\n"
exit 1
fi
$STOW -v -t ~ -d $DOT_ROOT dircolors emacs git tmux vim zsh
if [ "$(uname)" == "Linux" ]; then
$STOW -v -t ~ -d $DOT_ROOT x i3 urxvt dunst wayland
fi
success "[DONE]\n"
success "Please re-login to take effect.\n"
}
set_log_color
main $@