-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-linux.sh
executable file
·49 lines (42 loc) · 1.19 KB
/
install-linux.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
#!/usr/bin/env bash
EMACS_HOME=$(realpath "${HOME}/.emacs.d")
EMACS_BIN=$(which emacs)
if [ -z ${EMACS_BIN} ]; then
echo "Error: Emacs binary not found."
exit -1
fi
echo "Emacs installation dir: ${EMACS_HOME}"
if [ -d ${EMACS_HOME} ]; then
read -r -p "'${EMACS_HOME}' already exists. Do you want to override it? [y/N]: " ans
case "$ans" in
[yY])
;;
*)
echo "Installation aborted"
exit -1
esac
fi
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
rm -rf ${EMACS_HOME}
mkdir -p ${EMACS_HOME}
ln -s ${DIR}/init.el ${EMACS_HOME}/
ln -s ${DIR}/early-init.el ${EMACS_HOME}/
ln -s ${DIR}/core/ ${EMACS_HOME}/
ln -s ${DIR}/etc/ ${EMACS_HOME}/
echo "Configuration files installed."
read -r -p "Launching Emacs script and complete the installation? [Y/n]: " ans
case "$ans" in
[nN])
echo "Done!"
exit 0;;
*)
esac
echo "Configuring Emacs..."
${EMACS_BIN} --script ${EMACS_HOME}/init.el
echo "Done!"