diff --git a/utils/installer.sh b/utils/installer.sh index 1231fb6..fba4e19 100755 --- a/utils/installer.sh +++ b/utils/installer.sh @@ -1,44 +1,47 @@ -#!/bin/bash - PRELUDE_INSTALL_DIR="$HOME/.emacs.d" PRELUDE_URL=https://github.com/bbatsov/prelude.git -echo -n "Checking to see if git is installed... " -hash git 2>&- || { echo >&2 "not found. Aborting installation!"; exit 1; } -echo "found" +if [ -d $PRELUDE_INSTALL_DIR ] +then + printf "\e[33m You already have Prelude installed.\e[0m You'll need to remove $PRELUDE_INSTALL_DIR if you want to install Prelude again.\n" + exit 1; +fi + +printf "Checking to see if git is installed... " +hash git 2>&- || { printf >&2 "\e[33mnot found. Aborting installation!\e[0m"; exit 1; } +printf "\e[32mfound.\e[0m\n" -echo -n "Checking to see if aspell is installed... " -hash aspell 2>&- || { echo >&2 "not found. Install aspell to benefit from flyspell-mode!"; } -echo "found" +printf "Checking to see if aspell is installed... " +hash aspell 2>&- || { printf >&2 "\e[33mnot found. Install aspell to benefit from flyspell-mode!\e[0m"; } +printf "\e[32mfound.\e[0m\n" -echo -n "Checking to see if ack is installed... " -hash ack 2>&- || { echo >&2 "not found. You'll need it to use ack-and-a-half!"; } -echo "found" +printf "Checking to see if ack is installed... " +hash ack 2>&- || { printf >&2 "\e[33mnot found. You'll need it to use ack-and-a-half!\e[0m"; } +printf "\e[32mfound.\e[0m\n" -echo -n "Looking for an existing Emacs config..." +printf "Looking for an existing Emacs config... " if [ -d $PRELUDE_INSTALL_DIR ] then - echo "Found an existing $PRELUDE_INSTALL_DIR. Backing it up to $PRELUDE_INSTALL_DIR.pre-prelude" - mv $PRELUDE_INSTALL_DIR $PRELUDE_INSTALL_DIR.pre-prelude -fi - -if [ -f ~/.emacs ] + printf "\e[33mfound an existing $PRELUDE_INSTALL_DIR.\e[0m Backing it up to $PRELUDE_INSTALL_DIR.pre-prelude.\n" + mv $PRELUDE_INSTALL_DIR $PRELUDE_INSTALL_DIR.pre-prelude +elif [ -f ~/.emacs ] then - echo "Found an existing ~/.emacs. Backing it up to ~/.emacs.pre-prelude" - mv ~/.emacs ~/.emacs.pre-prelude + printf "\e[33mfound an existing ~/.emacs.\e[0m Backing it up to ~/.emacs.pre-prelude.\n" + mv ~/.emacs ~/.emacs.pre-prelude +else + printf "\e[32mnot found.\e[0m\n" fi -echo -n "Cloning Emacs Prelude from GitHub... " -/usr/bin/env git clone $PRELUDE_URL $PRELUDE_INSTALL_DIR > /dev/null +printf "Cloning Emacs Prelude from GitHub... " +/usr/bin/env git clone $PRELUDE_URL $PRELUDE_INSTALL_DIR > /dev/null 2>&1 cd $PRELUDE_INSTALL_DIR -echo "done." - -echo -e '\e[34m ____ _ _ ' -echo -e '\e[34m| _ \ _ __ ___| |_ _ __| | ___ ' -echo -e '\e[34m| |_) | __/ _ \ | | | |/ _ |/ _ \' -echo -e '\e[34m| __/| | | __/ | |_| | (_| | __/' -echo -e '\e[34m|_| |_| \___|_|\__,_|\__,_|\___|' +printf "done.\n\n" +printf "\e[34m ____ _ _ \n" +printf "\e[34m| _ \ _ __ ___| |_ _ __| | ___ \n" +printf "\e[34m| |_) | __/ _ \ | | | |/ _ |/ _ \ \n" +printf "\e[34m| __/| | | __/ | |_| | (_| | __/ \n" +printf "\e[34m|_| |_| \___|_|\__,_|\__,_|\___| \n" -echo -e '\e[32m... is now installed and ready to do thy bidding!' -echo -e '\e[0m' +printf "\e[32m... is now installed and ready to do thy bidding, Master $USER!\n" +printf "\e[0m"