Skip to content
Snippets Groups Projects
Commit 60861228 authored by Konstantin Pavlov's avatar Konstantin Pavlov
Browse files

Reworded entrypoint scripts error messages to avoid confusion

Fixes #419
parent 172571e5
No related branches found
No related tags found
No related merge requests found
Showing
with 72 additions and 72 deletions
......@@ -8,25 +8,25 @@ DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
# check if we have ipv6 available
if [ ! -f "/proc/net/if_inet6" ]; then
echo "$ME: ipv6 not available, exiting" 1>&2
echo "$ME: error: ipv6 not available" 1>&2
exit 0
fi
if [ ! -f "/$DEFAULT_CONF_FILE" ]; then
echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE is not a file or does not exist" 1>&2
exit 0
fi
# check if the file can be modified, e.g. not on a r/o filesystem
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: Can not modify /$DEFAULT_CONF_FILE (read-only file system?), exiting" >1&2; exit 0; }
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: error: can not modify /$DEFAULT_CONF_FILE (read-only file system?)" >1&2; exit 0; }
# check if the file is already modified, e.g. on a container restart
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: IPv6 listen already enabled, exiting"; exit 0; }
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: error: IPv6 listen already enabled"; exit 0; }
if [ -f "/etc/os-release" ]; then
. /etc/os-release
else
echo "$ME: can not guess the operating system, exiting" 1>&2
echo "$ME: error: can not guess the operating system" 1>&2
exit 0
fi
......@@ -36,19 +36,19 @@ case "$ID" in
"debian")
CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packaged version" 1>&2
exit 0
}
;;
"alpine")
CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packages version" 1>&2
exit 0
}
;;
*)
echo "$ME: Unsupported distribution, exiting" 1>&2
echo "$ME: error: Unsupported distribution" 1>&2
exit 0
;;
esac
......
......
......@@ -13,7 +13,7 @@ auto_envsubst() {
defined_envs=$(printf '${%s} ' $(env | cut -d= -f1))
[ -d "$template_dir" ] || return 0
if [ ! -w "$output_dir" ]; then
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable" 1>&2
return 0
fi
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
......
......
......@@ -8,25 +8,25 @@ DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
# check if we have ipv6 available
if [ ! -f "/proc/net/if_inet6" ]; then
echo "$ME: ipv6 not available, exiting" 1>&2
echo "$ME: error: ipv6 not available" 1>&2
exit 0
fi
if [ ! -f "/$DEFAULT_CONF_FILE" ]; then
echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE is not a file or does not exist" 1>&2
exit 0
fi
# check if the file can be modified, e.g. not on a r/o filesystem
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: Can not modify /$DEFAULT_CONF_FILE (read-only file system?), exiting" >1&2; exit 0; }
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: error: can not modify /$DEFAULT_CONF_FILE (read-only file system?)" >1&2; exit 0; }
# check if the file is already modified, e.g. on a container restart
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: IPv6 listen already enabled, exiting"; exit 0; }
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: error: IPv6 listen already enabled"; exit 0; }
if [ -f "/etc/os-release" ]; then
. /etc/os-release
else
echo "$ME: can not guess the operating system, exiting" 1>&2
echo "$ME: error: can not guess the operating system" 1>&2
exit 0
fi
......@@ -36,19 +36,19 @@ case "$ID" in
"debian")
CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packaged version" 1>&2
exit 0
}
;;
"alpine")
CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packages version" 1>&2
exit 0
}
;;
*)
echo "$ME: Unsupported distribution, exiting" 1>&2
echo "$ME: error: Unsupported distribution" 1>&2
exit 0
;;
esac
......
......
......@@ -13,7 +13,7 @@ auto_envsubst() {
defined_envs=$(printf '${%s} ' $(env | cut -d= -f1))
[ -d "$template_dir" ] || return 0
if [ ! -w "$output_dir" ]; then
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable" 1>&2
return 0
fi
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
......
......
......@@ -8,25 +8,25 @@ DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
# check if we have ipv6 available
if [ ! -f "/proc/net/if_inet6" ]; then
echo "$ME: ipv6 not available, exiting" 1>&2
echo "$ME: error: ipv6 not available" 1>&2
exit 0
fi
if [ ! -f "/$DEFAULT_CONF_FILE" ]; then
echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE is not a file or does not exist" 1>&2
exit 0
fi
# check if the file can be modified, e.g. not on a r/o filesystem
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: Can not modify /$DEFAULT_CONF_FILE (read-only file system?), exiting" >1&2; exit 0; }
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: error: can not modify /$DEFAULT_CONF_FILE (read-only file system?)" >1&2; exit 0; }
# check if the file is already modified, e.g. on a container restart
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: IPv6 listen already enabled, exiting"; exit 0; }
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: error: IPv6 listen already enabled"; exit 0; }
if [ -f "/etc/os-release" ]; then
. /etc/os-release
else
echo "$ME: can not guess the operating system, exiting" 1>&2
echo "$ME: error: can not guess the operating system" 1>&2
exit 0
fi
......@@ -36,19 +36,19 @@ case "$ID" in
"debian")
CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packaged version" 1>&2
exit 0
}
;;
"alpine")
CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packages version" 1>&2
exit 0
}
;;
*)
echo "$ME: Unsupported distribution, exiting" 1>&2
echo "$ME: error: Unsupported distribution" 1>&2
exit 0
;;
esac
......
......
......@@ -13,7 +13,7 @@ auto_envsubst() {
defined_envs=$(printf '${%s} ' $(env | cut -d= -f1))
[ -d "$template_dir" ] || return 0
if [ ! -w "$output_dir" ]; then
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable" 1>&2
return 0
fi
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
......
......
......@@ -8,25 +8,25 @@ DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
# check if we have ipv6 available
if [ ! -f "/proc/net/if_inet6" ]; then
echo "$ME: ipv6 not available, exiting" 1>&2
echo "$ME: error: ipv6 not available" 1>&2
exit 0
fi
if [ ! -f "/$DEFAULT_CONF_FILE" ]; then
echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE is not a file or does not exist" 1>&2
exit 0
fi
# check if the file can be modified, e.g. not on a r/o filesystem
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: Can not modify /$DEFAULT_CONF_FILE (read-only file system?), exiting" >1&2; exit 0; }
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: error: can not modify /$DEFAULT_CONF_FILE (read-only file system?)" >1&2; exit 0; }
# check if the file is already modified, e.g. on a container restart
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: IPv6 listen already enabled, exiting"; exit 0; }
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: error: IPv6 listen already enabled"; exit 0; }
if [ -f "/etc/os-release" ]; then
. /etc/os-release
else
echo "$ME: can not guess the operating system, exiting" 1>&2
echo "$ME: error: can not guess the operating system" 1>&2
exit 0
fi
......@@ -36,19 +36,19 @@ case "$ID" in
"debian")
CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packaged version" 1>&2
exit 0
}
;;
"alpine")
CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packages version" 1>&2
exit 0
}
;;
*)
echo "$ME: Unsupported distribution, exiting" 1>&2
echo "$ME: error: Unsupported distribution" 1>&2
exit 0
;;
esac
......
......
......@@ -13,7 +13,7 @@ auto_envsubst() {
defined_envs=$(printf '${%s} ' $(env | cut -d= -f1))
[ -d "$template_dir" ] || return 0
if [ ! -w "$output_dir" ]; then
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable" 1>&2
return 0
fi
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
......
......
......@@ -8,25 +8,25 @@ DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
# check if we have ipv6 available
if [ ! -f "/proc/net/if_inet6" ]; then
echo "$ME: ipv6 not available, exiting" 1>&2
echo "$ME: error: ipv6 not available" 1>&2
exit 0
fi
if [ ! -f "/$DEFAULT_CONF_FILE" ]; then
echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE is not a file or does not exist" 1>&2
exit 0
fi
# check if the file can be modified, e.g. not on a r/o filesystem
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: Can not modify /$DEFAULT_CONF_FILE (read-only file system?), exiting" >1&2; exit 0; }
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: error: can not modify /$DEFAULT_CONF_FILE (read-only file system?)" >1&2; exit 0; }
# check if the file is already modified, e.g. on a container restart
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: IPv6 listen already enabled, exiting"; exit 0; }
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: error: IPv6 listen already enabled"; exit 0; }
if [ -f "/etc/os-release" ]; then
. /etc/os-release
else
echo "$ME: can not guess the operating system, exiting" 1>&2
echo "$ME: error: can not guess the operating system" 1>&2
exit 0
fi
......@@ -36,19 +36,19 @@ case "$ID" in
"debian")
CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packaged version" 1>&2
exit 0
}
;;
"alpine")
CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packages version" 1>&2
exit 0
}
;;
*)
echo "$ME: Unsupported distribution, exiting" 1>&2
echo "$ME: error: Unsupported distribution" 1>&2
exit 0
;;
esac
......
......
......@@ -13,7 +13,7 @@ auto_envsubst() {
defined_envs=$(printf '${%s} ' $(env | cut -d= -f1))
[ -d "$template_dir" ] || return 0
if [ ! -w "$output_dir" ]; then
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable" 1>&2
return 0
fi
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
......
......
......@@ -8,25 +8,25 @@ DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
# check if we have ipv6 available
if [ ! -f "/proc/net/if_inet6" ]; then
echo "$ME: ipv6 not available, exiting" 1>&2
echo "$ME: error: ipv6 not available" 1>&2
exit 0
fi
if [ ! -f "/$DEFAULT_CONF_FILE" ]; then
echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE is not a file or does not exist" 1>&2
exit 0
fi
# check if the file can be modified, e.g. not on a r/o filesystem
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: Can not modify /$DEFAULT_CONF_FILE (read-only file system?), exiting" >1&2; exit 0; }
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: error: can not modify /$DEFAULT_CONF_FILE (read-only file system?)" >1&2; exit 0; }
# check if the file is already modified, e.g. on a container restart
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: IPv6 listen already enabled, exiting"; exit 0; }
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: error: IPv6 listen already enabled"; exit 0; }
if [ -f "/etc/os-release" ]; then
. /etc/os-release
else
echo "$ME: can not guess the operating system, exiting" 1>&2
echo "$ME: error: can not guess the operating system" 1>&2
exit 0
fi
......@@ -36,19 +36,19 @@ case "$ID" in
"debian")
CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packaged version" 1>&2
exit 0
}
;;
"alpine")
CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packages version" 1>&2
exit 0
}
;;
*)
echo "$ME: Unsupported distribution, exiting" 1>&2
echo "$ME: error: Unsupported distribution" 1>&2
exit 0
;;
esac
......
......
......@@ -13,7 +13,7 @@ auto_envsubst() {
defined_envs=$(printf '${%s} ' $(env | cut -d= -f1))
[ -d "$template_dir" ] || return 0
if [ ! -w "$output_dir" ]; then
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable" 1>&2
return 0
fi
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
......
......
......@@ -8,25 +8,25 @@ DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
# check if we have ipv6 available
if [ ! -f "/proc/net/if_inet6" ]; then
echo "$ME: ipv6 not available, exiting" 1>&2
echo "$ME: error: ipv6 not available" 1>&2
exit 0
fi
if [ ! -f "/$DEFAULT_CONF_FILE" ]; then
echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE is not a file or does not exist" 1>&2
exit 0
fi
# check if the file can be modified, e.g. not on a r/o filesystem
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: Can not modify /$DEFAULT_CONF_FILE (read-only file system?), exiting" >1&2; exit 0; }
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: error: can not modify /$DEFAULT_CONF_FILE (read-only file system?)" >1&2; exit 0; }
# check if the file is already modified, e.g. on a container restart
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: IPv6 listen already enabled, exiting"; exit 0; }
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: error: IPv6 listen already enabled"; exit 0; }
if [ -f "/etc/os-release" ]; then
. /etc/os-release
else
echo "$ME: can not guess the operating system, exiting" 1>&2
echo "$ME: error: can not guess the operating system" 1>&2
exit 0
fi
......@@ -36,19 +36,19 @@ case "$ID" in
"debian")
CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packaged version" 1>&2
exit 0
}
;;
"alpine")
CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packages version" 1>&2
exit 0
}
;;
*)
echo "$ME: Unsupported distribution, exiting" 1>&2
echo "$ME: error: Unsupported distribution" 1>&2
exit 0
;;
esac
......
......
......@@ -13,7 +13,7 @@ auto_envsubst() {
defined_envs=$(printf '${%s} ' $(env | cut -d= -f1))
[ -d "$template_dir" ] || return 0
if [ ! -w "$output_dir" ]; then
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable" 1>&2
return 0
fi
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
......
......
......@@ -8,25 +8,25 @@ DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
# check if we have ipv6 available
if [ ! -f "/proc/net/if_inet6" ]; then
echo "$ME: ipv6 not available, exiting" 1>&2
echo "$ME: error: ipv6 not available" 1>&2
exit 0
fi
if [ ! -f "/$DEFAULT_CONF_FILE" ]; then
echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE is not a file or does not exist" 1>&2
exit 0
fi
# check if the file can be modified, e.g. not on a r/o filesystem
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: Can not modify /$DEFAULT_CONF_FILE (read-only file system?), exiting" >1&2; exit 0; }
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo "$ME: error: can not modify /$DEFAULT_CONF_FILE (read-only file system?)" >1&2; exit 0; }
# check if the file is already modified, e.g. on a container restart
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: IPv6 listen already enabled, exiting"; exit 0; }
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: error: IPv6 listen already enabled"; exit 0; }
if [ -f "/etc/os-release" ]; then
. /etc/os-release
else
echo "$ME: can not guess the operating system, exiting" 1>&2
echo "$ME: error: can not guess the operating system" 1>&2
exit 0
fi
......@@ -36,19 +36,19 @@ case "$ID" in
"debian")
CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packaged version" 1>&2
exit 0
}
;;
"alpine")
CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
echo "$ME: error: /$DEFAULT_CONF_FILE differs from the packages version" 1>&2
exit 0
}
;;
*)
echo "$ME: Unsupported distribution, exiting" 1>&2
echo "$ME: error: Unsupported distribution" 1>&2
exit 0
;;
esac
......
......
......@@ -13,7 +13,7 @@ auto_envsubst() {
defined_envs=$(printf '${%s} ' $(env | cut -d= -f1))
[ -d "$template_dir" ] || return 0
if [ ! -w "$output_dir" ]; then
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable" 1>&2
return 0
fi
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment