From 79211594b1c6e4d78569f6d4206d32fe583d01fe Mon Sep 17 00:00:00 2001 From: Andreas Fendt Date: Tue, 19 Feb 2019 23:38:47 +0100 Subject: [PATCH] Added "set -e", implemented manual installation of oh-my-zsh, fixed installation of plugins --- install-debian.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/install-debian.sh b/install-debian.sh index fcf007b..1fc2fe2 100644 --- a/install-debian.sh +++ b/install-debian.sh @@ -2,12 +2,16 @@ # Install Script for Debian and Ubuntu installations # This script can be called multiple times -# Copyright (C) 2018 Andreas Fendt - All Rights Reserved +# Copyright (C) 2019 Andreas Fendt - All Rights Reserved # Permission to copy and modify is granted under the MIT license -# Last revised 28.12.2018 +# Last revised 19.02.2019 +# create the temporary script script=/tmp/install-script cat > $script << 'EOL' +# change behaviour of bash +set -e + # configure vim configure-vim() { touch ~/.vimrc @@ -26,11 +30,14 @@ install-fzf() { # install oh-my-zsh install-ohmyzsh() { [ ! -d ~/.oh-my-zsh ] && ( - sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" + # install oh-my-zsh + git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh + cp ~/.zshrc ~/.zshrc.orig + cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc # configure oh-my-zsh grep 'ZSH_THEME="agnoster"' ~/.zshrc || sed -i -- 's/ZSH_THEME=".*"/ZSH_THEME="agnoster"/g' ~/.zshrc - grep "command-not-found" ~/.zshrc || sed -i -- '/^plugins=(/a \\ command-not-found\n common-aliases\n sudo\n systemd\n tmux\n ubuntu' ~/.zshrc + grep "command-not-found" ~/.zshrc || sed -i -- '/^plugins=(/s/git/command-not-found common-aliases git sudo systemd tmux ubuntu/' ~/.zshrc # configure tmux on normal user if [[ $EUID -ne 0 ]]; then @@ -43,6 +50,9 @@ $@ EOL chmod +x $script +# change behaviour of bash +set -e + # check if root if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 @@ -94,7 +104,6 @@ dpkg-reconfigure console-data console-setup locales \ # run programs apt-file update -sensors-detect --auto # delete temporary script file rm -f $script