forked from L-P/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloader
More file actions
executable file
·37 lines (28 loc) · 716 Bytes
/
loader
File metadata and controls
executable file
·37 lines (28 loc) · 716 Bytes
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
#!/usr/bin/env bash
function main() {
rm -rf ~/.dotfiles
rsync -a . ~/.dotfiles
pushd ~
local to_delete='';
local to_link='';
for file in .dotfiles/.*; do
local basename="$(basename "$file")"
if [ "$basename" = '.' -o "$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
rm -rfI $to_delete
fi
for file in $to_link; do
ln -s "$file" .
done
popd
}
main