diff --git a/install.sh b/install.sh index 5e019fd..73aa5a9 100644 --- a/install.sh +++ b/install.sh @@ -9,68 +9,6 @@ function show_help { exit 2 } -PARSED_ARGUMENTS=$(getopt -a -n install.sh -o hvyi:acrbm:p --long yes,help,debug,arch: -- "$@") -VALID_ARGUMENTS=$? -if [ "$VALID_ARGUMENTS" != "0" ]; then - usage -fi - -ARCH=$(/usr/bin/dpkg --print-architecture) - -echo "PARSED_ARGUMENTS is $PARSED_ARGUMENTS" -eval set -- "$PARSED_ARGUMENTS" -while : -do - case "$1" in - -h | --help) show_help ;; - -v) P_Verbose=1 ; shift ;; - -d | --debug) P_Debug=1 ; shift ;; - -y) P_Yes=1 ; shift ;; - -p) P_APT=1; P_DEB=1 ; shift ;; - -c) P_CONFIG=1 ; shift ;; - -r) P_RC=1 ; shift ;; - -b) P_BINARY=1 ; shift ;; - -i) P_Install="$2"; shift 2 ;; - -m | --arch) ARCH="$2" ; shift 2 ;; - -z) P_ZSH=1 ; shift ;; - -a) P_APT=1; P_DEB=1; P_CONFIG=1; P_RC=1; P_BINARY=1; P_ZSH=1; shift ;; - # -- means the end of the arguments; drop this, and break out of the while loop - --) shift; break ;; - # If invalid options were passed, then getopt should have reported an error, - # which we checked as VALID_ARGUMENTS when getopt was called... - *) echo "Unexpected option: $1 - this should not happen." - usage ;; - esac -done - -while : -do - case "$1" in - update) update ;; - install) install; shift ;; - # -- means the end of the arguments; drop this, and break out of the while loop - --) shift; break ;; - # If invalid options were passed, then getopt should have reported an error, - # which we checked as VALID_ARGUMENTS when getopt was called... - *) echo "Unexpected option: $1 - this should not happen." - usage ;; - esac -done - -echo "Parameters remaining are: $@" - - -ASK="\e[34m" -INFO="\e[91m\e[1m" -ADD="\e[32m\e[1m" -ENDCOLOR="\e[0m" - -HOME_PATH="$HOME" -TMP_PATH="$HOME_PATH/tmp/kamu_install" -CONFIG_PATH="$HOME_PATH/.config" -BINARY_PATH="/usr/bin" -RC_FILE=".zshrc" - function log { color $1 "[$2]" echo "$3" @@ -399,4 +337,63 @@ function install { cleanup exit 0 -} \ No newline at end of file +} + +PARSED_ARGUMENTS=$(getopt -a -n install.sh -o hvyi:acrbm:p --long yes,help,debug,arch: -- "$@") +VALID_ARGUMENTS=$? +if [ "$VALID_ARGUMENTS" != "0" ]; then + usage +fi + +ARCH=$(/usr/bin/dpkg --print-architecture) + +echo "PARSED_ARGUMENTS is $PARSED_ARGUMENTS" +eval set -- "$PARSED_ARGUMENTS" +while : +do + case "$1" in + -h | --help) show_help ;; + -v) P_Verbose=1 ; shift ;; + -d | --debug) P_Debug=1 ; shift ;; + -y) P_Yes=1 ; shift ;; + -p) P_APT=1; P_DEB=1 ; shift ;; + -c) P_CONFIG=1 ; shift ;; + -r) P_RC=1 ; shift ;; + -b) P_BINARY=1 ; shift ;; + -i) P_Install="$2"; shift 2 ;; + -m | --arch) ARCH="$2" ; shift 2 ;; + -z) P_ZSH=1 ; shift ;; + -a) P_APT=1; P_DEB=1; P_CONFIG=1; P_RC=1; P_BINARY=1; P_ZSH=1; shift ;; + # -- means the end of the arguments; drop this, and break out of the while loop + --) shift; break ;; + # If invalid options were passed, then getopt should have reported an error, + # which we checked as VALID_ARGUMENTS when getopt was called... + *) echo "Unexpected option: $1" + show_help ;; + esac +done + +echo "Parameters remaining are: $@" + +ASK="\e[34m" +INFO="\e[91m\e[1m" +ADD="\e[32m\e[1m" +ENDCOLOR="\e[0m" + +HOME_PATH="$HOME" +TMP_PATH="$HOME_PATH/tmp/kamu_install" +CONFIG_PATH="$HOME_PATH/.config" +BINARY_PATH="/usr/bin" +RC_FILE=".zshrc" + + +case "$1" in + update) update ;; + install) install; shift ;; + # -- means the end of the arguments; drop this, and break out of the while loop + --) shift; break ;; + # If invalid options were passed, then getopt should have reported an error, + # which we checked as VALID_ARGUMENTS when getopt was called... + *) echo "Unexpected option: $1" + show_help ;; +esac