Skip to content

Commit

Permalink
Revert some exit <-> return changes
Browse files Browse the repository at this point in the history
And fix template path
  • Loading branch information
alessfg committed Jul 20, 2023
1 parent e8b5558 commit d618fd4
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion entrypoint/15-local-resolvers.envsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -eu
LC_ALL=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

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

NGINX_LOCAL_RESOLVERS=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf)
export NGINX_LOCAL_RESOLVERS
10 changes: 5 additions & 5 deletions entrypoint/20-envsubst-on-templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ add_stream_block() {
entrypoint_log "$ME: $conffile contains a stream block; include $stream_output_dir/*.conf to enable stream templates"
else
# check if the file can be modified, e.g. not on a r/o filesystem
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; return 0; }
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; exit 0; }
entrypoint_log "$ME: info: Appending stream block to $conffile to include $stream_output_dir/*.conf"
cat << END >> "$conffile"
# added by "$ME" on "$(date)"
Expand All @@ -45,8 +45,8 @@ auto_envsubst() {
return 0
fi
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
relative_path="${template#"$template_dir"/}"
output_path="$output_dir/${relative_path%"$suffix"}"
relative_path="${template#$template_dir/}"
output_path="$output_dir/${relative_path%$suffix}"
subdir=$(dirname "$relative_path")
# create a subdirectory where the template file exists
mkdir -p "$output_dir/$subdir"
Expand All @@ -63,8 +63,8 @@ auto_envsubst() {
fi
add_stream_block
find "$template_dir" -follow -type f -name "*$stream_suffix" -print | while read -r template; do
relative_path="${template#"$template_dir"/}"
output_path="$stream_output_dir/${relative_path%"$stream_suffix"}"
relative_path="${template#$template_dir/}"
output_path="$stream_output_dir/${relative_path%$stream_suffix}"
subdir=$(dirname "$relative_path")
# create a subdirectory where the template file exists
mkdir -p "$stream_output_dir/$subdir"
Expand Down
2 changes: 1 addition & 1 deletion mainline/alpine-slim/15-local-resolvers.envsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -eu
LC_ALL=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

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

NGINX_LOCAL_RESOLVERS=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf)
export NGINX_LOCAL_RESOLVERS
10 changes: 5 additions & 5 deletions mainline/alpine-slim/20-envsubst-on-templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ add_stream_block() {
entrypoint_log "$ME: $conffile contains a stream block; include $stream_output_dir/*.conf to enable stream templates"
else
# check if the file can be modified, e.g. not on a r/o filesystem
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; return 0; }
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; exit 0; }
entrypoint_log "$ME: info: Appending stream block to $conffile to include $stream_output_dir/*.conf"
cat << END >> "$conffile"
# added by "$ME" on "$(date)"
Expand All @@ -45,8 +45,8 @@ auto_envsubst() {
return 0
fi
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
relative_path="${template#"$template_dir"/}"
output_path="$output_dir/${relative_path%"$suffix"}"
relative_path="${template#$template_dir/}"
output_path="$output_dir/${relative_path%$suffix}"
subdir=$(dirname "$relative_path")
# create a subdirectory where the template file exists
mkdir -p "$output_dir/$subdir"
Expand All @@ -63,8 +63,8 @@ auto_envsubst() {
fi
add_stream_block
find "$template_dir" -follow -type f -name "*$stream_suffix" -print | while read -r template; do
relative_path="${template#"$template_dir"/}"
output_path="$stream_output_dir/${relative_path%"$stream_suffix"}"
relative_path="${template#$template_dir/}"
output_path="$stream_output_dir/${relative_path%$stream_suffix}"
subdir=$(dirname "$relative_path")
# create a subdirectory where the template file exists
mkdir -p "$stream_output_dir/$subdir"
Expand Down
2 changes: 1 addition & 1 deletion mainline/debian/15-local-resolvers.envsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -eu
LC_ALL=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

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

NGINX_LOCAL_RESOLVERS=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf)
export NGINX_LOCAL_RESOLVERS
10 changes: 5 additions & 5 deletions mainline/debian/20-envsubst-on-templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ add_stream_block() {
entrypoint_log "$ME: $conffile contains a stream block; include $stream_output_dir/*.conf to enable stream templates"
else
# check if the file can be modified, e.g. not on a r/o filesystem
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; return 0; }
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; exit 0; }
entrypoint_log "$ME: info: Appending stream block to $conffile to include $stream_output_dir/*.conf"
cat << END >> "$conffile"
# added by "$ME" on "$(date)"
Expand All @@ -45,8 +45,8 @@ auto_envsubst() {
return 0
fi
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
relative_path="${template#"$template_dir"/}"
output_path="$output_dir/${relative_path%"$suffix"}"
relative_path="${template#$template_dir/}"
output_path="$output_dir/${relative_path%$suffix}"
subdir=$(dirname "$relative_path")
# create a subdirectory where the template file exists
mkdir -p "$output_dir/$subdir"
Expand All @@ -63,8 +63,8 @@ auto_envsubst() {
fi
add_stream_block
find "$template_dir" -follow -type f -name "*$stream_suffix" -print | while read -r template; do
relative_path="${template#"$template_dir"/}"
output_path="$stream_output_dir/${relative_path%"$stream_suffix"}"
relative_path="${template#$template_dir/}"
output_path="$stream_output_dir/${relative_path%$stream_suffix}"
subdir=$(dirname "$relative_path")
# create a subdirectory where the template file exists
mkdir -p "$stream_output_dir/$subdir"
Expand Down
2 changes: 1 addition & 1 deletion stable/alpine-slim/15-local-resolvers.envsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -eu
LC_ALL=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

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

NGINX_LOCAL_RESOLVERS=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf)
export NGINX_LOCAL_RESOLVERS
10 changes: 5 additions & 5 deletions stable/alpine-slim/20-envsubst-on-templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ add_stream_block() {
entrypoint_log "$ME: $conffile contains a stream block; include $stream_output_dir/*.conf to enable stream templates"
else
# check if the file can be modified, e.g. not on a r/o filesystem
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; return 0; }
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; exit 0; }
entrypoint_log "$ME: info: Appending stream block to $conffile to include $stream_output_dir/*.conf"
cat << END >> "$conffile"
# added by "$ME" on "$(date)"
Expand All @@ -45,8 +45,8 @@ auto_envsubst() {
return 0
fi
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
relative_path="${template#"$template_dir"/}"
output_path="$output_dir/${relative_path%"$suffix"}"
relative_path="${template#$template_dir/}"
output_path="$output_dir/${relative_path%$suffix}"
subdir=$(dirname "$relative_path")
# create a subdirectory where the template file exists
mkdir -p "$output_dir/$subdir"
Expand All @@ -63,8 +63,8 @@ auto_envsubst() {
fi
add_stream_block
find "$template_dir" -follow -type f -name "*$stream_suffix" -print | while read -r template; do
relative_path="${template#"$template_dir"/}"
output_path="$stream_output_dir/${relative_path%"$stream_suffix"}"
relative_path="${template#$template_dir/}"
output_path="$stream_output_dir/${relative_path%$stream_suffix}"
subdir=$(dirname "$relative_path")
# create a subdirectory where the template file exists
mkdir -p "$stream_output_dir/$subdir"
Expand Down
2 changes: 1 addition & 1 deletion stable/debian/15-local-resolvers.envsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -eu
LC_ALL=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

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

NGINX_LOCAL_RESOLVERS=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf)
export NGINX_LOCAL_RESOLVERS
10 changes: 5 additions & 5 deletions stable/debian/20-envsubst-on-templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ add_stream_block() {
entrypoint_log "$ME: $conffile contains a stream block; include $stream_output_dir/*.conf to enable stream templates"
else
# check if the file can be modified, e.g. not on a r/o filesystem
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; return 0; }
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: ERROR: can not modify $conffile (read-only file system?)"; exit 0; }
entrypoint_log "$ME: info: Appending stream block to $conffile to include $stream_output_dir/*.conf"
cat << END >> "$conffile"
# added by "$ME" on "$(date)"
Expand All @@ -45,8 +45,8 @@ auto_envsubst() {
return 0
fi
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
relative_path="${template#"$template_dir"/}"
output_path="$output_dir/${relative_path%"$suffix"}"
relative_path="${template#$template_dir/}"
output_path="$output_dir/${relative_path%$suffix}"
subdir=$(dirname "$relative_path")
# create a subdirectory where the template file exists
mkdir -p "$output_dir/$subdir"
Expand All @@ -63,8 +63,8 @@ auto_envsubst() {
fi
add_stream_block
find "$template_dir" -follow -type f -name "*$stream_suffix" -print | while read -r template; do
relative_path="${template#"$template_dir"/}"
output_path="$stream_output_dir/${relative_path%"$stream_suffix"}"
relative_path="${template#$template_dir/}"
output_path="$stream_output_dir/${relative_path%$stream_suffix}"
subdir=$(dirname "$relative_path")
# create a subdirectory where the template file exists
mkdir -p "$stream_output_dir/$subdir"
Expand Down

0 comments on commit d618fd4

Please sign in to comment.