From 13183254e1ab3d9f5874dd1d8a48342f744623f1 Mon Sep 17 00:00:00 2001 From: Tobias Schmidl Date: Fri, 23 Nov 2018 10:17:31 +0100 Subject: [PATCH] set -e option, so that we fail as early as possible --- bootstrap-root.sh | 2 ++ bootstrap-user.sh | 3 +++ bootstrap.sh | 2 ++ docker-install.sh | 3 +++ 4 files changed, 10 insertions(+) diff --git a/bootstrap-root.sh b/bootstrap-root.sh index 98180be..1eaf179 100755 --- a/bootstrap-root.sh +++ b/bootstrap-root.sh @@ -1,4 +1,6 @@ #! /bin/bash +# fail immediately on error +set -e bash -c "apt update && apt dist-upgrade && \ apt install bash-completion locales man mc elinks git zsh curl neovim byobu htop \ diff --git a/bootstrap-user.sh b/bootstrap-user.sh index b266bdf..6f25117 100755 --- a/bootstrap-user.sh +++ b/bootstrap-user.sh @@ -1,4 +1,7 @@ #! /bin/bash +# fail immediately on error +set -e + TMPDIR=$(mktemp -u -p "$HOME" -d dotfiles.XXXXX) && \ git clone --separate-git-dir="$HOME/.cfg" https://github.com/schtobia/dotfiles.git "$TMPDIR" && \ [ -r "$TMPDIR/.gitmodules" ] && cp -vi "$TMPDIR/.gitmodules" "$HOME" diff --git a/bootstrap.sh b/bootstrap.sh index bfdc684..821373f 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,4 +1,6 @@ #! /bin/sh +# fail immediately on error +set -e # root part curl -RLSsf1 https://github.com/schtobia/bootstrap/raw/master/bootstrap-root.sh | sudo -SEH bash - diff --git a/docker-install.sh b/docker-install.sh index 91f35e8..b45c98c 100755 --- a/docker-install.sh +++ b/docker-install.sh @@ -1,4 +1,7 @@ #! /bin/bash +# fail immediately on error +set -e + [ "$UID" -ne 0 ] && { echo "You must run this script as root." >&2; exit 1; } (DISTRO=$(lsb_release -is | tr '[A-Z]' '[a-z]'); curl -LSsf https://download.docker.com/linux/$DISTRO/gpg | apt-key add - && \ add-apt-repository "deb https://download.docker.com/linux/$DISTRO $(lsb_release -cs) stable" && \