-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·129 lines (124 loc) · 2.85 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
#!/bin/sh
msg() { t=$1; shift; printf '%s: %s\n' "$t" "$@"; }
_ln_home() {
[ -z "$2" ] && tgt="$HOME/$1" || tgt="$HOME/$2"
src="$PWD/$1"
[ -e "$tgt.bak" ] && rm "$tgt.bak"
[ -e "$tgt" ] && mv "$tgt" "$tgt.bak"
ln -sf "$src" "$tgt"
}
_mkdir() {
for x; do
mkdir -p "$HOME/$x"
done
}
_vim() {
[ -n "$(command -v vim 2>/dev/null)" ] || return
msg "INSTALL" "vim config"
_ln_home "vimrc" ".vimrc"
_ln_home "vim" ".vim"
# install plugins
# vim +PlugInstall +qall
}
_xorg() {
[ -n "$(command -v Xorg 2>/dev/null)" ] || return
msg "INSTALL" "xorg config"
_ln_home "xinitrc" ".xinitrc"
_ln_home "Xresources" ".Xresources"
_ln_home "us-intl-german.xmodmap" ".us-intl-german.xmodmap"
}
_fonts() {
[ -n "$(command -v Xorg 2>/dev/null)" ] || return
msg "INSTALL" "fontconfig config"
_mkdir ".config/fontconfig"
_ln_home "fonts.conf" ".config/fontconfig/fonts.conf"
}
_mksh() {
[ -n "$(command -v mksh 2>/dev/null)" ] || return
msg "INSTALL" "mksh config"
_ln_home "mkshrc" ".mkshrc"
}
_ksh() {
[ -n "$(command -v ksh 2>/dev/null)" ] || return
msg "INSTALL" "ksh config"
_ln_home "kshrc" ".kshrc"
}
_yash() {
[ -n "$(command -v yash 2>/dev/null)" ] || return
msg "INSTALL" "yash config"
_ln_home "yashrc" ".yashrc"
}
_shell() {
msg "INSTALL" "shell config"
_ln_home "profile" ".profile"
_ln_home "inputrc" ".inputrc"
_ln_home "aliases" ".aliases"
}
_git() {
[ -n "$(command -v git 2>/dev/null)" ] || return
msg "INSTALL" "git config"
_ln_home "gitconfig" ".gitconfig"
_ln_home "gitignore_global" ".gitignore_global"
}
_void() {
[ -n "$(command -v xbps-install 2>/dev/null)" ] || return
msg "INSTALL" "void config"
_ln_home "xbps-src.conf" ".xbps-src.conf"
}
_ssh() {
[ -n "$(command -v ssh 2>/dev/null)" ] || return
msg "INSTALL" "ssh config"
mkdir -p "$HOME/.ssh"
_ln_home "ssh/config" ".ssh/config"
}
_bin() {
msg "INSTALL" "user bin directory"
_ln_home "bin"
}
_runit() {
[ -n "$(command -v runsvdir 2>/dev/null)" ] || return
msg "INSTALL" "runit user services"
_ln_home "sv"
_ln_home "service"
_ln_home "service.x"
}
_gtk() {
[ -n "$(command -v Xorg 2>/dev/null)" ] || return
msg "INSTALL" "gtk config"
_ln_home "gtkrc-2.0" ".gtkrc-2.0"
_ln_home "gtk-3.0" ".config/gtk-3.0"
}
_firefox() {
[ -n "$(command -v firefox 2>/dev/null)" ] || return
printf "INSTALL: firefox user.js for profile: "
for p in ~/.mozilla/firefox/*/; do
p="${p%/*}"; p="${p##*/}"
case "$p" in *backup*|*crashrecovery*|"") continue ;; esac
printf " %s\n" "'${p}'"
_ln_home "user.js" ".mozilla/firefox/$p/user.js"
mkdir -p "$HOME/.mozilla/firefox/$p/chrome"
_ln_home "userChrome.css" ".mozilla/firefox/$p/chrome/userChrome.css"
done
}
_tmux() {
[ -n "$(command -v tmux 2>/dev/null)" ] || return
msg "INSTALL" "tmux config"
_ln_home "tmux.conf" ".tmux.conf"
}
: ${PWD:=$(pwd)}
: ${HOME:=~}
_mksh
_ksh
_yash
_shell
_bin
_runit
_git
_xorg
_fonts
_vim
_void
_ssh
_gtk
_firefox
_tmux