-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstoredots.sh
More file actions
executable file
·45 lines (39 loc) · 935 Bytes
/
storedots.sh
File metadata and controls
executable file
·45 lines (39 loc) · 935 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
38
39
40
41
42
43
44
45
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
store () {
FILE=$1
echo "Diffing $DIR/$FILE and ~/.$FILE"
diff $DIR/$FILE ~/.$FILE > /dev/null
code=$?
if [[ $code -eq 1 ]]
then
echo "$FILE changing from< to>"
diff $DIR/$FILE ~/.$FILE
cp ~/.$FILE $DIR/$FILE
elif [[ $code -eq 0 ]]
then
echo "$FILE has no changes"
else
echo "Unknown diff exit code $code"
fi
}
doStuff() {
echo -n > plugins.txt
echo -n "Logging plugins... "
for i in $(ls ~/.vim/bundle); do
echo -n "$i "
cat ~/.vim/bundle/$i/.git/config | sed -n "s/\s*url = \(.\)/\1/p" >> plugins.txt
done
echo
store "tmux.conf"
store "vimrc"
}
read -p "Backing up current system configurations into this git repo. Do you want to continue? (y/n)" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo
doStuff
else
echo
exit 1
fi