-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·53 lines (44 loc) · 1.22 KB
/
install.sh
File metadata and controls
executable file
·53 lines (44 loc) · 1.22 KB
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
#!/bin/bash
# Ask Y/n
function ask() {
read -p "$1 (Y/n): " resp
if [ -z "$resp" ]; then
response_lc="y" # empty is Yes
else
response_lc=$(echo "$resp" | tr '[:upper:]' '[:lower:]') # case insensitive
fi
[ "$response_lc" = "y" ]
}
# Check what shell is being used
SH="${HOME}/.bashrc"
ZSHRC="${HOME}/.zshrc"
if [ -f "$ZSHRC" ]; then
SH="$ZSHRC"
fi
echo >> $SH
echo '# -------------- bartekspitza:dotfiles install ---------------' >> $SH
# Ask which files should be sourced
echo "Do you want $SH to source: "
for file in shell/*; do
if [ -f "$file" ]; then
filename=$(basename "$file")
if ask "${filename}?"; then
echo "source $(realpath "$file")" >> "$SH"
fi
fi
done
echo '# -------------- bartekspitza:dotfiles install ---------------' >> $SH
# Tmux conf
if ask ".tmux.conf?"; then
ln -s "$(realpath ".tmux.conf")" ~/.tmux.conf
fi
# Vim conf
if ask ".vimrc?"; then
ln -s "$(realpath ".vimrc")" ~/.vimrc
fi
# i3 WM
if ask "i3 and related config files?"; then
ln -s "$(realpath "i3.config")" ~/.config/i3/config
ln -s "$(realpath "i3status.config")" ~/.config/i3status/config
ln -s "$(realpath "dunst.config")" ~/.config/dunst/dunstrc
fi