-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·140 lines (120 loc) · 2.49 KB
/
install.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/usr/bin/env bash
headless="false"
cronjobs="false"
targets_dir='targets'
help_msg() {
echo "Usage:"
echo " ./install.sh [target]"
echo " available targets: $(find $targets_dir -maxdepth 1 | tr '\n' ' ')"
echo ""
echo " ./install.sh -h Display this help message."
echo " ./install.sh -c Install for a headless system."
echo " ./install.sh -u Enable cron jobs for update."
}
args="$*"
for var in "$@"; do
case "$var" in
--help)
help_msg
exit 0
;;
*) ;;
esac
done
# Parse options
while getopts ":hcu" opt; do
case ${opt} in
h)
help_msg
exit 0
;;
c)
echo "Installing headless"
headless="true"
;;
u)
echo "Enabling cron jobs"
cronjobs="true"
;;
\?)
echo "Invalid Option: -$OPTARG" 1>&2
exit 1
;;
esac
done
shift $((OPTIND - 1))
echo "$args" >target
shopt -s dotglob nullglob
mkdir -p ~/.config/
mkdir -p ~/.local/etc/
mkdir -p ~/.local/bin/
mkdir -p ~/.local/share/applications
if [ ! -f ~/.local/share/nvim/site/autoload/plug.vim ]; then
curl -L -o ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
# done before target install so profile exists
stow shell
target=$1
install_target() {
if [[ -d "$targets_dir/$1" ]]; then
(cd $targets_dir && stow "$1" --target ../../)
if [[ -f ~/.profile ]]; then
\. ~/.profile
fi
extra_install_script="$1_install.sh"
if [[ -f "$targets_dir/$extra_install_script" ]]; then
./$targets_dir/$extra_install_script
fi
echo "Installing $1"
else
echo "Invalid target: $1"
exit 1
fi
}
if [[ -n $target ]]; then
install_target "$target"
else
install_target default
fi
stow bat
stow cmakelint
mkdir -p ~/.config/nvim/spell/
stow nvim
stow twmn
stow git
stow pylint
mkdir -p ~/.ssh
stow ssh
stow sshrc
# avoid tracking other files
mkdir -p ~/.cargo
stow rust
stow pacman
stow latex
mkdir -p ~/.gnupg
stow gnupg
stow lldb
stow gdb
stow ranger
stow systemd
stow jdt.ls
if [[ $headless == "false" ]]; then
echo "Installing headed"
stow compton
stow i3
stow i3status
stow misc_desktop
stow mpv
stow youtube-dl
# by default, additional files shouldn't be tracked
mkdir -p ~/.config/qutebrowser
stow qutebrowser
stow zathura
stow xfce4-terminal
ln -sfn "$PWD/keyboard" ~/
fi
systemctl --user daemon-reload
if [ ! -d ~/.zgen ]; then
git clone https://github.com/tarjoilija/zgen.git "$HOME/.zgen"
fi