-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
52 lines (37 loc) · 870 Bytes
/
install.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
#!/bin/bash
set -e
readonly SCRIPT_LINES=53
readonly TEMP_PATH=/tmp/emacs-x-temp.tar.gz
INSTALL_DIR=/opt/emacs-x
BIN_DIR=/usr/bin
if [[ ! -z $1 ]] ; then
INSTALL_DIR=$1
fi
if [[ ! -z $2 ]] ; then
BIN_DIR=$2
fi
EMACS_X_PATH=$BIN_DIR/emacs-x
if [[ -d $INSTALL_DIR ]] ; then
echo "Error: $INSTALL_DIR exists"
exit 1
fi
mkdir -p $INSTALL_DIR
if [[ -f $TEMP_PATH ]] ; then
rm -f $TEMP_PATH
fi
tail -n +$SCRIPT_LINES $0 > $TEMP_PATH
pushd $INSTALL_DIR
tar -zxvf $TEMP_PATH
chmod -R a+w *
cat <<EOF > $EMACS_X_PATH
#!/bin/bash
export GUIX_LOCPATH=${INSTALL_DIR}/opt/emacs/lib/locale
export PATH=${INSTALL_DIR}/opt/emacs/bin:${PATH}
source ${INSTALL_DIR}/opt/emacs/etc/profile
export EMACS_CONFIG_MODE=minimal
export TERM=xterm-256color
emacs --init-directory=${INSTALL_DIR}/opt/emacs/share/emacs.d "\$@"
EOF
chmod a+x $EMACS_X_PATH
popd
exit 0