Fix #294 - quote env var PRELUDE_INSTALL_DIR

This commit is contained in:
Bozhidar Batsov 2013-04-09 18:39:10 +03:00
parent ff9bd27831
commit 0d22c81791

View file

@ -2,9 +2,9 @@ install_prelude () {
printf " Cloning the Prelude's GitHub repository...\n$RESET" printf " Cloning the Prelude's GitHub repository...\n$RESET"
if [ x$PRELUDE_VERBOSE != x ] if [ x$PRELUDE_VERBOSE != x ]
then then
/usr/bin/env git clone $PRELUDE_URL $PRELUDE_INSTALL_DIR /usr/bin/env git clone $PRELUDE_URL "$PRELUDE_INSTALL_DIR"
else else
/usr/bin/env git clone $PRELUDE_URL $PRELUDE_INSTALL_DIR > /dev/null /usr/bin/env git clone $PRELUDE_URL "$PRELUDE_INSTALL_DIR" > /dev/null
fi fi
if ! [ $? -eq 0 ] if ! [ $? -eq 0 ]
then then
@ -15,9 +15,9 @@ install_prelude () {
make_prelude_dirs () { make_prelude_dirs () {
printf " Making the required directories.\n$RESET" printf " Making the required directories.\n$RESET"
mkdir $PRELUDE_INSTALL_DIR/vendor $PRELUDE_INSTALL_DIR/personal mkdir "$PRELUDE_INSTALL_DIR/vendor" "$PRELUDE_INSTALL_DIR/personal"
mkdir $PRELUDE_INSTALL_DIR/themes $PRELUDE_INSTALL_DIR/snippets mkdir "$PRELUDE_INSTALL_DIR/themes" "$PRELUDE_INSTALL_DIR/snippets"
mkdir $PRELUDE_INSTALL_DIR/savefile mkdir "$PRELUDE_INSTALL_DIR/savefile"
} }
colors () { colors () {
@ -119,7 +119,7 @@ done
VERBOSE_COLOR=$BBLUE VERBOSE_COLOR=$BBLUE
[ -z $PRELUDE_URL ] && PRELUDE_URL="https://github.com/bbatsov/prelude.git" [ -z $PRELUDE_URL ] && PRELUDE_URL="https://github.com/bbatsov/prelude.git"
[ -z $PRELUDE_INSTALL_DIR ] && PRELUDE_INSTALL_DIR="$HOME/.emacs.d" [ -z "$PRELUDE_INSTALL_DIR" ] && PRELUDE_INSTALL_DIR="$HOME/.emacs.d"
if [ x$PRELUDE_VERBOSE != x ] if [ x$PRELUDE_VERBOSE != x ]
then then
@ -139,7 +139,7 @@ then
fi fi
# If prelude is already installed # If prelude is already installed
if [ -d $PRELUDE_INSTALL_DIR/core/prelude-core.el ] if [ -d "$PRELUDE_INSTALL_DIR/core/prelude-core.el" ]
then then
printf "\n\n$BRED" printf "\n\n$BRED"
printf "You already have Prelude installed.$RESET\nYou'll need to remove $PRELUDE_INSTALL_DIR/prelude if you want to install Prelude again.\n" printf "You already have Prelude installed.$RESET\nYou'll need to remove $PRELUDE_INSTALL_DIR/prelude if you want to install Prelude again.\n"
@ -179,11 +179,11 @@ then
printf "$YELLOW WARNING:$RESET Prelude depends on emacs $RED 24$RESET !\n" printf "$YELLOW WARNING:$RESET Prelude depends on emacs $RED 24$RESET !\n"
fi fi
if [ -d $PRELUDE_INSTALL_DIR ] || [ -f $PRELUDE_INSTALL_DIR ] if [ -d "$PRELUDE_INSTALL_DIR" ] || [ -f "$PRELUDE_INSTALL_DIR" ]
then then
# Existing file/directory found -> backup # Existing file/directory found -> backup
printf " Backing up the existing config to $PRELUDE_INSTALL_DIR.pre-prelude.tar.\n" printf " Backing up the existing config to $PRELUDE_INSTALL_DIR.pre-prelude.tar.\n"
tar -cf $PRELUDE_INSTALL_DIR.pre-prelude.tar $PRELUDE_INSTALL_DIR > /dev/null 2>&1 tar -cf "$PRELUDE_INSTALL_DIR.pre-prelude.tar" "$PRELUDE_INSTALL_DIR" > /dev/null 2>&1
# Overwrite existing? # Overwrite existing?
if [ -n $PRELUDE_INTO ] if [ -n $PRELUDE_INTO ]
then then
@ -192,10 +192,10 @@ then
make_prelude_dirs make_prelude_dirs
else else
# Install into existing config # Install into existing config
PRELUDE_INSTALL_DIR=$PRELUDE_INSTALL_DIR"/prelude" PRELUDE_INSTALL_DIR="$PRELUDE_INSTALL_DIR/prelude"
install_prelude install_prelude
fi fi
elif [ -e $PRELUDE_INSTALL_DIR ] elif [ -e "$PRELUDE_INSTALL_DIR" ]
then then
# File exist but not a regular file or directory # File exist but not a regular file or directory
# WTF NOW? # WTF NOW?
@ -207,7 +207,7 @@ else
# Nothing yet so just install prelude # Nothing yet so just install prelude
install_prelude install_prelude
make_prelude_dirs make_prelude_dirs
cp $PRELUDE_INSTALL_DIR/sample/prelude-modules.el $PRELUDE_INSTALL_DIR cp "$PRELUDE_INSTALL_DIR/sample/prelude-modules.el" "$PRELUDE_INSTALL_DIR"
fi fi
if [ -z $PRELUDE_SKIP_BC ]; if [ -z $PRELUDE_SKIP_BC ];
@ -217,9 +217,9 @@ then
printf " Bytecompiling Prelude.\n" printf " Bytecompiling Prelude.\n"
if [ x$PRELUDE_VERBOSE != x ] if [ x$PRELUDE_VERBOSE != x ]
then then
emacs -batch -f batch-byte-compile $PRELUDE_INSTALL_DIR/core/*.el emacs -batch -f batch-byte-compile "$PRELUDE_INSTALL_DIR/core/*.el"
else else
emacs -batch -f batch-byte-compile $PRELUDE_INSTALL_DIR/core/*.el > /dev/null 2>&1 emacs -batch -f batch-byte-compile "$PRELUDE_INSTALL_DIR/core/*.el" > /dev/null 2>&1
fi fi
else else
printf "$YELLOW Emacs not found.$RESET Skipping bytecompilation.\n" printf "$YELLOW Emacs not found.$RESET Skipping bytecompilation.\n"
@ -228,14 +228,6 @@ else
printf "Skipping bytecompilation.\n" printf "Skipping bytecompilation.\n"
fi fi
# Print usage message if prelude didn't replace .emacs.d
# if [ $PRELUDE_INSTALL_DIR != "$HOME/.emacs.d" ]
# then
# printf "\n To use prelude, add: $CYAN\n (defvar prelude-dir \"$PRELUDE_INSTALL_DIR/\")\n"
# printf " (load-file (concat prelude-dir \"init.el\"))\n$RESET"
# printf " To your emacs init file.\n\n"
# fi
printf "\n" printf "\n"
printf "$BBLUE ____ _ _ \n" printf "$BBLUE ____ _ _ \n"
printf "$BBLUE | _ \ _ __ ___| |_ _ __| | ___ \n" printf "$BBLUE | _ \ _ __ ___| |_ _ __| | ___ \n"