aboutsummaryrefslogtreecommitdiff
path: root/install.sh
blob: 4cb63048ac7ed8ae1534ad1f8ba1051d5083acc6 (plain)
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
#!/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" ] && 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"
}

: ${PWD:=$(pwd)}
: ${HOME:=~}

_mksh
_ksh
_yash
_shell
_bin
_runit
_git
_xorg
_fonts
_vim
_void
_ssh
_gtk