-
Notifications
You must be signed in to change notification settings - Fork 9
/
home2src.sh
executable file
·120 lines (106 loc) · 3.5 KB
/
home2src.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
#!/bin/sh
SRC_PATH="$HOME/src/voidlinux-i3"
DOT_FILES=(".bash_profile" ".bashrc" \
".exports" ".inputrc" ".tmux.conf" ".urlview" ".Xdefaults" ".xinitrc")
DOT_DIRS=(".icons" ".scripts" ".themes")
CONFIG_FILES=("compton.conf" "user-dirs.dirs" "wall.png")
CONFIG_DIRS=("dunst" "feh" "gtk-2.0" "gtk-3.0" "htop" "i3" "icc" \
"mpv" "neofetch" "startpage")
doUpdate() {
# Root dot files
echo "Updating root dotfiles..."
for item in "${DOT_FILES[@]}" ; do
echo -e "\t$item"
[[ -f "$HOME/$item" ]] && cp "$HOME/$item" "$SRC_PATH"
done
echo "Updating root dot dirs..."
for item in "${DOT_DIRS[@]}" ; do
echo -e "\t$item"
[[ ! -d "$SRC_PATH/$item" ]] && mkdir -p "$SRC_PATH/$item"
if [[ ! -d "$HOME/$item" ]]; then
echo "$HOME/$item not fonud"; exit 0
else
cp -rf "$HOME/$item" "$SRC_PATH"
fi
done
#### .config
if [[ ! -d "$SRC_PATH/.config" ]]; then
mkdir -p "$SRC_PATH/.config"
fi
echo "Updating .config root files..."
for item in "${CONFIG_FILES[@]}" ; do
echo -e "\t$item"
[[ -f "$HOME/.config/$item" ]] && cp "$HOME/.config/$item" "$SRC_PATH/.config"
done
echo "Updating .config dirs..."
for item in "${CONFIG_DIRS[@]}" ; do
echo -e "\t$item"
[[ ! -d "$SRC_PATH/.config/$item" ]] && mkdir -p "$SRC_PATH/.config/$item"
if [[ ! -d "$HOME/.config/$item" ]]; then
echo "$HOME/.config/$item not fonud"; exit 0
else
cp -rf "$HOME/.config/$item" "$SRC_PATH/.config"
fi
done
#### Other .config dirs
echo "Updating other .config dirs..."
# . # mpd
echo -e "\tmpd"
[[ ! -d "$SRC_PATH/.config/mpd" ]] && mkdir -p "$SRC_PATH/.config/mpd"
if [[ ! -d "$HOME/.config/mpd" ]]; then
echo "$HOME/.config/mpd not fonud"; exit 0
else
cp "$HOME/.config/mpd/mpd.conf" "$SRC_PATH/.config/mpd"
fi
# ncmpcpp
echo -e "\tncmpcpp"
[[ ! -d "$SRC_PATH/.config/ncmpcpp" ]] && mkdir -p "$SRC_PATH/.config/ncmpcpp"
if [[ ! -d "$HOME/.config/ncmpcpp" ]]; then
echo "$HOME/.config/ncmpcpp not fonud"; exit 0
else
cp -rf "$HOME/.config/ncmpcpp/bindings" "$HOME/.config/ncmpcpp/config" \
"$SRC_PATH/.config/ncmpcpp"
fi
# newsboat
echo -e "\tnewsboat"
[[ ! -d "$SRC_PATH/.config/newsboat" ]] && mkdir -p "$SRC_PATH/.config/newsboat"
if [[ ! -d "$HOME/.config/newsboat" ]]; then
echo "$HOME/.config/newsboat not fonud"; exit 0
else
cp "$HOME/.config/newsboat/config" "$SRC_PATH/.config/newsboat"
fi
# nvim
echo -e "\tnvim"
[[ ! -d "$SRC_PATH/.config/nvim" ]] && mkdir -p "$SRC_PATH/.config/nvim"
if [[ ! -d "$HOME/.config/nvim" ]]; then
echo "$HOME/.config/nvim not fonud"; exit 0
else
cp -rf "$HOME/.config/nvim/autoload" "$HOME/.config/nvim/syntax" \
"$HOME/.config/nvim/init.vim" "$SRC_PATH/.config/nvim"
fi
# qutebrowser
echo -e "\tqutebrowser"
[[ ! -d "$SRC_PATH/.config/qutebrowser" ]] && mkdir -p "$SRC_PATH/.config/qutebrowser"
if [[ ! -d "$HOME/.config/qutebrowser" ]]; then
echo "$HOME/.config/qutebrowser not fonud"; exit 0
else
cp "$HOME/.config/qutebrowser/config.py" "$SRC_PATH/.config/qutebrowser"
fi
# ranger
echo -e "\tranger"
[[ ! -d "$SRC_PATH/.config/ranger" ]] && mkdir -p "$SRC_PATH/.config/ranger"
if [[ ! -d "$HOME/.config/ranger" ]]; then
echo "$HOME/.config/ranger not fonud"; exit 0
else
cp "$HOME/.config/ranger/commands.py" "$HOME/.config/ranger/rc.conf" \
"$HOME/.config/ranger/rifle.conf" "$HOME/.config/ranger/scope.sh" \
"$SRC_PATH/.config/ranger"
fi
}
read -r -p "Are you sure you want to overwrite src with dotfiles from home? [y/N] " response
response=${response,,} # tolower
if [[ "$response" =~ ^(yes|y)$ ]]; then
doUpdate;
else
exit 0;
fi