-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a02854
commit 135667d
Showing
47 changed files
with
3,565 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
nginx/1.21.6/almalinux/8.5-20220306/10-listen-on-ipv6-by-default.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/sh | ||
# vim:sw=4:ts=4:et | ||
|
||
set -e | ||
|
||
ME=$(basename $0) | ||
DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf" | ||
|
||
# check if we have ipv6 available | ||
if [ ! -f "/proc/net/if_inet6" ]; then | ||
echo >&3 "$ME: error: ipv6 not available" | ||
exit 0 | ||
fi | ||
|
||
if [ ! -f "/$DEFAULT_CONF_FILE" ]; then | ||
echo >&3 "$ME: error: /$DEFAULT_CONF_FILE is not a file or does not exist" | ||
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 >&3 "$ME: error: can not modify /$DEFAULT_CONF_FILE (read-only file system?)"; 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: error: IPv6 listen already enabled"; exit 0; } | ||
|
||
if [ -f "/etc/os-release" ]; then | ||
. /etc/os-release | ||
else | ||
echo >&3 "$ME: error: can not guess the operating system" | ||
exit 0 | ||
fi | ||
|
||
echo >&3 "$ME: Getting the checksum of /$DEFAULT_CONF_FILE" | ||
|
||
#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 >&3 "$ME: error: /$DEFAULT_CONF_FILE differs from the packaged version" | ||
# 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 >&3 "$ME: error: /$DEFAULT_CONF_FILE differs from the packages version" | ||
# exit 0 | ||
# } | ||
# ;; | ||
# *) | ||
# echo >&3 "$ME: error: Unsupported distribution" | ||
# exit 0 | ||
# ;; | ||
#esac | ||
|
||
# enable ipv6 on default.conf listen sockets | ||
sed -i -E 's,listen 80;,listen 80;\n listen [::]:80;,' /$DEFAULT_CONF_FILE | ||
|
||
echo >&3 "$ME: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE" | ||
|
||
exit 0 |
32 changes: 32 additions & 0 deletions
32
nginx/1.21.6/almalinux/8.5-20220306/20-envsubst-on-templates.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
ME=$(basename $0) | ||
|
||
auto_envsubst() { | ||
local template_dir="${NGINX_ENVSUBST_TEMPLATE_DIR:-/etc/nginx/templates}" | ||
local suffix="${NGINX_ENVSUBST_TEMPLATE_SUFFIX:-.template}" | ||
local output_dir="${NGINX_ENVSUBST_OUTPUT_DIR:-/etc/nginx/conf.d}" | ||
|
||
local template defined_envs relative_path output_path subdir | ||
defined_envs=$(printf '${%s} ' $(env | cut -d= -f1)) | ||
[ -d "$template_dir" ] || return 0 | ||
if [ ! -w "$output_dir" ]; then | ||
echo >&3 "$ME: ERROR: $template_dir exists, but $output_dir is not writable" | ||
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}" | ||
subdir=$(dirname "$relative_path") | ||
# create a subdirectory where the template file exists | ||
mkdir -p "$output_dir/$subdir" | ||
echo >&3 "$ME: Running envsubst on $template to $output_path" | ||
envsubst "$defined_envs" < "$template" > "$output_path" | ||
done | ||
} | ||
|
||
auto_envsubst | ||
|
||
exit 0 |
Oops, something went wrong.