Skip to content

Commit c1b2ed3

Browse files
committed
fix: Use temp file for IPv6 conf checksum (#228)
The conf file was modified to change listen port in the Dockerfile, so to correctly compare packaged checksums we create a temporary file with the known changes reverted. This resolves an issue where the container would never listen on IPv6 on startup.
1 parent 6114170 commit c1b2ed3

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

entrypoint/10-listen-on-ipv6-by-default.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,22 @@ else
3737
fi
3838

3939
entrypoint_log "$ME: info: Getting the checksum of /$DEFAULT_CONF_FILE"
40+
# Use a temporary file to undo the port change so checksums can be compared.
41+
CONFTMP=$(mktemp)
42+
trap 'rm -f "$CONFTMP"' EXIT SIGINT
43+
sed 's,listen 8080;,listen 80;,' "/$DEFAULT_CONF_FILE" > "$CONFTMP"
4044

4145
case "$ID" in
4246
"debian")
4347
CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
44-
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
48+
echo "$CHECKSUM $CONFTMP" | md5sum -c - >/dev/null 2>&1 || {
4549
entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE differs from the packaged version"
4650
exit 0
4751
}
4852
;;
4953
"alpine")
5054
CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
51-
echo "$CHECKSUM /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
55+
echo "$CHECKSUM $CONFTMP" | sha1sum -c - >/dev/null 2>&1 || {
5256
entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE differs from the packaged version"
5357
exit 0
5458
}

0 commit comments

Comments
 (0)