From a063527886ada1bd92743acb47cdf1a47fd160fe Mon Sep 17 00:00:00 2001 From: Andreas Fendt Date: Wed, 20 Feb 2019 00:02:55 +0100 Subject: [PATCH] Fixed subroutines --- install-debian.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/install-debian.sh b/install-debian.sh index 2fffebf..bb88ff1 100644 --- a/install-debian.sh +++ b/install-debian.sh @@ -9,7 +9,7 @@ # create the temporary script script=/tmp/install-script cat > $script << 'EOL' -# change behaviour of bash +# change behavior of bash set -e # configure vim @@ -24,12 +24,16 @@ configure-vim() { # install fzf install-fzf() { - [ ! -d ~/.fzf ]&& cd ~ && git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install + if [ ! -d ~/.fzf ]; then + cd ~ && git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install + else + echo "fzf is already installed for $(id)" + fi } # install oh-my-zsh install-ohmyzsh() { - [ ! -d ~/.oh-my-zsh ] && ( + if [ ! -d ~/.oh-my-zsh ]; then # install oh-my-zsh git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh cp ~/.zshrc ~/.zshrc.orig @@ -43,7 +47,9 @@ install-ohmyzsh() { if [[ $EUID -ne 0 ]]; then grep "ZSH_TMUX_AUTOSTART" ~/.zshrc || sed -i -- '1s/^/ZSH_TMUX_AUTOSTART="true"\nZSH_TMUX_AUTOQUIT="false"\n\n/' ~/.zshrc fi - ) + else + echo "oh-my-zsh is already installed for $(id)" + fi } # call target function depending of the arguments @@ -52,7 +58,7 @@ exit 0 EOL chmod +x $script -# change behaviour of bash +# change behavior of bash set -e # check if root