-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
81 lines (69 loc) · 2.62 KB
/
update.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
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
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env bash
#Make sure we can use aliases
shopt -s expand_aliases;
# in case no file in folder
shopt -s nullglob;
# shellcheck source=/dev/null
source ~/.bash_profile;
# Move files
# cd "$(dirname "${BASH_SOURCE}")";
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
function doIt() {
which -s atom
if [[ $? = 0 ]] ; then
# pull in atom config files from ~/.atom/
for file in ~/.atom/{config.cson,init.coffee,keymap.cson,snippets.cson,styles.less}; do
[ -r "$file" ] && [ -f "$file" ] && rsync -ciah "$file" "$DIR"/.atom/
done;
unset file;
list_atom_packages > .atom/.my_atom_packages;
fi;
# pull in dbeaver configs that exist in repo if exist in ~
for file in ./.dbeaver4/.metadata/.plugins/org.eclipse.core.runtime/.settings/*.prefs; do
file_name="$(basename $file)"
[ -r ~/.dbeaver4/.metadata/.plugins/org.eclipse.core.runtime/.settings/"$file_name" ] && \
[ -f ~/.dbeaver4/.metadata/.plugins/org.eclipse.core.runtime/.settings/"$file_name" ] && \
rsync -ciah ~/.dbeaver4/.metadata/.plugins/org.eclipse.core.runtime/.settings/"$file_name" \
"$DIR"/.dbeaver4/.metadata/.plugins/org.eclipse.core.runtime/.settings/
done;
# pull in dotfiles from ~/.dotfiles-bash/
for file in ~/.dotfiles-bash/.[^.]*; do
if [[ "$file" == */.extra ]]; then
continue; # don't sync .extra it isn't tracked
fi;
[ -r "$file" ] && [ -f "$file" ] && rsync -ciah "$file" "$DIR"/.dotfiles-bash/
done;
unset file;
# pull in dotfiles from ~/
for file in ~/.{bash_profile,bashrc,gitignore,inputrc,nanorc}; do
[ -r "$file" ] && [ -f "$file" ] && rsync -ciah "$file" "$DIR"/
done;
unset file;
# pull in python idle changes
for file in ~/.idlerc/{config-highlight.cfg,config-main.cfg}; do
[ -r "$file" ] && [ -f "$file" ] && rsync -ciah "$file" "$DIR"/.idlerc/
done;
unset file;
# pull in nanorc language files from ~/.nano/
for file in ~/.nano/*.nanorc; do
[ -r "$file" ] && [ -f "$file" ] && rsync -ciah "$file" "$DIR"/.nano/
done;
# pull in pip config file
for file in ~/Library/Application\ Support/pip/*.conf; do
[ -r "$file" ] && [ -f "$file" ] && rsync -ciah "$file" "$DIR"/Library/Application\ Support/pip/
done;
# pull in psqlrc config file
[ -r "$HOME/.psqlrc" ] && [ -f "$HOME/.psqlrc" ] && rsync -ciah "$HOME/.psqlrc" "$DIR""/.psqlrc"
echo "updates finished review local repo for changes"
unset file;
}
if [ "$1" == "--force" ] || [ "$1" == "-f" ]; then
doIt;
else
read -p "This will overwrite existing files in your dot files repo. Are you sure? (y/n) " -n 1;
echo "";
if [[ $REPLY =~ ^[Yy]$ ]]; then
doIt;
fi;
fi;
unset doIt;