forked from ScottMcCammon/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·35 lines (32 loc) · 938 Bytes
/
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
#!/bin/bash
skipfiles=" install.sh README.md .git bin "
mydir=$(basename `pwd`)
for f in $(find . -depth 1 -not -name '*.swp'); do
f=${f:2} # trim leading "./"
if [[ ! $skipfiles = *" $f "* ]]; then
if [[ -h "../$f" ]]; then
echo "updating $f"
rm ../$f && ln -s $mydir/$f ..
elif [[ ! -e "$HOME/$f" ]]; then
echo "installing $f"
ln -s $mydir/$f ..
else
echo "$f cannot be updated"
fi
fi
done
if [[ ! -e "../bin" ]]; then
mkdir ../bin
fi
for f in $(find ./bin -type f -depth 1 -not -name '*.swp'); do
f=${f:6} # trim leading "./bin/"
if [[ -h "../bin/$f" ]]; then
echo "updating bin/$f"
rm ../bin/$f && ln -s ../$mydir/bin/$f ../bin/
elif [[ ! -e "$HOME/$f" ]]; then
echo "installing bin/$f"
ln -s ../$mydir/bin/$f ../bin/
else
echo "bin/$f cannot be updated"
fi
done