Fix unset PRELUDE_INTO bug.

A -n test behaves differently with and without quotes.  This fixes
https://github.com/bbatsov/prelude/issues/577
This commit is contained in:
Ben Prew 2014-07-03 10:16:14 -07:00 committed by Ben Prew
parent 86f25a9462
commit ce97547acf

View file

@ -78,7 +78,7 @@ usage() {
printf " -s, --source [url] \t \t Clone prelude from 'url'.\n"
printf " \t \t \t \t Defaults to 'https://github.com/bbatsov/prelude.git'.\n"
printf " -n, --no-bytecompile \t \t Skip the bytecompilation step of prelude.\n"
printf " -i, --into \t \t \t Install Prelude into the existing configuration\n"
printf " -i, --into \t \t \t Install Prelude into a subdirectory in the existing configuration\n"
printf " \t \t \t \t The default behavious is to install prelude into the existing\n"
printf " \t \t \t \t emacs configuration.\n"
printf " -h, --help \t \t \t Display this help and exit\n"
@ -196,7 +196,7 @@ then
tar -cf "$PRELUDE_INSTALL_DIR.pre-prelude.tar" "$PRELUDE_INSTALL_DIR" > /dev/null 2>&1
PRELUDE_INSTALL_DIR_ORIG="$PRELUDE_INSTALL_DIR"
# Overwrite existing?
[ -n "$PRELUDE_INTO" ] || PRELUDE_INSTALL_DIR="$PRELUDE_INSTALL_DIR/prelude"
[ -n "$PRELUDE_INTO" ] && PRELUDE_INSTALL_DIR="$PRELUDE_INSTALL_DIR/prelude"
# Clear destination directory for git clone to work
rm -fr "$PRELUDE_INSTALL_DIR"
mkdir "$PRELUDE_INSTALL_DIR"
@ -205,7 +205,7 @@ then
make_prelude_dirs
# Reinstate files that weren't replaced
tar --skip-old-files -xf "$PRELUDE_INSTALL_DIR_ORIG.pre-prelude.tar" "$PRELUDE_INSTALL_DIR" > /dev/null 2>&1
[ -n "$PRELUDE_INTO" ] || cp "$PRELUDE_INSTALL_DIR/sample/prelude-modules.el" "$PRELUDE_INSTALL_DIR"
[ -n "$PRELUDE_INTO" ] && cp "$PRELUDE_INSTALL_DIR/sample/prelude-modules.el" "$PRELUDE_INSTALL_DIR"
elif [ -e "$PRELUDE_INSTALL_DIR" ]
then
# File exist but not a regular file or directory