-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·77 lines (64 loc) · 2.01 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
#!/bin/bash -e
git submodule init && git submodule update
echo "Linking files..."
BASEDIR="$(cd "$(dirname $0)" && pwd)"
mkdir -p "$HOME/bin"
function link()
{
SOURCE=$1
DEST=$2
DESTDIR=$(dirname "$DEST")
error="\033[31m"
okay="\033[32m"
reset="\033[0m"
if [[ ! -d "$HOME/$DESTDIR" ]]; then
mkdir -p "$HOME/$DESTDIR"
fi
echo -n "Linking '$SOURCE' to '$HOME/$DEST' ... "
if [[ -f "$HOME/$DEST" ]]; then
echo -e "$error" "exists already" "$reset"
else
ln "$BASEDIR/$SOURCE" "$HOME/$DEST"
echo -e "$okay" "linked" "$reset"
fi
}
function add_to_crontab()
{
if ! crontab -l | grep -F "$1" >/dev/null; then
echo -e "$okay" "adding $1 to crontab" "$reset"
(crontab -l 2>/dev/null; echo "$1") | crontab -
fi
}
function add_line_to_file()
{
if ! grep -F "$2" "$1" >/dev/null; then
echo -e "$okay" "adding $2 to $1" "$reset"
echo >> "$1" "$2"
fi
}
link dunst/dunstrc .config/dunst/dunstrc
link misc/xmodmap .xmodmap
link misc/ydl bin/ydl
link misc/dff bin/dff
link mpv/input.conf .config/mpv/input.conf
link git/gitconfig .gitconfig
link git/gitattributes .gitattributes
link git/git-rename-branch bin/git-rename-branch
link git/git-checkout-branch bin/git-checkout-branch
link git/git-overview-branches bin/git-overview-branches
link shells/bash_aliases .bash_aliases
link shells/bashrc_common .bashrc_common
mkdir -p "$HOME/.logs"
add_line_to_file "$HOME/.bashrc" "test -e \"$HOME/.bashrc_common\" && . \"$HOME/.bashrc_common\""
add_line_to_file "$HOME/.bashrc" "test -e \"$HOME/.bashrc_local\" && . \"$HOME/.bashrc_local\""
mkdir -p "$HOME/.rubies/"
link ruby/install-stable.sh .rubies/install-stable.sh
link ruby/install-jruby.sh .rubies/install-jruby.sh
mkdir -p "$HOME/.vim/swap_files"
mkdir -p "$HOME/.vim/undo_files"
mkdir -p "$HOME/.vim/autoload/"
link vim/vimrc .vimrc
link vim/neovim_init.vim .config/nvim/init.vim
link vim/vim-plug.vim .vim/autoload/plug.vim
link vim/create-vim-backup-directory.sh bin/create-vim-backup-directory.sh
add_to_crontab "*/10 * * * * $HOME/bin/create-vim-backup-directory.sh"