Added "set -e", implemented manual installation of oh-my-zsh, fixed

installation of plugins
This commit is contained in:
Andreas Fendt 2019-02-19 23:38:47 +01:00
parent 4d1ac99ac3
commit 79211594b1

View File

@ -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