From 329b27eeeb8aa1e5210756a7ceb68dd1c6e61652 Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Thu, 27 Apr 2017 16:58:43 -0400 Subject: [PATCH] add pipefails Signed-off-by: Jess Frazelle --- gitserver/start.sh | 1 + kernel-builder/install_kernel | 1 + kvm/start.sh | 1 + latest-versions.sh | 1 + mpd/mpd.sh | 3 ++- slapd/start.sh | 1 + sublime-text-3/run.sh | 2 ++ test.sh | 1 + vscode/start.sh | 9 ++++++++- ykpersonalize/entrypoint.sh | 2 ++ yubico-piv-tool/entrypoint.sh | 2 ++ 11 files changed, 22 insertions(+), 2 deletions(-) diff --git a/gitserver/start.sh b/gitserver/start.sh index 188997d..31ed253 100755 --- a/gitserver/start.sh +++ b/gitserver/start.sh @@ -1,5 +1,6 @@ #!/bin/sh set -e +set -o pipefail [ "$DEBUG" == 'true' ] && set -x diff --git a/kernel-builder/install_kernel b/kernel-builder/install_kernel index 8c82a31..a4a938c 100755 --- a/kernel-builder/install_kernel +++ b/kernel-builder/install_kernel @@ -1,5 +1,6 @@ #!/bin/bash set -e +set -o pipefail GRSEC_VERSION=3.1-4.4.5-201603142220 diff --git a/kvm/start.sh b/kvm/start.sh index 8967ee0..7b0ef55 100755 --- a/kvm/start.sh +++ b/kvm/start.sh @@ -1,5 +1,6 @@ #!/bin/bash set -e +set -o pipefail # add the correct user perms gpasswd -a root libvirt diff --git a/latest-versions.sh b/latest-versions.sh index 573533c..d71ddf8 100755 --- a/latest-versions.sh +++ b/latest-versions.sh @@ -1,6 +1,7 @@ # This script gets the latest GitHub releases for the specified projects. #!/bin/bash set -e +set -o pipefail if [[ -z "$GITHUB_TOKEN" ]]; then echo "Set the GITHUB_TOKEN env variable." diff --git a/mpd/mpd.sh b/mpd/mpd.sh index 82c6049..2c58091 100755 --- a/mpd/mpd.sh +++ b/mpd/mpd.sh @@ -1,5 +1,6 @@ #!/bin/bash - +set -e +set -o pipefail mkdir -p /var/lib/mpd/{playlists,music} \ && touch /var/lib/mpd/{state,tag_cache} \ diff --git a/slapd/start.sh b/slapd/start.sh index 5a6a78d..5f2ce82 100755 --- a/slapd/start.sh +++ b/slapd/start.sh @@ -1,5 +1,6 @@ #!/bin/bash set -e +set -o pipefail : LDAP_ROOTPASS=${LDAP_ROOTPASS} : LDAP_DOMAIN=${LDAP_DOMAIN} diff --git a/sublime-text-3/run.sh b/sublime-text-3/run.sh index d97c0c3..723f321 100644 --- a/sublime-text-3/run.sh +++ b/sublime-text-3/run.sh @@ -1,5 +1,7 @@ #!/bin/bash set -e +set -o pipefail + if [ -z ${NEWUSER+x} ]; then echo 'WARN: No user was defined, defaulting to root.' echo 'WARN: Sublime will save files as root:root.' diff --git a/test.sh b/test.sh index 0b99724..40c8ecd 100755 --- a/test.sh +++ b/test.sh @@ -1,5 +1,6 @@ #!/bin/bash set -e +set -o pipefail # this is kind of an expensive check, so let's not do this twice if we # are running more than one validate bundlescript diff --git a/vscode/start.sh b/vscode/start.sh index 54c8821..cccebf9 100755 --- a/vscode/start.sh +++ b/vscode/start.sh @@ -1,4 +1,11 @@ #!/bin/bash +set -e +set -o pipefail -su user -c /usr/bin/editor +VSCODE_COMMAND=/usr/bin/code +if [[ ! -f "${VSCODE_COMMAND}" ]]; then + >&2 echo "${VSCODE_COMMAND} does not exist" + exit 1 +fi +su user -c "${VSCODE_COMMAND}" sleep infinity diff --git a/ykpersonalize/entrypoint.sh b/ykpersonalize/entrypoint.sh index 6bc3b42..fe72a9d 100755 --- a/ykpersonalize/entrypoint.sh +++ b/ykpersonalize/entrypoint.sh @@ -1,4 +1,6 @@ #!/bin/bash +set -e +set -o pipefail init(){ local pcscd_running=$(ps -aux | grep [p]cscd) diff --git a/yubico-piv-tool/entrypoint.sh b/yubico-piv-tool/entrypoint.sh index 6bc3b42..fe72a9d 100755 --- a/yubico-piv-tool/entrypoint.sh +++ b/yubico-piv-tool/entrypoint.sh @@ -1,4 +1,6 @@ #!/bin/bash +set -e +set -o pipefail init(){ local pcscd_running=$(ps -aux | grep [p]cscd)