Skip to content

Commit 4dd351c

Browse files
Container image build fixes: (#229)
- Error on failure to install any package into the container image. - Don't use an empty array as a command (for older Bash versions).
1 parent 8f58c5e commit 4dd351c

13 files changed

+88
-8
lines changed

components/core/tools/scripts/lib_install/centos7.4/install-all.sh

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/usr/bin/env bash
22

3+
# Exit on any error
4+
set -e
5+
6+
# Error on undefined variable
7+
set -u
8+
39
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
410

511
"$script_dir"/install-prebuilt-packages.sh

components/core/tools/scripts/lib_install/centos7.4/install-packages-from-source.sh

+8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
#!/usr/bin/env bash
22

3+
# Exit on any error
4+
set -e
5+
36
# Enable gcc 10
47
source /opt/rh/devtoolset-10/enable
58

69
# Enable git
710
source /opt/rh/rh-git227/enable
811

12+
# Error on undefined variable
13+
# NOTE: We enable this *after* sourcing the scripts above since we can't guarantee they won't have
14+
# unbound variables in them.
15+
set -u
16+
917
# NOTE: cmake and boost must be installed first since the remaining packages depend on them
1018
./tools/scripts/lib_install/install-cmake.sh 3.21.2
1119
./tools/scripts/lib_install/install-boost.sh 1.76.0

components/core/tools/scripts/lib_install/centos7.4/install-prebuilt-packages.sh

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/usr/bin/env bash
22

3+
# Exit on any error
4+
set -e
5+
6+
# Error on undefined variable
7+
set -u
8+
39
yum install -y \
410
bzip2 \
511
centos-release-scl \

components/core/tools/scripts/lib_install/macos-12/install-all.sh

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/usr/bin/env bash
22

3+
# Exit on any error
4+
set -e
5+
6+
# Error on undefined variable
7+
set -u
8+
39
brew update
410
brew install \
511
boost \

components/core/tools/scripts/lib_install/mongoc.sh

+10-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ if [ $installed -eq 0 ] ; then
4343
fi
4444

4545
echo "Checking for elevated privileges..."
46-
install_command_prefix_args=()
46+
install_cmd_args=()
4747
if [ ${EUID:-$(id -u)} -ne 0 ] ; then
4848
sudo echo "Script can elevate privileges."
49-
install_command_prefix_args+=("sudo")
49+
install_cmd_args+=("sudo")
5050
fi
5151

5252
# Download
@@ -84,7 +84,7 @@ set -e
8484

8585
# Install
8686
if [ $checkinstall_installed -eq 0 ] ; then
87-
install_command_prefix_args+=(
87+
install_cmd_args+=(
8888
checkinstall
8989
--pkgname "${package_name}"
9090
--pkgversion "${version}"
@@ -94,7 +94,13 @@ if [ $checkinstall_installed -eq 0 ] ; then
9494
--pakdir "${deb_output_dir}"
9595
)
9696
fi
97-
"${install_command_prefix_args[@]}" cmake --build . --target install --parallel
97+
install_cmd_args+=(
98+
cmake
99+
--build .
100+
--target install
101+
--parallel
102+
)
103+
"${install_cmd_args[@]}"
98104

99105
# Clean up
100106
rm -rf "$temp_dir"

components/core/tools/scripts/lib_install/mongocxx.sh

+10-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ if [ $installed -eq 0 ] ; then
4343
fi
4444

4545
echo "Checking for elevated privileges..."
46-
install_command_prefix_args=()
46+
install_cmd_args=()
4747
if [ ${EUID:-$(id -u)} -ne 0 ] ; then
4848
sudo echo "Script can elevate privileges."
49-
install_command_prefix_args+=("sudo")
49+
install_cmd_args+=("sudo")
5050
fi
5151

5252
# Download
@@ -86,7 +86,7 @@ set -e
8686

8787
# Install
8888
if [ $checkinstall_installed -eq 0 ] ; then
89-
install_command_prefix_args+=(
89+
install_cmd_args+=(
9090
checkinstall
9191
--pkgname "${package_name}"
9292
--pkgversion "${version}"
@@ -96,7 +96,13 @@ if [ $checkinstall_installed -eq 0 ] ; then
9696
--pakdir "${deb_output_dir}"
9797
)
9898
fi
99-
"${install_command_prefix_args[@]}" cmake --build . --target install --parallel
99+
install_cmd_args+=(
100+
cmake
101+
--build .
102+
--target install
103+
--parallel
104+
)
105+
"${install_cmd_args[@]}"
100106

101107
# Clean up
102108
rm -rf "$temp_dir"

components/core/tools/scripts/lib_install/ubuntu-focal/install-all.sh

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/usr/bin/env bash
22

3+
# Exit on any error
4+
set -e
5+
6+
# Error on undefined variable
7+
set -u
8+
39
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
410

511
"$script_dir"/install-prebuilt-packages.sh

components/core/tools/scripts/lib_install/ubuntu-focal/install-packages-from-source.sh

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/usr/bin/env bash
22

3+
# Exit on any error
4+
set -e
5+
6+
# Error on undefined variable
7+
set -u
8+
39
./tools/scripts/lib_install/fmtlib.sh 8.0.1
410
./tools/scripts/lib_install/libarchive.sh 3.5.1
511
./tools/scripts/lib_install/lz4.sh 1.8.2

components/core/tools/scripts/lib_install/ubuntu-focal/install-prebuilt-packages.sh

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/usr/bin/env bash
22

3+
# Exit on any error
4+
set -e
5+
6+
# Error on undefined variable
7+
set -u
8+
39
apt-get update
410
DEBIAN_FRONTEND=noninteractive apt-get install -y \
511
ca-certificates \

components/core/tools/scripts/lib_install/ubuntu-jammy/install-all.sh

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/usr/bin/env bash
22

3+
# Exit on any error
4+
set -e
5+
6+
# Error on undefined variable
7+
set -u
8+
39
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
410

511
"$script_dir"/install-prebuilt-packages.sh

components/core/tools/scripts/lib_install/ubuntu-jammy/install-packages-from-source.sh

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/usr/bin/env bash
22

3+
# Exit on any error
4+
set -e
5+
6+
# Error on undefined variable
7+
set -u
8+
39
./tools/scripts/lib_install/fmtlib.sh 8.0.1
410
./tools/scripts/lib_install/libarchive.sh 3.5.1
511
./tools/scripts/lib_install/lz4.sh 1.8.2

components/core/tools/scripts/lib_install/ubuntu-jammy/install-prebuilt-packages.sh

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/usr/bin/env bash
22

3+
# Exit on any error
4+
set -e
5+
6+
# Error on undefined variable
7+
set -u
8+
39
apt-get update
410
DEBIAN_FRONTEND=noninteractive apt-get install -y \
511
ca-certificates \

tools/docker-images/clp-execution-base-focal/setup-scripts/install-prebuilt-packages.sh

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/bash
22

3+
# Exit on any error
4+
set -e
5+
6+
# Error on undefined variable
7+
set -u
8+
39
apt-get update
410
DEBIAN_FRONTEND=noninteractive apt-get install -y \
511
checkinstall \

0 commit comments

Comments
 (0)