forked from AnthonyDiSanti/dot_files
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.bash
executable file
·37 lines (31 loc) · 1021 Bytes
/
setup.bash
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
#!/usr/bin/env bash
# Finds the dereferenced directory of the current script
get_script_dir () {
local SOURCE="${BASH_SOURCE[0]}"
local DIR="$( dirname "$SOURCE" )"
while [ -h "$SOURCE" ]; do
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
done
local RETVAL="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
if [[ $# = 0 ]]; then
SCRIPTDIR=$RETVAL
else
eval "$1='$RETVAL'"
fi
}
get_script_dir DOTFILESDIR
# Do not use this crazy-ass shit (but it fucking works!):
#find $SCRIPTDIR/ -iname *.symlink -execdir basename {} .symlink \; | xargs -I{} ln -s $SCRIPTDIR/{}.symlink ~/.{}
SYMLINKS=$(ls -1d $DOTFILESDIR/*.symlink)
for SYMLINK in $SYMLINKS; do
BASENAME=$(basename $SYMLINK .symlink)
ln -Ffs $SYMLINK ~/.$BASENAME
done
which brew
if ! which brew; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap homebrew/bundle
brew bundle
fi