-
Notifications
You must be signed in to change notification settings - Fork 1
/
loader
executable file
·56 lines (43 loc) · 1.09 KB
/
loader
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
#!/usr/bin/env bash
set -e
write_dotfiles() {
rm -rf ~/.dotfiles
rsync -a . ~/.dotfiles
pushd ~
local to_delete='';
local to_link='';
for file in .dotfiles/.*; do
# shellcheck disable=SC2155
local basename="$(basename "$file")"
if [ "$basename" = '.' ] || [ "$basename" = '..' ]; then
continue
fi
to_link="$to_link $file"
if [ -e "$basename" ]; then
to_delete="$to_delete $basename"
fi
done
if [ -n "$to_delete" ]; then
echo "The following files and directories are going to be deleted:"
echo " $to_delete" | fmt
# Script is poorly done and hopes no path contain any space.
# shellcheck disable=SC2086
rm -rfI $to_delete
fi
for file in $to_link; do
ln -s "$file" .
done
popd
}
touch_local_dotfiles() {
touch "$HOME/.bash_local"
touch "$HOME/.zsh_local"
}
warn() {
printf "All done.\n"
echo "Remember to build cpsm:"
echo "cd '$HOME/.vim/bundle/cpsm' && ./install.sh"
}
write_dotfiles
touch_local_dotfiles
warn