Merge pull request #568 from rowanthorpe/install-script-fixes
Various install-script fixes
This commit is contained in:
commit
18a707f4d5
1 changed files with 49 additions and 38 deletions
|
@ -20,25 +20,35 @@ make_prelude_dirs () {
|
||||||
mkdir -p "$PRELUDE_INSTALL_DIR/savefile"
|
mkdir -p "$PRELUDE_INSTALL_DIR/savefile"
|
||||||
}
|
}
|
||||||
|
|
||||||
colors () {
|
colors_ () {
|
||||||
# Reset
|
case "$SHELL" in
|
||||||
RESET='\e[0m'
|
*zsh)
|
||||||
RED='\e[0;31m' # Red
|
autoload colors && colors
|
||||||
GREEN='\e[0;32m' # Green
|
eval RESET='$reset_color'
|
||||||
YELLOW='\e[0;33m' # Yellow
|
for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE
|
||||||
BLUE='\e[0;34m' # Blue
|
do
|
||||||
PURPLE='\e[0;35m' # Purple
|
eval $COLOR='$fg_no_bold[${(L)COLOR}]'
|
||||||
CYAN='\e[0;36m' # Cyan
|
eval B$COLOR='$fg_bold[${(L)COLOR}]'
|
||||||
WHITE='\e[0;37m' # White
|
done
|
||||||
|
;;
|
||||||
# Bold
|
*)
|
||||||
BRED='\e[1;31m' # Red
|
RESET='\e[0m' # Reset
|
||||||
BGREEN='\e[1;32m' # Green
|
RED='\e[0;31m' # Red
|
||||||
BYELLOW='\e[1;33m' # Yellow
|
GREEN='\e[0;32m' # Green
|
||||||
BBLUE='\e[1;34m' # Blue
|
YELLOW='\e[0;33m' # Yellow
|
||||||
BPURPLE='\e[1;35m' # Purple
|
BLUE='\e[0;34m' # Blue
|
||||||
BCYAN='\e[1;36m' # Cyan
|
PURPLE='\e[0;35m' # Magenta
|
||||||
BWHITE='\e[1;37m' # White
|
CYAN='\e[0;36m' # Cyan
|
||||||
|
WHITE='\e[0;37m' # White
|
||||||
|
BRED='\e[1;31m' # Bold Red
|
||||||
|
BGREEN='\e[1;32m' # Bold Green
|
||||||
|
BYELLOW='\e[1;33m' # Bold Yellow
|
||||||
|
BBLUE='\e[1;34m' # Bold Blue
|
||||||
|
BPURPLE='\e[1;35m' # Bold Magenta
|
||||||
|
BCYAN='\e[1;36m' # Bold Cyan
|
||||||
|
BWHITE='\e[1;37m' # Bold White
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# Commandline args:
|
# Commandline args:
|
||||||
|
@ -85,7 +95,7 @@ do
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-c | --colors)
|
-c | --colors)
|
||||||
colors
|
colors_
|
||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
-s | --source)
|
-s | --source)
|
||||||
|
@ -105,7 +115,6 @@ do
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-v | --verbose)
|
-v | --verbose)
|
||||||
echo "prelude verbose $PRELUDE_VERBOSE"
|
|
||||||
PRELUDE_VERBOSE='true';
|
PRELUDE_VERBOSE='true';
|
||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
|
@ -118,20 +127,21 @@ 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
|
||||||
printf "$PRELUDE_VERBOSE\n"
|
|
||||||
printf "$VERBOSE_COLOR"
|
printf "$VERBOSE_COLOR"
|
||||||
|
printf "PRELUDE_VERBOSE = $PRELUDE_VERBOSE\n"
|
||||||
printf "INSTALL_DIR = $PRELUDE_INSTALL_DIR\n"
|
printf "INSTALL_DIR = $PRELUDE_INSTALL_DIR\n"
|
||||||
printf "SOURCE_URL = $PRELUDE_URL\n"
|
printf "SOURCE_URL = $PRELUDE_URL\n"
|
||||||
if [ -n $PRELUDE_SKIP_BC ]
|
printf "$RESET"
|
||||||
|
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
|
||||||
|
@ -184,17 +194,18 @@ 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
|
||||||
|
PRELUDE_INSTALL_DIR_ORIG="$PRELUDE_INSTALL_DIR"
|
||||||
# Overwrite existing?
|
# Overwrite existing?
|
||||||
if [ -n $PRELUDE_INTO ]
|
[ -n "$PRELUDE_INTO" ] || PRELUDE_INSTALL_DIR="$PRELUDE_INSTALL_DIR/prelude"
|
||||||
then
|
# Clear destination directory for git clone to work
|
||||||
# Replace existing config
|
rm -fr "$PRELUDE_INSTALL_DIR"
|
||||||
install_prelude
|
mkdir "$PRELUDE_INSTALL_DIR"
|
||||||
make_prelude_dirs
|
# Replace existing config
|
||||||
else
|
install_prelude
|
||||||
# Install into existing config
|
make_prelude_dirs
|
||||||
PRELUDE_INSTALL_DIR="$PRELUDE_INSTALL_DIR/prelude"
|
# Reinstate files that weren't replaced
|
||||||
install_prelude
|
tar --skip-old-files -xf "$PRELUDE_INSTALL_DIR_ORIG.pre-prelude.tar" "$PRELUDE_INSTALL_DIR" > /dev/null 2>&1
|
||||||
fi
|
[ -n "$PRELUDE_INTO" ] || cp "$PRELUDE_INSTALL_DIR/sample/prelude-modules.el" "$PRELUDE_INSTALL_DIR"
|
||||||
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
|
||||||
|
@ -210,16 +221,16 @@ else
|
||||||
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" ];
|
||||||
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/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"
|
||||||
|
|
Loading…
Reference in a new issue