From bbe54c3b22021bf2432ca82d7370d6129784d401 Mon Sep 17 00:00:00 2001 From: William Ting Date: Thu, 15 Mar 2012 10:16:33 -1000 Subject: [PATCH] install type is determined by /bin/zsh env var --- install.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 7ee9dae..fe52a95 100755 --- a/install.sh +++ b/install.sh @@ -39,7 +39,7 @@ function help_msg { # Default install directory. prefix=/usr -shell="bash" +shell=`echo ${SHELL} | awk -F/ '{ print $NF }'` local= user=${SUDO_USER:-${USER}} @@ -55,6 +55,10 @@ bashrc_file=${user_home}/.bashrc # Command line parsing while true; do case "$1" in + -b|--bash) + shell="bash" + shift + ;; -h|--help|-\?) help_msg; exit 0 @@ -91,6 +95,15 @@ while true; do esac done +# check shell if supported +if [[ ${shell} != "bash" ]] && [[ ${shell} != "zsh" ]]; then + echo "Unsupported shell (${shell}). Use --bash or --zsh to explicitly define shell." + exit 1 +else + echo "Installing ${shell} version." + exit 0 +fi + # check Python version python_version=`python -c 'import sys; print(sys.version_info[:])'` if [[ ${python_version:1:1} -eq 2 && ${python_version:4:1} -lt 6 ]]; then