Skip to content

Commit 413ac3e

Browse files
Shellcheck fixes
1 parent 4225024 commit 413ac3e

4 files changed

Lines changed: 8 additions & 74 deletions

File tree

src/node/install.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ NODE_MAJOR_VERSION="24"
77

88
pkg="nodejs"
99

10-
if [ "${NODE_VERSION}" != "automatic" ]; then
10+
if [[ "${NODE_VERSION}" != "automatic" ]]; then
1111
NODE_MAJOR_VERSION="$(echo "${NODE_VERSION}" | cut -d. -f1)"
1212
pkg="${pkg}=${NODE_VERSION}-1nodesource1"
1313
fi
@@ -42,12 +42,12 @@ install -dm 755 /etc/apt/keyrings
4242
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
4343
echo "${apt_sources_snippet}" | tee /etc/apt/sources.list.d/nodesource.sources
4444

45-
if [ -n "${curl_installed}" ]; then
45+
if [[ -n "${curl_installed}" ]]; then
4646
apt purge curl --autoremove --yes
4747
rm -rf /var/lib/apt/lists/*
4848
fi
4949

50-
if [ -n "${gpg_installed}" ]; then
50+
if [[ -n "${gpg_installed}" ]]; then
5151
apt purge gnupg --autoremove --yes
5252
rm -rf /var/lib/apt/lists/*
5353
fi
@@ -65,6 +65,6 @@ if [[ "$(cat /etc/bash.bashrc)" != *"${node_rc_snippet}"* ]]; then
6565
echo "${node_rc_snippet}" >> /etc/bash.bashrc
6666
fi
6767

68-
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"${node_rc_snippet}"* ]]; then
68+
if [[ -f "/etc/zsh/zshrc" ]] && [[ "$(cat /etc/zsh/zshrc)" != *"${node_rc_snippet}"* ]]; then
6969
echo "${node_rc_snippet}" >> /etc/zsh/zshrc
7070
fi

src/postgresql-client/install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ fi
3636

3737
install -d /usr/share/postgresql-common/pgdg
3838
curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
39-
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt '${VERSION_CODENAME}'-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
39+
echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt ${VERSION_CODENAME}-pgdg main" > /etc/apt/sources.list.d/pgdg.list
4040

4141
apt update --yes
42-
apt install --no-install-recommends --yes libpq-dev postgresql-client-${POSTGRESQL_VERSION}
42+
apt install --no-install-recommends --yes libpq-dev postgresql-client-"${POSTGRESQL_VERSION}"
4343

4444
if [ -n "${curl_installed}" ]; then
4545
apt purge curl --autoremove --yes
Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,13 @@
11
#!/usr/bin/env bash
22

3-
# This test file will be executed against an auto-generated devcontainer.json that
4-
# includes the 'postgresql-client' Feature with no options.
5-
#
6-
# For more information, see: https://github.com/devcontainers/cli/blob/main/docs/features/test.md
7-
#
8-
# Eg:
9-
# {
10-
# "image": "<..some-base-image...>",
11-
# "features": {
12-
# "postgresql-client": {}
13-
# },
14-
# "remoteUser": "root"
15-
# }
16-
#
17-
# Thus, the value of all options will fall back to the default value in the
18-
# Feature's 'devcontainer-feature.json'.
19-
#
20-
# These scripts are run as 'root' by default. Although that can be changed
21-
# with the '--remote-user' flag.
22-
#
23-
# This test can be run with the following command:
24-
#
25-
# devcontainer features test \
26-
# --features postgresql-client \
27-
# --remote-user root \
28-
# --skip-scenarios \
29-
# --base-image mcr.microsoft.com/devcontainers/base:ubuntu \
30-
# /path/to/this/repo
31-
323
set -e
334

345
# Optional: Import test library bundled with the devcontainer CLI
35-
# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
36-
# Provides the 'check' and 'reportResults' commands.
6+
# shellcheck source=/dev/null
377
source dev-container-features-test-lib
388

399
# Feature-specific tests
40-
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
41-
# check <LABEL> <cmd> [args...]
4210
check "version" bash -c "psql --version | grep -E 'psql \(PostgreSQL\) 15\..+'"
4311

4412
# Report result
45-
# If any of the checks above exited with a non-zero exit code, the test will fail.
4613
reportResults

test/postgresql-client/test.sh

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,14 @@
11
#!/usr/bin/env bash
22

3-
# This test file will be executed against an auto-generated devcontainer.json that
4-
# includes the 'postgresql-client' Feature with no options.
5-
#
6-
# For more information, see: https://github.com/devcontainers/cli/blob/main/docs/features/test.md
7-
#
8-
# Eg:
9-
# {
10-
# "image": "<..some-base-image...>",
11-
# "features": {
12-
# "postgresql-client": {}
13-
# },
14-
# "remoteUser": "root"
15-
# }
16-
#
17-
# Thus, the value of all options will fall back to the default value in the
18-
# Feature's 'devcontainer-feature.json'.
19-
#
20-
# These scripts are run as 'root' by default. Although that can be changed
21-
# with the '--remote-user' flag.
22-
#
23-
# This test can be run with the following command:
24-
#
25-
# devcontainer features test \
26-
# --features postgresql-client \
27-
# --remote-user root \
28-
# --skip-scenarios \
29-
# --base-image mcr.microsoft.com/devcontainers/base:ubuntu \
30-
# /path/to/this/repo
31-
323
set -e
334

345
# Optional: Import test library bundled with the devcontainer CLI
35-
# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
36-
# Provides the 'check' and 'reportResults' commands.
6+
# shellcheck source=/dev/null
377
source dev-container-features-test-lib
388

399
# Feature-specific tests
40-
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
41-
# check <LABEL> <cmd> [args...]
4210
check "version" psql --version
4311
check "which psql" bash -c "which psql | grep /usr/bin/psql"
4412

4513
# Report result
46-
# If any of the checks above exited with a non-zero exit code, the test will fail.
4714
reportResults

0 commit comments

Comments
 (0)