Merge "set -u and -o pipefail everywhere"

This commit is contained in:
Jenkins 2014-05-08 08:53:21 +00:00 committed by Gerrit Code Review
commit b77ab85b22
84 changed files with 141 additions and 62 deletions

View File

@ -2,6 +2,7 @@
# Override the default /etc/apt/apt.conf with $DIB_APT_CONF
set -ue
set -o pipefail
# exit directly if DIB_APT_CONF is not defined properly
if [ -z "${DIB_APT_CONF:-}" ] ; then

View File

@ -1,7 +1,8 @@
#!/bin/bash
# Override the default /etc/apt/sources.list with $DIB_APT_SOURCES
set -e
set -eu
set -o pipefail
# exit directly if DIB_APT_SOURCES is not defined properly
if [ -z "$DIB_APT_SOURCES" ] ; then

View File

@ -14,7 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
set -e
set -eu
set -o pipefail
[ -n "$TARGET_ROOT" ]

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
# As this is run in cleanup, it's already been automatically unmounted,
# so all we need to do here is remove the directory

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
set -o xtrace
touch /var/log/first-boot.d.log

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -eu
set -o pipefail
if [ -f /sbin/initctl ]; then
echo "upstart"

View File

@ -1,7 +1,9 @@
#!/bin/bash
# Store the build-time environment and command line arguments
set -e
set -eu
set -o pipefail
source $_LIB/die
[ -n "$TMP_HOOKS_PATH" ] || die "Temp hook path not set"

View File

@ -15,6 +15,7 @@
set -eux
set -o pipefail
declare -a SPECIFIED_ELEMS

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
if [ -d /etc/first-boot.d ]; then
install -m 0755 -o root -g root $(dirname $0)/../dib-first-boot /usr/sbin/

View File

@ -1,6 +1,7 @@
#!/bin/bash
# These are useful, or at worst not harmful, for all images we build.
set -e
set -eu
set -o pipefail
install-packages vlan open-iscsi

View File

@ -1,7 +1,8 @@
#!/bin/bash
# Tweak the stock ubuntu cloud-init config
set -e
set -eu
set -o pipefail
dd of=/etc/cloud/cloud.cfg.d/10_etc_hosts.cfg << EOF
manage_etc_hosts: True

View File

@ -1,7 +1,8 @@
#!/bin/bash
# Store build-time environment and command line arguments
set -e
set -eu
set -o pipefail
if [ -e "/tmp/in_target.d/dib_environment" ]; then
cp /tmp/in_target.d/dib_environment /etc/

View File

@ -1,7 +1,8 @@
#!/bin/bash
# Install baseline packages and tools.
set -e
set -eu
set -o pipefail
# If lsb_release is missing, just do nothing.
DISTRO=`lsb_release -si` || true

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
install -m 0755 -o root -g root $(dirname $0)/../dib-init-system /usr/bin/

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
# Don't do anything if already mounted (if disk-image-create is invoked with
# no elements specified, this hook actually fires twice, once during

View File

@ -15,7 +15,8 @@
# License for the specific language governing permissions and limitations
# under the License.
set -e
set -eu
set -o pipefail
# Download a URL to a local cache
# e.g. cache-url http://.../foo ~/.cache/image-create/foo

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -eux
set -o pipefail
cat > ${TARGET_ROOT}/.extra_settings << EOF
DIB_DEBIAN_ALT_INIT_PACKAGE=systemd-sysv
EOF

View File

@ -1,5 +1,7 @@
#!/bin/bash
set -eux
set -o pipefail
cat > ${TARGET_ROOT}/.extra_settings << EOF
DIB_DEBIAN_ALT_INIT_PACKAGE=upstart
EOF

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -eux
set -o pipefail
# Working around bug in Debian cloud-init packages with upstart
# where startpar will wait forever for these because they are tasks
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=735204

View File

@ -15,6 +15,7 @@
# under the License.
#
set -eu
set -o pipefail
if [ -f ${TARGET_ROOT}/.extra_settings ] ; then
. ${TARGET_ROOT}/.extra_settings
fi

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
INTERFACE=${1:-} #optional, if not specified configure all available interfaces
ENI_FILE="/etc/network/interfaces"
@ -68,7 +69,7 @@ function config_exists() {
return 0
fi
else
ifquery $interface >/dev/null 2>&1 && return 0
ifquery $interface >/dev/null 2>&1 && return 0 || return 1
fi
return 1
}

View File

@ -19,6 +19,7 @@ allowed_regex=${RUN_PARTS_REGEX:-"^[0-9A-Za-z_-]+$"}
show_list=
set -ue
set -o pipefail
name=$(basename $0)

View File

@ -1,6 +1,6 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
home=$(dirname $0)

View File

@ -14,7 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
set -e
set -eu
set -o pipefail
# install-packages package [package ...]

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
[ -n "$TARGET_ROOT" ]

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
[ -n "$TARGET_ROOT" ]

View File

@ -1,6 +1,7 @@
#!/bin/bash
# Do an apt-get clean. This will free some space.
set -e
set -eu
set -o pipefail
apt-get clean

View File

@ -15,6 +15,7 @@
# under the License.
#
set -eux
set -o pipefail
DPKG_MANIFEST_NAME=dib-manifest-dpkg-$(basename ${IMAGE_NAME})

View File

@ -1,6 +1,7 @@
#!/bin/bash
# Do an apt-get update, so that packages can be installed.
set -e
set -eu
set -o pipefail
apt-get -y update

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
[ -n "$TARGET_ROOT" ]

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
[ -n "$TARGET_ROOT" ]

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
[ -n "$TARGET_ROOT" ]

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
install-packages dracut-network patch

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -eu
set -o pipefail
[ -n "$ARCH" ]
[ -n "$TARGET_ROOT" ]

View File

@ -1,7 +1,8 @@
#!/bin/bash
# Support for hard ware discovery
set -e
set -eu
set -o pipefail
set -o xtrace
install-packages hwinfo

View File

@ -2,7 +2,9 @@
# Save user SSH public key if available.
# (Obviously not suitable for downloadable images).
set -e
set -eu
set -o pipefail
source $_LIB/die
[ -n "$TMP_HOOKS_PATH" ] || die "Temp hook path not set"

View File

@ -2,7 +2,8 @@
# Save user SSH public key if available.
# XXX: Obviously not suitable for downloadable images.
set -e
set -eu
set -o pipefail
if [ -e "/tmp/in_target.d/ssh-authorized-keys" ]; then
mkdir -p /root/.ssh

View File

@ -2,7 +2,8 @@
# Save the HTTP/[S] and noproxy settings if available.
# XXX: Obviously not suitable for downloadable images.
set -e
set -eu
set -o pipefail
set -o xtrace
have_apt=

View File

@ -15,6 +15,7 @@
# under the License.
#
set -eux
set -o pipefail
if [ -d $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR} ]; then
# Move the dib_environment and dib_arguments files into the manifests dir

View File

@ -15,6 +15,7 @@
# under the License.
#
set -eu
set -o pipefail
export DIB_MANIFEST_IMAGE_DIR=${DIB_MANIFEST_IMAGE_DIR:-/etc/dib-manifests}
export DIB_MANIFEST_SAVE_DIR=${DIB_MANIFEST_SAVE_DIR:-${IMAGE_NAME}.d/}

View File

@ -15,5 +15,6 @@
# under the License.
#
set -eux
set -o pipefail
sudo mkdir -p $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR}

View File

@ -1,7 +1,8 @@
#!/bin/bash
# Ensure we load the mellanox driver somehow
set -e
set -eu
set -o pipefail
home=$(dirname $0)

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -ex
set -eux
set -o pipefail
MODULES_LIST=${DIB_MODPROBE_BLACKLIST:?"Please set DIB_MODPROBE_BLACKLIST."}

View File

@ -14,7 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
set -e
set -eu
set -o pipefail
function run_zypper() {
# TODO: Uncertain if this can ever block wanting input from user

View File

@ -1,7 +1,7 @@
#!/bin/bash
set -e
set -x
set -eux
set -o pipefail
export OPENSUSE_EXTRAS_PATH="$TMP_MOUNT_PATH/tmp/opensuse-extras"
mkdir -p $OPENSUSE_EXTRAS_PATH

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
# Setup ccache symlinks, as openSUSE's ccache package doesn't
# include them.

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
sed -i -e "s,^USERGROUPS_ENAB.*$,USERGROUPS_ENAB yes," /etc/login.defs

View File

@ -3,6 +3,7 @@
# here.
set -eu
set -o pipefail
# To have access to FS_TYPE
_LIB="/tmp/opensuse-extras"

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -eu
set -o pipefail
[ -n "$ARCH" ]
[ -n "$TARGET_ROOT" ]

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
PIP_CACHE_DIR=$HOME/.cache/image-create/pip
mkdir -p $PIP_CACHE_DIR

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -eu
set -o pipefail
PYPI_MIRROR_URL=${PYPI_MIRROR_URL:-''}
if [ -n "$PYPI_MIRROR_URL" ]; then

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -eu
set -o pipefail
if [ -e ~/.pip/pip.conf.orig ]; then
mv ~/.pip/pip.conf{.orig,}

View File

@ -1,7 +1,7 @@
#!/bin/bash
set -e
set -x
set -eux
set -o pipefail
IMAGE_NAME=${IMAGE_NAME:-'image'}

View File

@ -1,7 +1,7 @@
#!/bin/bash
set -e
set -x
set -eux
set -o pipefail
export RAMDISK_BUILD_PATH="$TMP_MOUNT_PATH/tmp/ramdisk-build"
mkdir -p $RAMDISK_BUILD_PATH

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -eux
set -o pipefail
DISTRO=`lsb_release -si` || true

View File

@ -1,8 +1,8 @@
#!/bin/bash
# Ensure that all binaries listed in ramdisk elements, exist
set -e
set -x
set -eux
set -o pipefail
export TARGET_DIR="/tmp/in_target.d/"

View File

@ -1,7 +1,7 @@
#!/bin/bash
set -e
set -x
set -eux
set -o pipefail
_LIB="/tmp/ramdisk-build"

View File

@ -5,6 +5,7 @@
set -eu
set -o pipefail
BASE_IMAGE_FILE=$1
BASE_IMAGE_TAR=$2

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -eux
set -o pipefail
rm -rf /tmp/grub

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
if [ -d /etc/first-boot.d ]; then
rc_local=/etc/rc.d/rc.local

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -eu
set -o pipefail
install -m 0755 -o root -g root /opt/stack/lsb-release/lsb_release /usr/local/bin

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
yum remove -y grub2
# Install grub2 dependencies to minimise packages installed during finalise.

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
if [ -n "$DIB_RHSM_USER" ] && [ -n "$DIB_RHSM_PASSWORD" ]; then
if [[ "$DIB_REG_TYPE" == "rhn" ]]; then

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
if [ -n "$DIB_RHSM_USER" ] && [ -n "$DIB_RHSM_PASSWORD" ]
then

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -eu
set -o pipefail
[ -n "$ARCH" ]
[ -n "$TARGET_ROOT" ]

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -eu
set -o pipefail
[ -n "$ARCH" ]
[ -n "$TARGET_ROOT" ]

View File

@ -1,6 +1,6 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
if [ "i386" = "$ARCH" ]; then

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -uex
set -o pipefail
SCRIPTDIR=$(dirname $0)
DIB_INIT_SYSTEM=$(dib-init-system)

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -eu
set -o pipefail
# If the old cache exists, move it to the new name
function make_new_cache(){

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -uex
set -o pipefail
# Git isn't a dependency of this element, but is a dependency of pbr
# if you are doing pip install on a git cloned directoy, because this

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
if [ -d /etc/first-boot.d ]; then
rc_local=/etc/rc.local

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
# Ubuntu's cloud images don't include drivers for real hardware.
install-packages linux-image-generic

View File

@ -3,7 +3,8 @@
# found (as happens in a chroot).
# Temporarily remove grub, to avoid that confusion.
set -e
set -eu
set -o pipefail
if dpkg-query -W grub-pc; then
apt-get -y remove grub-pc

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -eu
set -o pipefail
DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-}

View File

@ -2,6 +2,7 @@
# These are useful, or at worst not harmful, for all images we build.
set -eu
set -o pipefail
[ -n "$ARCH" ]
[ -n "$TARGET_ROOT" ]

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
source $_LIB/die
[ -n "$IMAGE_BLOCK_DEVICE" ] || die "Image block device not set"

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -eux
set -o pipefail
if [ "openSUSE project" = "$(lsb_release -is)" ]; then
# workaround for https://bugzilla.novell.com/show_bug.cgi?id=859493

View File

@ -3,8 +3,8 @@
# Configure grub. Note that the various conditionals here are to handle
# different distributions gracefully.
set -e
set -x
set -eux
set -o pipefail
# FIXME:
[ -n "$IMAGE_BLOCK_DEVICE" ]

View File

@ -14,7 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
set -e
set -eu
set -o pipefail
EXTRA_ARGS=
ACTION=install

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
sudo sed -i 's/keepcache=0/keepcache=1/' /etc/yum.conf
sudo sed -i 's/cachedir=\/var\/cache\/yum/cachedir=\/tmp\/yum/' /etc/yum.conf

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
[ -n "$TARGET_ROOT" ]

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
# Disable caching packages for all repositories
sudo zypper modifyrepo --all --no-keep-packages

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
# Enable caching packages for all repositories
sudo zypper modifyrepo --all --keep-packages

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -eu
set -o pipefail
[ -n "$TARGET_ROOT" ]