Skip to content

Instantly share code, notes, and snippets.

@ksexton
Created August 30, 2017 15:10
Show Gist options
  • Save ksexton/02c823e0eb51a30bef528521dce01eaf to your computer and use it in GitHub Desktop.
Save ksexton/02c823e0eb51a30bef528521dce01eaf to your computer and use it in GitHub Desktop.
Install Emacs
#!/bin/bash
[ -z "$EMACS_VERSION" ] && echo "Usage: EMACS_VERSION=25.2 install-emacs.sh" && exit 1
[ -z "$EMACS_URL" ] && EMACS_URL="http://mirror.aarnet.edu.au/pub/gnu/emacs/"
# I've assign 12G memory to /tmp as ramdisk
[ -z "$EMACS_TMP" ] && EMACS_TMP="/tmp"
# configure: WARNING: unrecognized options: --without-gtk3, --without-aqua, --without-alsa, --without-aqua
echo "curl $EMACS_URL/emacs-$EMACS_VERSION.tar.gz"
curl $EMACS_URL/emacs-$EMACS_VERSION.tar.gz | tar xvz -C $EMACS_TMP
# @see http://wiki.gentoo.org/wiki/Project:Emacs/GNU_Emacs_developer_guide
# @see http://packages.gentoo.org/package/app-editors/emacs for info on Gentoo Linux
# --without-gtk and --without-gtk3 is optional
if [[ $EUID -ne 0 ]]; then
echo "Installing Emacs as normal user ..."
cd $EMACS_TMP/emacs-$EMACS_VERSION;mkdir -p $HOME/myemacs/$EMACS_VERSION;rm -rf $HOME/myemacs/$EMACS_VERSION/*;./configure --prefix=$HOME/myemacs/$EMACS_VERSION --without-x --without-dbus --without-sound && make && make install
rm -rf $EMACS_TMP/emacs-$EMACS_VERSION
echo "Emacs $EMACS_VERSION installed!"
else
echo "Installing Emacs as sudoer ..."
cd $EMACS_TMP/emacs-$EMACS_VERSION;./configure --without-x --without-dbus --without-sound && make && make install
echo "Emacs $EMACS_VERSION installed! Please remove $EMACS_TMP/emacs-$EMACS_VERSION"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment