-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·101 lines (85 loc) · 3.41 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
#!/bin/bash --
# get directory of this install-script
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
function check_dependency() {
command -v "$1" >/dev/null 2>&1 || \
{ echo "Please install $1"; exit 1; }
}
function ask_user() {
echo "$1"
while true
do
read -p "y/n? " answer
case "$answer" in
Yes|yes|Y|y|"") "$2"
break;;
No|no|N|n)
break;;
*)
;;
esac
done
}
function symlink_develop_files() {
DEVELOP_DIR="$DOTFILES_DIR/develop"
# create config-directories
mkdir -p "$HOME"/.config
mkdir -p "$HOME"/.config/bash
# symlink non-vim-files
ln -sfv "$DEVELOP_DIR/coreutils/" "$HOME"/.config/
ln -sfv "$DEVELOP_DIR/git/" "$HOME"/.config/
ln -sfv "$DEVELOP_DIR/.latexmkrc" "$HOME"
ln -sfv "$DEVELOP_DIR/readline/" "$HOME"/.config/
ln -sfv "$DEVELOP_DIR/bash/bash_aliases" "$HOME"/.config/bash
ln -sfv "$DEVELOP_DIR/bash/bash_functions" "$HOME"/.config/bash
ln -sfv "$DEVELOP_DIR/bash/.bash_logout" "$HOME"
ln -sfv "$DEVELOP_DIR/bash/.bashrc" "$HOME"
ln -sfv "$DEVELOP_DIR/.profile" "$HOME"
ln -sfv "$DEVELOP_DIR/.vim/" "$HOME"
# make sure that other bash configuration files do not exist such that .profile
# is actually sourced for login-shells
rm -f "$HOME"/.bash_login
rm -f "$HOME"/.bash_profile
# symlink neovim-files
ln -sfv "$HOME"/.vim "$HOME"/.config/nvim
ln -sfv "$HOME"/.vim/vimrc "$HOME"/.config/nvim/init.vim
# create vim-directories
mkdir -p ~/.vim/bundle
mkdir -p ~/.cache/vim/{backup,undo,swap}
}
function symlink_desktop_files() {
DESKTOP_DIR="$DOTFILES_DIR/desktop"
mkdir -p "$HOME"/.cache/mpd/playlists
mkdir -p "$HOME"/.cache/qutebrowser
ln -sfv "$DESKTOP_DIR/abcde/.abcde.conf" "$HOME"
ln -sfv "$DESKTOP_DIR/alacritty/" "$HOME"/.config/
ln -sfv "$DESKTOP_DIR/dunst/" "$HOME"/.config/
ln -sfv "$DESKTOP_DIR/feh/" "$HOME"/.config/
ln -sfv "$DESKTOP_DIR/i3/" "$HOME"/.config/
ln -sfv "$DESKTOP_DIR/i3status/" "$HOME"/.config/
ln -sfv "$DESKTOP_DIR/mpd/" "$HOME"/.config/
ln -sfv "$DESKTOP_DIR/ncmpcpp/" "$HOME"/.config/
ln -sfv "$DESKTOP_DIR/pulse/daemon.conf" "$HOME"/.config/pulse/
ln -sfv "$DESKTOP_DIR/qutebrowser/config.py" "$HOME"/.config/qutebrowser/
ln -sfv "$DESKTOP_DIR/ranger/" "$HOME"/.config/
ln -sfv "$DESKTOP_DIR/rncbc.org/" "$HOME"/.config/
ln -sfv "$DESKTOP_DIR/xdg/user-dirs.dirs" "$HOME"/.config/
ln -sfv "$DESKTOP_DIR/.xinitrc" "$HOME"
}
function symlink_scripts() {
chmod a+x "$DOTFILES_DIR/bin/"*
ln -sfv "$DOTFILES_DIR/bin/" "$HOME"
}
# make sure that git, curl and vim are installed
for com in git curl vim; do
check_dependency "$com"
done
# do the actual symlinking
symlink_develop_files
ask_user "Do you want to symlink files for non-development purposes as well?" \
"symlink_desktop_files"
ask_user "Do you want to symlink scripts as well?" "symlink_scripts"
# install vim-plugins using vim-plug
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
vim +"PlugUpdate|qall"