Skip to content

Commit bd3a68c

Browse files
committed
Fix: Fix broken postfix-install.sh script, move other spaces to tabs as well
1 parent b43c3d9 commit bd3a68c

File tree

5 files changed

+102
-103
lines changed

5 files changed

+102
-103
lines changed

build-scripts/postfix-install.sh

+70-70
Original file line numberDiff line numberDiff line change
@@ -2,96 +2,96 @@
22
set -e
33

44
if [ -f /etc/os-release ]; then
5-
. /etc/os-release
5+
. /etc/os-release
66
fi
77

88
# Installs postfix, opendkim, and other required packages using the
99
# Alpine package manager. This function is called when the image is
1010
# built on an Alpine base image.
1111
do_alpine() {
12-
architecture_specific_packages=""
13-
apk update
12+
architecture_specific_packages=""
13+
apk update
1414

15-
if [ "$(apk info postfix-pgsql | grep -R '^postfix-pgsql')" != "" ]; then
16-
architecture_specific_packages="${architecture_specific_packages} postfix-pgsql"
17-
fi
18-
if [ "$(apk info postfix-mysql | grep -R '^postfix-mysql')" != "" ]; then
19-
architecture_specific_packages="${architecture_specific_packages} postfix-mysql"
20-
fi
15+
if [ "$(apk info postfix-pgsql | grep -R '^postfix-pgsql')" != "" ]; then
16+
architecture_specific_packages="${architecture_specific_packages} postfix-pgsql"
17+
fi
18+
if [ "$(apk info postfix-mysql | grep -R '^postfix-mysql')" != "" ]; then
19+
architecture_specific_packages="${architecture_specific_packages} postfix-mysql"
20+
fi
2121

22-
apk add --upgrade cyrus-sasl cyrus-sasl-static cyrus-sasl-digestmd5 cyrus-sasl-crammd5 cyrus-sasl-login cyrus-sasl-ntlm libsasl
23-
apk add postfix postfix-pcre postfix-ldap ${architecture_specific_packages}
24-
apk add opendkim
25-
apk add --upgrade \
26-
bash \
27-
bind-tools \
28-
ca-certificates \
29-
jsoncpp \
30-
libcurl \
31-
lmdb \
32-
logrotate \
33-
musl \
34-
musl-utils \
35-
netcat-openbsd \
36-
opendkim-utils \
37-
rsyslog \
38-
supervisor \
39-
tzdata
22+
apk add --upgrade cyrus-sasl cyrus-sasl-static cyrus-sasl-digestmd5 cyrus-sasl-crammd5 cyrus-sasl-login cyrus-sasl-ntlm libsasl
23+
apk add postfix postfix-pcre postfix-ldap ${architecture_specific_packages}
24+
apk add opendkim
25+
apk add --upgrade \
26+
bash \
27+
bind-tools \
28+
ca-certificates \
29+
jsoncpp \
30+
libcurl \
31+
lmdb \
32+
logrotate \
33+
musl \
34+
musl-utils \
35+
netcat-openbsd \
36+
opendkim-utils \
37+
rsyslog \
38+
supervisor \
39+
tzdata
4040
}
4141

4242

4343
# Installs postfix, opendkim, and other required packages using the
4444
# ubuntu/debian package manager. This function is called when the
4545
# image is built on a ubuntu/debian base image.
4646
do_ubuntu() {
47-
architecture_specific_packages=""
48-
RELEASE_SPECIFIC_PACKAGES=""
49-
export DEBCONF_NOWARNINGS=yes
50-
export DEBIAN_FRONTEND=noninteractive
51-
echo "Europe/Berlin" > /etc/timezone
52-
apt-get update -y -q
53-
54-
if [ "$(apt-cache search --names-only '^postfix-pgsql$')" != "" ]; then
55-
architecture_specific_packages="${architecture_specific_packages} postfix-pgsql"
56-
fi
57-
if [ "$(apt-cache search --names-only '^postfix-mysql$')" != "" ]; then
58-
architecture_specific_packages="${architecture_specific_packages} postfix-mysql"
59-
fi
47+
architecture_specific_packages=""
48+
RELEASE_SPECIFIC_PACKAGES=""
49+
export DEBCONF_NOWARNINGS=yes
50+
export DEBIAN_FRONTEND=noninteractive
51+
echo "Europe/Berlin" > /etc/timezone
52+
apt-get update -y -q
6053

61-
apt-get install -y libsasl2-modules sasl2-bin
62-
apt-get install -y postfix postfix-pcre postfix-ldap ${architecture_specific_packages}
63-
apt-get install -y opendkim
64-
local libcurl="libcurl4"
65-
if [ "$(apt-cache search --names-only '^libcurl4t64$')" != "" ]; then
66-
libcurl="libcurl4t64"
67-
fi
68-
apt-get install -y \
69-
${libcurl} ${RELEASE_SPECIFIC_PACKAGES} \
70-
bash \
71-
ca-certificates \
72-
colorized-logs \
73-
cron \
74-
curl \
75-
dnsutils \
76-
libjsoncpp25 \
77-
logrotate \
78-
net-tools \
79-
netcat-openbsd \
80-
opendkim-tools \
81-
postfix-lmdb \
82-
procps \
83-
rsyslog \
84-
sasl2-bin \
85-
supervisor \
86-
tzdata \
87-
apt-get clean
88-
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
54+
if [ "$(apt-cache search --names-only '^postfix-pgsql$')" != "" ]; then
55+
architecture_specific_packages="${architecture_specific_packages} postfix-pgsql"
56+
fi
57+
if [ "$(apt-cache search --names-only '^postfix-mysql$')" != "" ]; then
58+
architecture_specific_packages="${architecture_specific_packages} postfix-mysql"
59+
fi
60+
61+
apt-get install -y libsasl2-modules sasl2-bin
62+
apt-get install -y postfix postfix-pcre postfix-ldap ${architecture_specific_packages}
63+
apt-get install -y opendkim
64+
local libcurl="libcurl4"
65+
if [ "$(apt-cache search --names-only '^libcurl4t64$')" != "" ]; then
66+
libcurl="libcurl4t64"
67+
fi
68+
apt-get install -y \
69+
${libcurl} ${RELEASE_SPECIFIC_PACKAGES} \
70+
bash \
71+
ca-certificates \
72+
colorized-logs \
73+
cron \
74+
curl \
75+
dnsutils \
76+
libjsoncpp25 \
77+
logrotate \
78+
net-tools \
79+
netcat-openbsd \
80+
opendkim-tools \
81+
postfix-lmdb \
82+
procps \
83+
rsyslog \
84+
sasl2-bin \
85+
supervisor \
86+
tzdata
87+
apt-get clean
88+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
8989
}
9090

9191
if [ -f /etc/alpine-release ]; then
92-
do_alpine
92+
do_alpine
9393
else
94-
do_ubuntu
94+
do_ubuntu
9595
fi
9696

9797
# Some services (eg. cron) will complain if this file does not exists, even if it's empty.

scripts/cron.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
if [ -f /usr/sbin/cron ]; then # Ubuntu
4-
exec /usr/sbin/cron -f
4+
exec /usr/sbin/cron -f
55
else # Alpine / Busybox cron
6-
exec /usr/sbin/crond -f -S
6+
exec /usr/sbin/crond -f -S
77
fi

scripts/email-anonymizer.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ SCRIPT_DIR=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
99
# are sent straight to the terminal
1010
##
1111
while ! env PYTHONUNBUFFERED=1 python3 "$SCRIPT_DIR/email-anonymizer.py" "$@"; do
12-
sleep 1
12+
sleep 1
1313
done

scripts/healthcheck.sh

+19-20
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
11
#!/bin/sh
22
set -e
33
if [ -f /tmp/container_is_terminating ]; then
4-
exit 0
4+
exit 0
55
fi
66

77
check_postfix() {
8-
local proxy_protocol="$(postconf postscreen_upstream_proxy_protocol | cut -f2- -d= | tr -d '[:blank:]')"
8+
local proxy_protocol="$(postconf postscreen_upstream_proxy_protocol | cut -f2- -d= | tr -d '[:blank:]')"
9+
check_string="EHLO healthcheck\nquit\n"
910

10-
check_string="EHLO healthcheck\nquit\n"
11+
if [ -n "$proxy_protocol" ]; then
12+
check_string="PROXY TCP4 127.0.0.1 127.0.0.1 587 587\n${check_string}"
13+
# ^--- proxied internet protocol and family
14+
# ^--- source address
15+
# ^--- destination address
16+
# ^--- source port
17+
# ^--- destination port
18+
fi
1119

12-
if [ -n "$proxy_protocol" ]; then
13-
check_string="PROXY TCP4 127.0.0.1 127.0.0.1 587 587\n${check_string}"
14-
# ^--- proxied internet protocol and family
15-
# ^--- source address
16-
# ^--- destination address
17-
# ^--- source port
18-
# ^--- destination port
19-
fi
20-
21-
printf "${check_string}" | \
22-
{ while read l ; do sleep 1; echo $l; done } | \
23-
nc -w 2 127.0.0.1 587 | \
24-
grep -qE "^220.*ESMTP Postfix"
20+
printf "${check_string}" | \
21+
{ while read l ; do sleep 1; echo $l; done } | \
22+
nc -w 2 127.0.0.1 587 | \
23+
grep -qE "^220.*ESMTP Postfix"
2524
}
2625

2726
check_dkim() {
28-
if [ -f /tmp/no_open_dkim ]; then
29-
return
30-
fi
31-
printf '\x18Clocalhost\x004\x00\x00127.0.0.1\x00' | nc -w 2 127.0.0.1 8891
27+
if [ -f /tmp/no_open_dkim ]; then
28+
return
29+
fi
30+
printf '\x18Clocalhost\x004\x00\x00127.0.0.1\x00' | nc -w 2 127.0.0.1 8891
3231
}
3332

3433
echo "Postfix check..."

scripts/opendkim.sh

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
#!/bin/sh
22

33
noop() {
4-
while true; do
5-
# 2147483647 = max signed 32-bit integer
6-
# 2147483647 s ≅ 70 years
7-
sleep infinity || sleep 2147483647
8-
done
4+
while true; do
5+
# 2147483647 = max signed 32-bit integer
6+
# 2147483647 s ≅ 70 years
7+
sleep infinity || sleep 2147483647
8+
done
99
}
1010

1111
if [ ! -d /etc/opendkim/keys ]; then
12-
touch /tmp/no_open_dkim
13-
noop
12+
touch /tmp/no_open_dkim
13+
noop
1414
elif [ -z "$(find /etc/opendkim/keys -type f ! -name .)" ]; then
15-
touch /tmp/no_open_dkim
16-
noop
15+
touch /tmp/no_open_dkim
16+
noop
1717
else
18-
exec /usr/sbin/opendkim -D -f -x /etc/opendkim/opendkim.conf
18+
exec /usr/sbin/opendkim -D -f -x /etc/opendkim/opendkim.conf
1919
fi
2020

2121

0 commit comments

Comments
 (0)