-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·89 lines (78 loc) · 2.12 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
#!/bin/bash
# **************************************************************************** #
# #
# ::: :::::::: #
# install.sh :+: :+: :+: #
# +:+ +:+ +:+ #
# By: mcanal <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2016/08/11 14:03:35 by mcanal #+# #+# #
# Updated: 2019/09/23 09:59:24 by mc ### ########.fr #
# #
# **************************************************************************** #
set -e
CONFIG_FOLDER="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TO_LINK="sh_script
.zshrc
.bashrc
.bash_aliases
.dircolors
.emacs.d
.gdbinit
.gitconfig
.gitignore_global
.nanorc
.Xmodmap
.Xresources
.xinitrc
.xbindkeysrc
.toprc
.config/mimeapps.list
.config/conky
.config/dconf
.config/gsimplecal
.config/gtk-2.0
.config/gtk-3.0
.config/i3
.config/i3blocks
.config/lxterminal
.config/libfm
.config/pcmanfm
.config/rofi
.config/vlc
.config/compton.conf
.config/redshift.conf"
PRIVATE_FOLDER=private
TO_LINK_PRIVATE=".ssh
.authinfo"
function back-it () {
if [ -e "$1" ]; then
echo -n "[+] back'ed: "
"$CONFIG_FOLDER/sh_script/trash.sh" "$1"
fi
}
function link-it () {
DST="$2"
SRC="$1"
back-it "$DST"
echo -n "[+] link'ed: "
ln -sv "$SRC" "$DST"
}
function extract-it () {
DST="$1"
SRC="$1.zip"
back-it "$DST"
echo "[+] exctract'ed: "
unzip -d "$CONFIG_FOLDER" "$SRC"
}
mkdir -pv "$HOME/.config"
for i in $TO_LINK; do
link-it "$CONFIG_FOLDER/$i" "$HOME/$i"
done
back-it "$HOME/.emacs" # :O
if [ "$1" != "--no-private" ]; then
extract-it "$CONFIG_FOLDER/$PRIVATE_FOLDER"
for i in $TO_LINK_PRIVATE; do
link-it "$CONFIG_FOLDER/$PRIVATE_FOLDER/$i" "$HOME/$i"
done
fi