Browse Source

Fixed bugs in the installer:

- Bytecompilation run twice
- Bash style string concat that doesn't work with sh.
- Default path was \$HOME instead of the users homedir ('' vs "").
custom
bas smit 14 years ago
parent
commit
ccf74a1197
  1. 115
      utils/installer.sh

115
utils/installer.sh

@ -2,15 +2,15 @@ install_prelude () {
printf " Cloning the repository.\n$RESET" printf " Cloning the 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 2>&1
/usr/bin/env git clone $PRELUDE_URL $PRELUDE_INSTALL_DIR > /dev/null 2>&1
fi fi
if ! [ $? -eq 0 ] if ! [ $? -eq 0 ]
then then
printf "$RED Unkown git error occured during installation, "
printf "please check the source url: $PRELUDE_URL\n$RESET"
exit 1
printf "$RED Unkown git error occured during installation, "
printf "please check the source url: $PRELUDE_URL\n$RESET"
exit 1
fi fi
} }
@ -20,7 +20,7 @@ make_prelude_dirs () {
mkdir $PRELUDE_INSTALL_DIR/themes $PRELUDE_INSTALL_DIR/snippets > /dev/null 2>&1 mkdir $PRELUDE_INSTALL_DIR/themes $PRELUDE_INSTALL_DIR/snippets > /dev/null 2>&1
if ! [ $? -eq 0 ] if ! [ $? -eq 0 ]
then then
printf "$RED failed to create directories.\n$RESET"
printf "$RED failed to create directories.\n$RESET"
fi fi
} }
@ -84,46 +84,46 @@ usage() {
while [ $# -gt 0 ] while [ $# -gt 0 ]
do do
case $1 in case $1 in
-d | --directory)
PRELUDE_INSTALL_DIR=$2
shift 2
;;
-c | --colors)
colors
shift 1
;;
-s | --source)
PRELUDE_URL=$2
shift 2
;;
-i | --into)
PRELUDE_INTO='true'
shift 1
;;
-n | --no-bytecompile)
PRELUDE_SKIP_BC='true'
shift 1
;;
-h | --help)
usage
exit 0
;;
-v | --verbose)
echo "prelude verbose $PRELUDE_VERBOSE"
PRELUDE_VERBOSE='true';
shift 1
;;
*)
printf "Unkown option: $1\n"
shift 1
;;
-d | --directory)
PRELUDE_INSTALL_DIR=$2
shift 2
;;
-c | --colors)
colors
shift 1
;;
-s | --source)
PRELUDE_URL=$2
shift 2
;;
-i | --into)
PRELUDE_INTO='true'
shift 1
;;
-n | --no-bytecompile)
PRELUDE_SKIP_BC='true'
shift 1
;;
-h | --help)
usage
exit 0
;;
-v | --verbose)
echo "prelude verbose $PRELUDE_VERBOSE"
PRELUDE_VERBOSE='true';
shift 1
;;
*)
printf "Unkown option: $1\n"
shift 1
;;
esac esac
done done
VERBOSE_COLOR=$BBLUE VERBOSE_COLOR=$BBLUE
[ -z $PRELUDE_URL ] && PRELUDE_URL='https://github.com/bbatsov/prelude.git'
[ -z $PRELUDE_INSTALL_DIR ] && PRELUDE_INSTALL_DIR='$HOME/.emacs.d'
[ -z $PRELUDE_URL ] && PRELUDE_URL="https://github.com/bbatsov/prelude.git"
[ -z $PRELUDE_INSTALL_DIR ] && PRELUDE_INSTALL_DIR="$HOME/.emacs.d"
if [ x$PRELUDE_VERBOSE != x ] if [ x$PRELUDE_VERBOSE != x ]
then then
@ -133,11 +133,11 @@ then
printf "SOURCE_URL = $PRELUDE_URL\n" printf "SOURCE_URL = $PRELUDE_URL\n"
if [ -n $PRELUDE_SKIP_BC ] if [ -n $PRELUDE_SKIP_BC ]
then then
printf "Skipping bytecompilation.\n"
printf "Skipping bytecompilation.\n"
fi fi
if [ -n $PRELUDE_INTO ] if [ -n $PRELUDE_INTO ]
then then
printf "Replacing existing config (if one exists).\n"
printf "Replacing existing config (if one exists).\n"
fi fi
printf "$RESET" printf "$RESET"
fi fi
@ -191,13 +191,13 @@ then
# Overwrite existing? # Overwrite existing?
if [ -n $PRELUDE_INTO ] if [ -n $PRELUDE_INTO ]
then then
# Install into existing config
PRELUDE_INSTALL_DIR+='/prelude'
install_prelude
# Install into existing config
PRELUDE_INSTALL_DIR=$PRELUDE_INSTALL_DIR"/prelude"
install_prelude
else else
# Replace existing config
install_prelude
make_prelude_dirs
# Replace existing config
install_prelude
make_prelude_dirs
fi fi
elif [ -e $PRELUDE_INSTALL_DIR ] elif [ -e $PRELUDE_INSTALL_DIR ]
then then
@ -217,16 +217,15 @@ if [ -z $PRELUDE_SKIP_BC ];
then then
if which emacs 2>&1 > /dev/null if which emacs 2>&1 > /dev/null
then then
printf " Bytecompiling Prelude.\n"
if [ x$PRELUDE_VERBOSE != x ]
then
emacs -batch -f batch-byte-compile $PRELUDE_INSTALL_DIR/prelude/*.el
emacs -batch -f batch-byte-compile "$PRELUDE_INSTALL_DIR/prelude/*.el"
else
emacs -batch -f batch-byte-compile $PRELUDE_INSTALL_DIR/prelude/*.el > /dev/null 2>&1
fi
printf " Bytecompiling Prelude.\n"
if [ x$PRELUDE_VERBOSE != x ]
then
emacs -batch -f batch-byte-compile $PRELUDE_INSTALL_DIR/prelude/*.el
else
emacs -batch -f batch-byte-compile $PRELUDE_INSTALL_DIR/prelude/*.el > /dev/null 2>&1
fi
else else
printf "$YELLOW Emacs not found.$RESET Skipping bytecompilation.\n"
printf "$YELLOW Emacs not found.$RESET Skipping bytecompilation.\n"
fi fi
else else
printf "Skipping bytecompilation.\n" printf "Skipping bytecompilation.\n"

Loading…
Cancel
Save