/
setup
executable file
·45 lines (33 loc) · 1009 Bytes
/
setup
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
#!/usr/bin/env bash
set -e
# Use this on Mac to get the absolute path of the dir containing the
# script since we can't use readlink -f
if [ "$(uname)" == "Darwin" ]; then
# Get absolute path of the script by changing to that directory and
# using $PWD, which is always an absolute path
dir=`dirname $0`
pushd "$dir" > /dev/null
THIS_SCRIPT=$PWD/$(basename $0)
popd > /dev/null
else
THIS_SCRIPT=`readlink -f $0`
fi
THIS_DIR=`dirname $THIS_SCRIPT`
echo "Setting up candera's custom emacs setup to point to $THIS_DIR"
cd $THIS_DIR
git submodule init
git submodule update
mkdir -p ~/.emacs.d
ln -fs $THIS_DIR ~/.emacs.d/custom
if [ -f ~/.emacs ]; then
cp --backup=numbered ~/.emacs ~/your-old.emacs
rm -f ~/.emacs
fi
if [ -f ~/.emacs.d/init.el ]; then
cp --backup=numbered ~/.emacs.d/init.el ~/.emacs.d/your-old-init.el
rm -f ~/.emacs.d/init.el
fi
echo '(load "~/.emacs.d/custom/init.el")' > ~/.emacs.d/init.el
pushd org-mode
make
popd