commit
a027018eb9
2 changed files with 74 additions and 78 deletions
|
@ -2,26 +2,23 @@ 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 "$RED Unkown git error occured during installation, "
|
||||||
printf "please check the source url: $PRELUDE_URL\n$RESET"
|
printf "please check the source url: $PRELUDE_URL\n$RESET"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
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 > /dev/null 2>&1
|
mkdir $PRELUDE_INSTALL_DIR/vendor $PRELUDE_INSTALL_DIR/personal
|
||||||
mkdir $PRELUDE_INSTALL_DIR/themes $PRELUDE_INSTALL_DIR/snippets > /dev/null 2>&1
|
mkdir $PRELUDE_INSTALL_DIR/themes $PRELUDE_INSTALL_DIR/snippets
|
||||||
if ! [ $? -eq 0 ]
|
mkdir $PRELUDE_INSTALL_DIR/savefile
|
||||||
then
|
|
||||||
printf "$RED failed to create directories.\n$RESET"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
colors () {
|
colors () {
|
||||||
|
@ -84,46 +81,46 @@ usage() {
|
||||||
while [ $# -gt 0 ]
|
while [ $# -gt 0 ]
|
||||||
do
|
do
|
||||||
case $1 in
|
case $1 in
|
||||||
-d | --directory)
|
-d | --directory)
|
||||||
PRELUDE_INSTALL_DIR=$2
|
PRELUDE_INSTALL_DIR=$2
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-c | --colors)
|
-c | --colors)
|
||||||
colors
|
colors
|
||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
-s | --source)
|
-s | --source)
|
||||||
PRELUDE_URL=$2
|
PRELUDE_URL=$2
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-i | --into)
|
-i | --into)
|
||||||
PRELUDE_INTO='true'
|
PRELUDE_INTO='true'
|
||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
-n | --no-bytecompile)
|
-n | --no-bytecompile)
|
||||||
PRELUDE_SKIP_BC='true'
|
PRELUDE_SKIP_BC='true'
|
||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
-h | --help)
|
-h | --help)
|
||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-v | --verbose)
|
-v | --verbose)
|
||||||
echo "prelude verbose $PRELUDE_VERBOSE"
|
echo "prelude verbose $PRELUDE_VERBOSE"
|
||||||
PRELUDE_VERBOSE='true';
|
PRELUDE_VERBOSE='true';
|
||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "Unkown option: $1\n"
|
printf "Unkown option: $1\n"
|
||||||
shift 1
|
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_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
|
||||||
|
@ -133,15 +130,24 @@ 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
|
||||||
|
|
||||||
|
# If prelude is already installed
|
||||||
|
if [ -d $PRELUDE_INSTALL_DIR/prelude ]
|
||||||
|
then
|
||||||
|
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 "If you want to update your copy of prelude, run 'git pull origin master' from your prelude directory\n\n"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
### Check dependencies
|
### Check dependencies
|
||||||
printf "$CYAN Checking to see if git is installed... $RESET"
|
printf "$CYAN Checking to see if git is installed... $RESET"
|
||||||
if hash git 2>&-
|
if hash git 2>&-
|
||||||
|
@ -174,15 +180,6 @@ 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 prelude is already installed
|
|
||||||
if [ -d $PRELUDE_INSTALL_DIR/prelude ]
|
|
||||||
then
|
|
||||||
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 "If you want to update your copy of prelude, run 'git pull origin master' from your prelude directory\n\n"
|
|
||||||
exit 1;
|
|
||||||
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
|
||||||
|
@ -191,13 +188,13 @@ then
|
||||||
# Overwrite existing?
|
# Overwrite existing?
|
||||||
if [ -n $PRELUDE_INTO ]
|
if [ -n $PRELUDE_INTO ]
|
||||||
then
|
then
|
||||||
# Install into existing config
|
# Install into existing config
|
||||||
PRELUDE_INSTALL_DIR+='/prelude'
|
PRELUDE_INSTALL_DIR=$PRELUDE_INSTALL_DIR"/prelude"
|
||||||
install_prelude
|
install_prelude
|
||||||
else
|
else
|
||||||
# Replace existing config
|
# Replace existing config
|
||||||
install_prelude
|
install_prelude
|
||||||
make_prelude_dirs
|
make_prelude_dirs
|
||||||
fi
|
fi
|
||||||
elif [ -e $PRELUDE_INSTALL_DIR ]
|
elif [ -e $PRELUDE_INSTALL_DIR ]
|
||||||
then
|
then
|
||||||
|
@ -217,28 +214,27 @@ 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"
|
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/prelude/*.el
|
emacs -batch -f batch-byte-compile $PRELUDE_INSTALL_DIR/prelude/*.el
|
||||||
emacs -batch -f batch-byte-compile "$PRELUDE_INSTALL_DIR/prelude/*.el"
|
else
|
||||||
else
|
emacs -batch -f batch-byte-compile $PRELUDE_INSTALL_DIR/prelude/*.el > /dev/null 2>&1
|
||||||
emacs -batch -f batch-byte-compile $PRELUDE_INSTALL_DIR/prelude/*.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"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
printf "Skipping bytecompilation.\n"
|
printf "Skipping bytecompilation.\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Print usage message if prelude didn't replace .emacs.d
|
# Print usage message if prelude didn't replace .emacs.d
|
||||||
if [ $PRELUDE_INSTALL_DIR != "$HOME/.emacs.d" ]
|
# if [ $PRELUDE_INSTALL_DIR != "$HOME/.emacs.d" ]
|
||||||
then
|
# then
|
||||||
printf "\n To use prelude, add: $CYAN\n (defvar prelude-dir \"$PRELUDE_INSTALL_DIR/\")\n"
|
# 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 " (load-file (concat prelude-dir \"init.el\"))\n$RESET"
|
||||||
printf " To your emacs init file.\n\n"
|
# printf " To your emacs init file.\n\n"
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
printf "\n"
|
printf "\n"
|
||||||
printf "$BBLUE ____ _ _ \n"
|
printf "$BBLUE ____ _ _ \n"
|
||||||
|
|
Loading…
Reference in a new issue