-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathinstall
executable file
·54 lines (43 loc) · 1.12 KB
/
install
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
#!/bin/bash
set -e
EA_PATH=$HOME/.emacs_anywhere
EA_URL='https://github.com/zachcurry/emacs-anywhere.git'
err () { echo -e "Error: $@" 1>&2; }
installed () { hash $1 &> /dev/null; }
require_deps () {
for d in $@; do
if installed $d ; then
echo dependency check passed: $d
else
err dependency check failed: "'$d'" not found
exit 1
fi
done
}
case $OSTYPE in
"darwin"*)
WRKFLW_PATH=$EA_PATH/Emacs\ Anywhere.workflow
SERVICES_PATH=$HOME/Library/Services
;;
"linux-gnu")
require_deps xclip xdotool xprop xwininfo
;;
*)
err OS $OSTYPE isn\'t currently supported
exit 1
;;
esac
require_deps emacsclient git
if [ -a $EA_PATH ]; then
echo 'Uninstalling existing installation...'
rm -rf $EA_PATH
echo 'Reinstalling Emacs Anywhere...'
else
echo "Installing Emacs Anywhere..."
fi
git clone $EA_URL $EA_PATH
if [[ $OSTYPE == "darwin"* ]]; then
echo "Copying $WRKFLW_PATH to ${SERVICES_PATH}..."
cp -Rf "${WRKFLW_PATH}" $SERVICES_PATH
fi
echo Emacs Anywhere has been installed!