-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·93 lines (82 loc) · 1.81 KB
/
setup.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
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# Install my environment
# Assumes to be run from root directory of the env repository,
# i.e. the place it is located
set -ex
SOURCE_DIR=`pwd`
OSNAME=$(uname -s)
# Link or copy (symlinks don't work on Windows)
function lncp()
{
src=$1
dst=$2
# Remove old symlinks, copy files/directories
[ -L $dst ] && rm $dst
[ -f $dst -o -d $dst ] && mv $dst ${dst}.bak
if [ $OSNAME = "MINGW64_NT-10.0" ]; then
cp -r $src $dst
else
ln -s $src $dst
fi
}
# Dot files
cd ${SOURCE_DIR}/dot
DOT_DIR=`pwd`
for f in ${DOT_DIR}/*; do
bf=`basename $f`
case "$bf" in
"ssh"|"tmux")
# Skip...handled below
;;
*)
lncp $f ~/.$bf
;;
esac
done
# Handle ssh config
cd ${SOURCE_DIR}/dot/ssh
SSH_DIR=`pwd`
mkdir -p ~/.ssh
for f in ${SSH_DIR}/*; do
bf=`basename $f`
lncp $f ~/.ssh/$bf
done
# Handle tmux files
cd ${SOURCE_DIR}/dot/tmux
TMUX_DIR=`pwd`
mkdir -p ~/.tmux
for f in ${TMUX_DIR}/*; do
bf=`basename $f`
lncp $f ~/.tmux/$bf
done
# Tools
cd ${SOURCE_DIR}/tools/bin
TOOLS_DIR=`pwd`
mkdir -p ~/tools/bin
for f in ${TOOLS_DIR}/*; do
bf=`basename $f`
lncp $f ~/tools/bin/$bf
done
cd ${SOURCE_DIR}/tools/lib
TOOLS_DIR=`pwd`
mkdir -p ~/tools/lib
for f in ${TOOLS_DIR}/*; do
bf=`basename $f`
lncp $f ~/tools/lib/$bf
done
cd ${SOURCE_DIR}/tools/etc
TOOLS_DIR=`pwd`
mkdir -p ~/tools/etc
for f in ${TOOLS_DIR}/*; do
bf=`basename $f`
lncp $f ~/tools/etc/$bf
done
# Misc
# if [ $OSNAME = "Darwin" ]; then
# # iterm preferences
# [ -f ~/Library/Preferences/com.googlecode.iterm2.plist ] && \
# rm ~/Library/Preferences/com.googlecode.iterm2.plist
# cp ${SOURCE_DIR}/misc/com.googlecode.iterm2.plist ~/Library/Preferences/
# # Update them
# defaults read com.googlecode.iterm2
# fi