From 45ac2985950eb9b083faf5b879cc735552f44e4c Mon Sep 17 00:00:00 2001 From: Zhang Peng Date: Fri, 12 Jul 2019 10:17:32 +0800 Subject: [PATCH] update scriptes --- codes/linux/soft/jdk8-install.sh | 4 +-- codes/linux/soft/maven-install.sh | 2 +- codes/linux/soft/nacos-install.sh | 4 +-- codes/linux/soft/nginx-install.sh | 2 +- codes/linux/soft/nodejs-install.sh | 18 ++++++++++++ codes/linux/soft/redis-install.sh | 2 +- codes/linux/soft/zookeeper-install.sh | 14 +++++++++ codes/linux/soft/zsh-install.sh | 41 ++++++++++++++++++--------- 8 files changed, 67 insertions(+), 20 deletions(-) diff --git a/codes/linux/soft/jdk8-install.sh b/codes/linux/soft/jdk8-install.sh index 71651df..9da29d4 100644 --- a/codes/linux/soft/jdk8-install.sh +++ b/codes/linux/soft/jdk8-install.sh @@ -28,8 +28,8 @@ printf "${RESET}" printf "${BLUE}>>>>>>>> install jdk8\n${RESET}" command -v yum >/dev/null 2>&1 || { -printf "${RED}Require yum but it's not installed. Aborting.\n${RESET}" -echo >&2 "Require yum but it's not installed. Aborting."; +printf "${RED}Require yum but it's not installed.\n${RESET}" +printf "${RED}Require yum but it's not installed.${RESET}\n"; exit 1; } diff --git a/codes/linux/soft/maven-install.sh b/codes/linux/soft/maven-install.sh index 6d58b7e..18be561 100644 --- a/codes/linux/soft/maven-install.sh +++ b/codes/linux/soft/maven-install.sh @@ -10,7 +10,7 @@ cat << EOF ################################################################################### EOF -command -v java >/dev/null 2>&1 || { echo >&2 "Require java but it's not installed. Aborting."; exit 1; } +command -v java >/dev/null 2>&1 || { echo >&2 "Require java but it's not installed."; exit 1; } if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then echo "Usage: sh maven-install.sh [version] [path]" diff --git a/codes/linux/soft/nacos-install.sh b/codes/linux/soft/nacos-install.sh index 0ab816d..dc17a9a 100644 --- a/codes/linux/soft/nacos-install.sh +++ b/codes/linux/soft/nacos-install.sh @@ -11,8 +11,8 @@ cat << EOF EOF -command -v java >/dev/null 2>&1 || { echo >&2 "Require java but it's not installed. Aborting."; exit 1; } -command -v mvn >/dev/null 2>&1 || { echo >&2 "Require mvn but it's not installed. Aborting."; exit 1; } +command -v java >/dev/null 2>&1 || { echo >&2 "Require java but it's not installed."; exit 1; } +command -v mvn >/dev/null 2>&1 || { echo >&2 "Require mvn but it's not installed."; exit 1; } if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then echo "Usage: sh nacos-install.sh [version] [path]" diff --git a/codes/linux/soft/nginx-install.sh b/codes/linux/soft/nginx-install.sh index 2887aef..bbe39f2 100644 --- a/codes/linux/soft/nginx-install.sh +++ b/codes/linux/soft/nginx-install.sh @@ -11,7 +11,7 @@ cat << EOF EOF -command -v yum >/dev/null 2>&1 || { echo >&2 "Require yum but it's not installed. Aborting."; exit 1; } +command -v yum >/dev/null 2>&1 || { printf "${RED}Require yum but it's not installed.${RESET}\n"; exit 1; } if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then echo "Usage: sh nginx-install.sh [version] [path]" diff --git a/codes/linux/soft/nodejs-install.sh b/codes/linux/soft/nodejs-install.sh index 4862707..cbe2519 100644 --- a/codes/linux/soft/nodejs-install.sh +++ b/codes/linux/soft/nodejs-install.sh @@ -1,5 +1,18 @@ #!/usr/bin/env bash +################################################################################### +# 控制台颜色 +BLACK="\033[1;30m" +RED="\033[1;31m" +GREEN="\033[1;32m" +YELLOW="\033[1;33m" +BLUE="\033[1;34m" +PURPLE="\033[1;35m" +CYAN="\033[1;36m" +RESET="$(tput sgr0)" +################################################################################### + +printf "${BLUE}" cat << EOF ################################################################################### @@ -9,6 +22,9 @@ cat << EOF ################################################################################### EOF +printf "${RESET}" + +printf "${BLUE}>>>>>>>> install nodejs\n${RESET}" if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then echo "Usage: sh nodejs-install.sh [version] [path]" @@ -36,3 +52,5 @@ echo -e "\n>>>>>>>>> install nodejs by nvm" nvm install ${version} nvm use ${version} node --version + +printf "${GREEN}<<<<<<<< install zsh nodejs\n${RESET}" diff --git a/codes/linux/soft/redis-install.sh b/codes/linux/soft/redis-install.sh index 7fe261f..35d41c6 100644 --- a/codes/linux/soft/redis-install.sh +++ b/codes/linux/soft/redis-install.sh @@ -10,7 +10,7 @@ cat << EOF EOF -command -v yum >/dev/null 2>&1 || { echo >&2 "Require yum but it's not installed. Aborting."; exit 1; } +command -v yum >/dev/null 2>&1 || { printf "${RED}Require yum but it's not installed.${RESET}\n"; exit 1; } if [[ $# -lt 1 ]] || [[ $# -lt 2 ]] || [[ $# -lt 3 ]] || [[ $# -lt 4 ]];then echo "Usage: sh redis-install.sh [version] [path] [port] [password]" diff --git a/codes/linux/soft/zookeeper-install.sh b/codes/linux/soft/zookeeper-install.sh index 55db52e..25e71b4 100644 --- a/codes/linux/soft/zookeeper-install.sh +++ b/codes/linux/soft/zookeeper-install.sh @@ -1,5 +1,18 @@ #!/usr/bin/env bash +################################################################################### +# 控制台颜色 +BLACK="\033[1;30m" +RED="\033[1;31m" +GREEN="\033[1;32m" +YELLOW="\033[1;33m" +BLUE="\033[1;34m" +PURPLE="\033[1;35m" +CYAN="\033[1;36m" +RESET="$(tput sgr0)" +################################################################################### + +printf "${BLUE}" cat << EOF ################################################################################### @@ -9,6 +22,7 @@ cat << EOF ################################################################################### EOF +printf "${RESET}" if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then echo "Usage: sh zookeeper-install.sh [version] [path]" diff --git a/codes/linux/soft/zsh-install.sh b/codes/linux/soft/zsh-install.sh index f115004..8d4b0cc 100644 --- a/codes/linux/soft/zsh-install.sh +++ b/codes/linux/soft/zsh-install.sh @@ -1,5 +1,18 @@ #!/usr/bin/env bash +################################################################################### +# 控制台颜色 +BLACK="\033[1;30m" +RED="\033[1;31m" +GREEN="\033[1;32m" +YELLOW="\033[1;33m" +BLUE="\033[1;34m" +PURPLE="\033[1;35m" +CYAN="\033[1;36m" +RESET="$(tput sgr0)" +################################################################################### + +printf "${BLUE}" cat << EOF ################################################################################### @@ -10,21 +23,23 @@ cat << EOF ################################################################################### EOF +printf "${RESET}" -command -v yum >/dev/null 2>&1 || { echo >&2 "Require yum but it's not installed. Aborting."; exit 1; } +printf "${BLUE}>>>>>>>> install zsh\n${RESET}" -echo -e "\n>>>>>>>>> install zsh" +command -v yum >/dev/null 2>&1 || { printf "${RED}Require yum but it's not installed.${RESET}\n"; exit 1; } + +# install zsh yum install -y zsh - -echo -e "\n>>>>>>>>> install oh-my-zsh" +# install oh-my-zsh wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh -# 替换 oh-my-zsh 主题 -sed -i "s#^ZSH_THEME=.*#ZSH_THEME=\"ys\"#g" ~/.zshrc -# 下载 incr.zsh 补全插件 -wget http://mimosa-pudica.net/src/incr-0.2cd.zsh -mkdir ~/.oh-my-zsh/plugins/incr/ -mv incr-0.2.zsh ~/.oh-my-zsh/plugins/incr/ -echo "source ~/.oh-my-zsh/plugins/incr/incr*.zsh" >> ~/.zshrc - -# 更新配置 +# choose oh-my-zsh theme +sed -i "s/^ZSH_THEME=.*/ZSH_THEME=\"ys\"/g" ~/.zshrc +# install oh-my-zsh plugins +git clone https://github.com/zsh-users/zsh-autosuggestions.git ~/.oh-my-zsh/plugins/zsh-autosuggestions +git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/plugins/zsh-syntax-highlighting +sed -i "s/^plugins=.*/plugins=(git z wd extract zsh-autosuggestions zsh-syntax-highlighting)/g" ~/.zshrc +# reload zsh source ~/.zshrc + +printf "${GREEN}<<<<<<<< install zsh finished\n${RESET}"