-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlink
executable file
·78 lines (57 loc) · 2.2 KB
/
link
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
#!/bin/bash -eu
#################################################
# Create all the relevant symlinks for file
# in this repo
#################################################
# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # the directory this file is in
cd $SCRIPT_DIR
#################################################
# Files from home
#################################################
link_file_from_home() {
local fullname=$1
local file_dir=$(dirname "$fullname")
local file_name=$(basename "$fullname")
mkdir -p "$HOME/$file_dir"
ln -s -f "$SCRIPT_DIR/files_from_home/$fullname" "$HOME/$file_dir/$file_name"
echo ln -s -f "$SCRIPT_DIR/files_from_home/$fullname" "$HOME/$file_dir/$file_name"
}
link_files_from_home() {
cd files_from_home
find . -name '*' -type f | while read fname; do
link_file_from_home $fname
done
cd $SCRIPT_DIR
}
link_files_from_home
#################################################
# Files from root
#################################################
link_file_from_root() {
local fullname=$1
local file_dir=$(dirname "$fullname")
local file_name=$(basename "$fullname")
sudo mkdir -p "/$file_dir"
sudo ln -s -f "$SCRIPT_DIR/files_from_root/$fullname" "/$file_dir/$file_name"
echo sudo ln -s -f "$SCRIPT_DIR/files_from_root/$fullname" "/$file_dir/$file_name"
}
link_files_from_root() {
cd files_from_root
find . -name '*' -type f | while read fname; do
link_file_from_root $fname
done
cd $SCRIPT_DIR
}
link_files_from_root
#################################################
# Directories
#################################################
set -x
ln -sf "$SCRIPT_DIR/directories/PyCharm50/" ~/Library/Preferences/
ln -sf "$SCRIPT_DIR/directories/Sublime Text 3/Packages" "$HOME/Library/Application Support/Sublime Text 3/"
ln -sf "$SCRIPT_DIR/directories/Sublime Text 3/Installed Packages" "$HOME/Library/Application Support/Sublime Text 3/"
#################################################
# Other links
#################################################
# ln -s -f $SCRIPT_DIR/files_other/prompt_kale_setup $HOME/.zprezto/modules/prompt/functions/prompt_kale_setup