-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.sh
executable file
·93 lines (82 loc) · 2.24 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 -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [[ "$OSTYPE" == "darwin"* ]]; then
IS_MAC=true
else
USERPROFILE="/mnt/c/Users/Fryguy"
fi
function link_file() {
file="$1"
target="$2"
copy="$3"
link_dir=$(dirname "$target")
[ ! -d "$link_dir" ] && echo "Creating $link_dir" && mkdir -p "$link_dir"
if [ "$copy" == "true" ]; then
echo "Copying $file -> $target"
rm -f "$target"
cp "$file" "$target"
else
echo "Linking $target -> $file"
ln -snf "$file" "$target"
fi
}
for target in \
.bundler.d/Gemfile.global.rb \
.gemrc \
.gitattributes \
.gitconfig \
.gitignore_global \
.gnupg/gpg.conf \
.irbrc \
.profile \
.pryrc \
.ruby_tools.rb \
.vim/colors/twilight-fryguy.vim \
.vimrc \
bin
do
link_file "$DIR/$target" "$HOME/$target"
done
for target in \
.gnupg/gpg-agent.conf \
.gitconfig_platform
do
if [ "$IS_MAC" == "true" ]; then
link_file "$DIR/$target-mac" "$HOME/$target"
else
link_file "$DIR/$target-linux" "$HOME/$target"
fi
done
chown -R $(whoami) $HOME/.gnupg/
chmod 600 $HOME/.gnupg/*
chmod 700 $HOME/.gnupg
if [ "$IS_MAC" == "true" ]; then
target="Library/KeyBindings/DefaultKeyBinding.dict"
link_file "$DIR/$target" "$HOME/$target"
fi
if [ "$IS_MAC" == "true" ]; then
link_file "$DIR/Sublime Text 3/Packages/User/Twilight (Fryguy).tmTheme" "$HOME/.config/bat/themes/Twilight (Fryguy).tmTheme"
fi
# Install git extensions
if [ ! -d "$HOME/projects/external/ConradIrwin/git-aliae" ]; then
git clone git@github.com:ConradIrwin/git-aliae.git -o upstream $HOME/projects/external/ConradIrwin/git-aliae
fi
if [ ! -d "$HOME/projects/external/DanielVartanov/willgit" ]; then
git clone git@github.com:DanielVartanov/willgit.git -o upstream $HOME/projects/external/DanielVartanov/willgit
fi
# Temporarily disable Sublime
#if [ "$IS_MAC" != "true" ]; then
# link_file "/mnt/c/Program Files/Sublime Text 3/subl.exe" "$HOME/bin/subl"
#fi
#
#IFS=$'\n' files=($(ls "Sublime Text 3/Packages/User"))
#for target in ${files[@]}; do
# if [ "$IS_MAC" == "true" ]; then
# copy=false
# target_dir="$HOME/Library/Application Support"
# else
# copy=true
# target_dir="$USERPROFILE/AppData/Roaming"
# fi
# link_file "$DIR/Sublime Text 3/Packages/User/$target" "$target_dir/Sublime Text 3/Packages/User/$target" "$copy"
#done