-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsync.sh
More file actions
executable file
·70 lines (63 loc) · 1.87 KB
/
sync.sh
File metadata and controls
executable file
·70 lines (63 loc) · 1.87 KB
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
#!/bin/bash
cd "$(dirname "$0")" || exit 5
git pull
function doIt() {
if [ ! -d ~/code ]; then
mkdir ~/code
fi
if [ ! -d ~/code/z ]; then
git clone https://github.com/rupa/z.git ~/code/z
fi
if [ ! -d ~/.logs ]; then
mkdir ~/.logs
chmod 700 ~/.logs
fi
if [ ! -d ~/.vim/bundle/vundle ]; then
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
fi
if [ ! -d /mnt/c ]; then
# on Mac skip Windows AppData folder
rsync -av Library ~
else
# on Windows skip Mac Library folder
WINHOME=$(wslpath "$(cmd.exe /C "echo %USERPROFILE%" 2>/dev/null | tr -d '\r' | tail -1)")
rsync -av AppData "$WINHOME"
fi
rsync --exclude ".git/" --exclude "images/" --exclude Library --exclude AppData \
--exclude "sync.sh" --exclude "README.md" \
--exclude "brew.txt" \
--exclude "cask-minimal.txt" --exclude "cask-full.txt" \
--exclude "setup-mac" --exclude "plist" \
--exclude "fetch-code-prefs.sh" \
--exclude "npm-install.sh" --exclude "LICENSE.txt" \
--exclude ".gitkeep" --exclude ".gitconfig" --exclude "fetch-sublime-prefs.sh" \
-av . ~
if [ ! -f ~/.gitconfig ]; then
cp .gitconfig ~/.gitconfig
fi
if which vim >/dev/null 2>&1; then
vim +BundleInstall +qall
fi
# Visual Studio Code
if [ -f ./Library/Application\ Support/Code/User/extensions.txt ]; then
extensions=$(cat ./Library/Application\ Support/Code/User/extensions.txt)
if [ ! -d /mnt/c ]; then
if which code >/dev/null 2>&1; then
for ext in $extensions; do
code --install-extension "$ext"
done
fi
fi
fi
}
if [ "$1" == "--force" -o "$1" == "-f" ]; then
doIt
else
read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
doIt
fi
fi
unset doIt
source ~/.bash_profile