Skip to content

Commit 0052b8b

Browse files
committedJul 20, 2023
Revert some exit <-> return changes
And fix template path
1 parent e8b5558 commit 0052b8b

10 files changed

+35
-35
lines changed
 

‎entrypoint/15-local-resolvers.envsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -eu
66
LC_ALL=C
77
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
88

9-
[ "${NGINX_ENTRYPOINT_LOCAL_RESOLVERS:-}" ] || exit 0
9+
[ "${NGINX_ENTRYPOINT_LOCAL_RESOLVERS:-}" ] || return 0
1010

1111
NGINX_LOCAL_RESOLVERS=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf)
1212
export NGINX_LOCAL_RESOLVERS

‎entrypoint/20-envsubst-on-templates.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ add_stream_block() {
1818
entrypoint_log "$ME: $conffile contains a stream block; include $stream_output_dir/*.conf to enable stream templates"
1919
else
2020
# check if the file can be modified, e.g. not on a r/o filesystem
21-
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; return 0; }
21+
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; exit 0; }
2222
entrypoint_log "$ME: info: Appending stream block to $conffile to include $stream_output_dir/*.conf"
2323
cat << END >> "$conffile"
2424
# added by "$ME" on "$(date)"
@@ -38,15 +38,15 @@ auto_envsubst() {
3838
local filter="${NGINX_ENVSUBST_FILTER:-}"
3939
local template defined_envs relative_path output_path subdir
4040

41-
defined_envs=$(printf "%s" "$(awk "END { for (name in ENVIRON) { print ( name ~ /${filter}/ ) ? name : \"\" } }" < /dev/null )")
41+
defined_envs=$(printf "%s " "$(awk "END { for (name in ENVIRON) { print ( name ~ /${filter}/ ) ? name : \"\" } }" < /dev/null )")
4242
[ -d "$template_dir" ] || return 0
4343
if [ ! -w "$output_dir" ]; then
4444
entrypoint_log "$ME: ERROR: $template_dir exists, but $output_dir is not writable"
4545
return 0
4646
fi
4747
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
48-
relative_path="${template#"$template_dir"/}"
49-
output_path="$output_dir/${relative_path%"$suffix"}"
48+
relative_path="${template#$template_dir/}"
49+
output_path="$output_dir/${relative_path%$suffix}"
5050
subdir=$(dirname "$relative_path")
5151
# create a subdirectory where the template file exists
5252
mkdir -p "$output_dir/$subdir"
@@ -63,8 +63,8 @@ auto_envsubst() {
6363
fi
6464
add_stream_block
6565
find "$template_dir" -follow -type f -name "*$stream_suffix" -print | while read -r template; do
66-
relative_path="${template#"$template_dir"/}"
67-
output_path="$stream_output_dir/${relative_path%"$stream_suffix"}"
66+
relative_path="${template#$template_dir/}"
67+
output_path="$stream_output_dir/${relative_path%$stream_suffix}"
6868
subdir=$(dirname "$relative_path")
6969
# create a subdirectory where the template file exists
7070
mkdir -p "$stream_output_dir/$subdir"

‎mainline/alpine-slim/15-local-resolvers.envsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -eu
66
LC_ALL=C
77
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
88

9-
[ "${NGINX_ENTRYPOINT_LOCAL_RESOLVERS:-}" ] || exit 0
9+
[ "${NGINX_ENTRYPOINT_LOCAL_RESOLVERS:-}" ] || return 0
1010

1111
NGINX_LOCAL_RESOLVERS=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf)
1212
export NGINX_LOCAL_RESOLVERS

‎mainline/alpine-slim/20-envsubst-on-templates.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ add_stream_block() {
1818
entrypoint_log "$ME: $conffile contains a stream block; include $stream_output_dir/*.conf to enable stream templates"
1919
else
2020
# check if the file can be modified, e.g. not on a r/o filesystem
21-
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; return 0; }
21+
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; exit 0; }
2222
entrypoint_log "$ME: info: Appending stream block to $conffile to include $stream_output_dir/*.conf"
2323
cat << END >> "$conffile"
2424
# added by "$ME" on "$(date)"
@@ -38,15 +38,15 @@ auto_envsubst() {
3838
local filter="${NGINX_ENVSUBST_FILTER:-}"
3939
local template defined_envs relative_path output_path subdir
4040

41-
defined_envs=$(printf "%s" "$(awk "END { for (name in ENVIRON) { print ( name ~ /${filter}/ ) ? name : \"\" } }" < /dev/null )")
41+
defined_envs=$(printf "%s " "$(awk "END { for (name in ENVIRON) { print ( name ~ /${filter}/ ) ? name : \"\" } }" < /dev/null )")
4242
[ -d "$template_dir" ] || return 0
4343
if [ ! -w "$output_dir" ]; then
4444
entrypoint_log "$ME: ERROR: $template_dir exists, but $output_dir is not writable"
4545
return 0
4646
fi
4747
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
48-
relative_path="${template#"$template_dir"/}"
49-
output_path="$output_dir/${relative_path%"$suffix"}"
48+
relative_path="${template#$template_dir/}"
49+
output_path="$output_dir/${relative_path%$suffix}"
5050
subdir=$(dirname "$relative_path")
5151
# create a subdirectory where the template file exists
5252
mkdir -p "$output_dir/$subdir"
@@ -63,8 +63,8 @@ auto_envsubst() {
6363
fi
6464
add_stream_block
6565
find "$template_dir" -follow -type f -name "*$stream_suffix" -print | while read -r template; do
66-
relative_path="${template#"$template_dir"/}"
67-
output_path="$stream_output_dir/${relative_path%"$stream_suffix"}"
66+
relative_path="${template#$template_dir/}"
67+
output_path="$stream_output_dir/${relative_path%$stream_suffix}"
6868
subdir=$(dirname "$relative_path")
6969
# create a subdirectory where the template file exists
7070
mkdir -p "$stream_output_dir/$subdir"

‎mainline/debian/15-local-resolvers.envsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -eu
66
LC_ALL=C
77
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
88

9-
[ "${NGINX_ENTRYPOINT_LOCAL_RESOLVERS:-}" ] || exit 0
9+
[ "${NGINX_ENTRYPOINT_LOCAL_RESOLVERS:-}" ] || return 0
1010

1111
NGINX_LOCAL_RESOLVERS=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf)
1212
export NGINX_LOCAL_RESOLVERS

‎mainline/debian/20-envsubst-on-templates.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ add_stream_block() {
1818
entrypoint_log "$ME: $conffile contains a stream block; include $stream_output_dir/*.conf to enable stream templates"
1919
else
2020
# check if the file can be modified, e.g. not on a r/o filesystem
21-
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; return 0; }
21+
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; exit 0; }
2222
entrypoint_log "$ME: info: Appending stream block to $conffile to include $stream_output_dir/*.conf"
2323
cat << END >> "$conffile"
2424
# added by "$ME" on "$(date)"
@@ -38,15 +38,15 @@ auto_envsubst() {
3838
local filter="${NGINX_ENVSUBST_FILTER:-}"
3939
local template defined_envs relative_path output_path subdir
4040

41-
defined_envs=$(printf "%s" "$(awk "END { for (name in ENVIRON) { print ( name ~ /${filter}/ ) ? name : \"\" } }" < /dev/null )")
41+
defined_envs=$(printf "%s " "$(awk "END { for (name in ENVIRON) { print ( name ~ /${filter}/ ) ? name : \"\" } }" < /dev/null )")
4242
[ -d "$template_dir" ] || return 0
4343
if [ ! -w "$output_dir" ]; then
4444
entrypoint_log "$ME: ERROR: $template_dir exists, but $output_dir is not writable"
4545
return 0
4646
fi
4747
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
48-
relative_path="${template#"$template_dir"/}"
49-
output_path="$output_dir/${relative_path%"$suffix"}"
48+
relative_path="${template#$template_dir/}"
49+
output_path="$output_dir/${relative_path%$suffix}"
5050
subdir=$(dirname "$relative_path")
5151
# create a subdirectory where the template file exists
5252
mkdir -p "$output_dir/$subdir"
@@ -63,8 +63,8 @@ auto_envsubst() {
6363
fi
6464
add_stream_block
6565
find "$template_dir" -follow -type f -name "*$stream_suffix" -print | while read -r template; do
66-
relative_path="${template#"$template_dir"/}"
67-
output_path="$stream_output_dir/${relative_path%"$stream_suffix"}"
66+
relative_path="${template#$template_dir/}"
67+
output_path="$stream_output_dir/${relative_path%$stream_suffix}"
6868
subdir=$(dirname "$relative_path")
6969
# create a subdirectory where the template file exists
7070
mkdir -p "$stream_output_dir/$subdir"

‎stable/alpine-slim/15-local-resolvers.envsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -eu
66
LC_ALL=C
77
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
88

9-
[ "${NGINX_ENTRYPOINT_LOCAL_RESOLVERS:-}" ] || exit 0
9+
[ "${NGINX_ENTRYPOINT_LOCAL_RESOLVERS:-}" ] || return 0
1010

1111
NGINX_LOCAL_RESOLVERS=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf)
1212
export NGINX_LOCAL_RESOLVERS

‎stable/alpine-slim/20-envsubst-on-templates.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ add_stream_block() {
1818
entrypoint_log "$ME: $conffile contains a stream block; include $stream_output_dir/*.conf to enable stream templates"
1919
else
2020
# check if the file can be modified, e.g. not on a r/o filesystem
21-
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; return 0; }
21+
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; exit 0; }
2222
entrypoint_log "$ME: info: Appending stream block to $conffile to include $stream_output_dir/*.conf"
2323
cat << END >> "$conffile"
2424
# added by "$ME" on "$(date)"
@@ -38,15 +38,15 @@ auto_envsubst() {
3838
local filter="${NGINX_ENVSUBST_FILTER:-}"
3939
local template defined_envs relative_path output_path subdir
4040

41-
defined_envs=$(printf "%s" "$(awk "END { for (name in ENVIRON) { print ( name ~ /${filter}/ ) ? name : \"\" } }" < /dev/null )")
41+
defined_envs=$(printf "%s " "$(awk "END { for (name in ENVIRON) { print ( name ~ /${filter}/ ) ? name : \"\" } }" < /dev/null )")
4242
[ -d "$template_dir" ] || return 0
4343
if [ ! -w "$output_dir" ]; then
4444
entrypoint_log "$ME: ERROR: $template_dir exists, but $output_dir is not writable"
4545
return 0
4646
fi
4747
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
48-
relative_path="${template#"$template_dir"/}"
49-
output_path="$output_dir/${relative_path%"$suffix"}"
48+
relative_path="${template#$template_dir/}"
49+
output_path="$output_dir/${relative_path%$suffix}"
5050
subdir=$(dirname "$relative_path")
5151
# create a subdirectory where the template file exists
5252
mkdir -p "$output_dir/$subdir"
@@ -63,8 +63,8 @@ auto_envsubst() {
6363
fi
6464
add_stream_block
6565
find "$template_dir" -follow -type f -name "*$stream_suffix" -print | while read -r template; do
66-
relative_path="${template#"$template_dir"/}"
67-
output_path="$stream_output_dir/${relative_path%"$stream_suffix"}"
66+
relative_path="${template#$template_dir/}"
67+
output_path="$stream_output_dir/${relative_path%$stream_suffix}"
6868
subdir=$(dirname "$relative_path")
6969
# create a subdirectory where the template file exists
7070
mkdir -p "$stream_output_dir/$subdir"

‎stable/debian/15-local-resolvers.envsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -eu
66
LC_ALL=C
77
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
88

9-
[ "${NGINX_ENTRYPOINT_LOCAL_RESOLVERS:-}" ] || exit 0
9+
[ "${NGINX_ENTRYPOINT_LOCAL_RESOLVERS:-}" ] || return 0
1010

1111
NGINX_LOCAL_RESOLVERS=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf)
1212
export NGINX_LOCAL_RESOLVERS

‎stable/debian/20-envsubst-on-templates.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ add_stream_block() {
1818
entrypoint_log "$ME: $conffile contains a stream block; include $stream_output_dir/*.conf to enable stream templates"
1919
else
2020
# check if the file can be modified, e.g. not on a r/o filesystem
21-
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; return 0; }
21+
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; exit 0; }
2222
entrypoint_log "$ME: info: Appending stream block to $conffile to include $stream_output_dir/*.conf"
2323
cat << END >> "$conffile"
2424
# added by "$ME" on "$(date)"
@@ -38,15 +38,15 @@ auto_envsubst() {
3838
local filter="${NGINX_ENVSUBST_FILTER:-}"
3939
local template defined_envs relative_path output_path subdir
4040

41-
defined_envs=$(printf "%s" "$(awk "END { for (name in ENVIRON) { print ( name ~ /${filter}/ ) ? name : \"\" } }" < /dev/null )")
41+
defined_envs=$(printf "%s " "$(awk "END { for (name in ENVIRON) { print ( name ~ /${filter}/ ) ? name : \"\" } }" < /dev/null )")
4242
[ -d "$template_dir" ] || return 0
4343
if [ ! -w "$output_dir" ]; then
4444
entrypoint_log "$ME: ERROR: $template_dir exists, but $output_dir is not writable"
4545
return 0
4646
fi
4747
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
48-
relative_path="${template#"$template_dir"/}"
49-
output_path="$output_dir/${relative_path%"$suffix"}"
48+
relative_path="${template#$template_dir/}"
49+
output_path="$output_dir/${relative_path%$suffix}"
5050
subdir=$(dirname "$relative_path")
5151
# create a subdirectory where the template file exists
5252
mkdir -p "$output_dir/$subdir"
@@ -63,8 +63,8 @@ auto_envsubst() {
6363
fi
6464
add_stream_block
6565
find "$template_dir" -follow -type f -name "*$stream_suffix" -print | while read -r template; do
66-
relative_path="${template#"$template_dir"/}"
67-
output_path="$stream_output_dir/${relative_path%"$stream_suffix"}"
66+
relative_path="${template#$template_dir/}"
67+
output_path="$stream_output_dir/${relative_path%$stream_suffix}"
6868
subdir=$(dirname "$relative_path")
6969
# create a subdirectory where the template file exists
7070
mkdir -p "$stream_output_dir/$subdir"

0 commit comments

Comments
 (0)
Failed to load comments.