From e53b6146b574bf68ddd2352571814be3f348aa87 Mon Sep 17 00:00:00 2001 From: "jun.wang6" Date: Fri, 4 Jun 2021 16:40:02 +0800 Subject: [PATCH] handle the case that failed on curl kube-ps1.sh Signed-off-by: jun.wang6 --- assets/install-kube-ps1-bash | 8 +++++--- assets/install-kube-ps1-zsh | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/assets/install-kube-ps1-bash b/assets/install-kube-ps1-bash index 918e872..5949596 100755 --- a/assets/install-kube-ps1-bash +++ b/assets/install-kube-ps1-bash @@ -2,10 +2,12 @@ SCRIPT_DIR=$(cd $(dirname "$0"); pwd -P) -if [ -f ~/.bashrc ] && ! grep -q "kube_ps1" ~/.bashrc; then - curl -sLO https://raw.githubusercontent.com/jonmosco/kube-ps1/master/kube-ps1.sh && \ - chmod +x kube-ps1.sh +if [ ! -x kube-ps1.sh ]; then + curl -sLO https://raw.githubusercontent.com/jonmosco/kube-ps1/master/kube-ps1.sh + chmod +x kube-ps1.sh +fi +if [ -f ~/.bashrc ] && ! grep -q "kube_ps1" ~/.bashrc; then cat "${SCRIPT_DIR}/config/bash-kube" >> ~/.bashrc fi diff --git a/assets/install-kube-ps1-zsh b/assets/install-kube-ps1-zsh index a528775..b368505 100755 --- a/assets/install-kube-ps1-zsh +++ b/assets/install-kube-ps1-zsh @@ -2,9 +2,11 @@ SCRIPT_DIR=$(cd $(dirname "$0"); pwd -P) -if [ -f ~/.zshrc ] && ! grep -q "kube_ps1" ~/.zshrc; then - curl -sLO https://raw.githubusercontent.com/jonmosco/kube-ps1/master/kube-ps1.sh && \ - chmod +x kube-ps1.sh +if [ ! -x kube-ps1.sh ]; then + curl -sLO https://raw.githubusercontent.com/jonmosco/kube-ps1/master/kube-ps1.sh + chmod +x kube-ps1.sh +fi +if [ -f ~/.zshrc ] && ! grep -q "kube_ps1" ~/.zshrc; then cat "${SCRIPT_DIR}/config/zsh-kube" >> ~/.zshrc fi