summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-daemons/postfix
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-daemons/postfix')
-rwxr-xr-xmeta-networking/recipes-daemons/postfix/files/check_hostname.sh13
-rwxr-xr-xmeta-networking/recipes-daemons/postfix/files/postfix1
-rw-r--r--meta-networking/recipes-daemons/postfix/files/postfix.service1
-rw-r--r--meta-networking/recipes-daemons/postfix/postfix.inc3
4 files changed, 18 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/postfix/files/check_hostname.sh b/meta-networking/recipes-daemons/postfix/files/check_hostname.sh
new file mode 100755
index 0000000000..37a0dd088c
--- /dev/null
+++ b/meta-networking/recipes-daemons/postfix/files/check_hostname.sh
@@ -0,0 +1,13 @@
1#! /bin/sh
2
3HOSTNAME=$(/bin/hostname)
4
5if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" -o ! -z "`echo $HOSTNAME | sed -n '/^[0-9]*\.[0-9].*/p'`" ]; then
6 # If hostname is invalid, and myhostname not existed in main.cf
7 /usr/sbin/postconf -h "myhostname" 2>/dev/null
8 if [ $? -ne 0 ]; then
9 # Set "localhost" to main.cf
10 /usr/sbin/postconf -e "myhostname=localhost"
11 fi
12fi
13
diff --git a/meta-networking/recipes-daemons/postfix/files/postfix b/meta-networking/recipes-daemons/postfix/files/postfix
index 0ea67ef63b..8c7a60175a 100755
--- a/meta-networking/recipes-daemons/postfix/files/postfix
+++ b/meta-networking/recipes-daemons/postfix/files/postfix
@@ -40,6 +40,7 @@ case "$1" in
40 newaliases 40 newaliases
41 fi 41 fi
42 if ! postfix status >/dev/null 2>&1; then 42 if ! postfix status >/dev/null 2>&1; then
43 /usr/sbin/check_hostname.sh
43 postfix start 44 postfix start
44 check_return $? 45 check_return $?
45 else 46 else
diff --git a/meta-networking/recipes-daemons/postfix/files/postfix.service b/meta-networking/recipes-daemons/postfix/files/postfix.service
index 02ea640b25..3a9a0a1813 100644
--- a/meta-networking/recipes-daemons/postfix/files/postfix.service
+++ b/meta-networking/recipes-daemons/postfix/files/postfix.service
@@ -6,6 +6,7 @@ Conflicts=sendmail.service exim.service
6[Service] 6[Service]
7Type=forking 7Type=forking
8PIDFile=@LOCALSTATEDIR@/spool/postfix/pid/master.pid 8PIDFile=@LOCALSTATEDIR@/spool/postfix/pid/master.pid
9ExecStartPre=-@SBINDIR@/check_hostname.sh
9ExecStartPre=-@LIBEXECDIR@/aliasesdb 10ExecStartPre=-@LIBEXECDIR@/aliasesdb
10ExecStart=@SBINDIR@/postfix start 11ExecStart=@SBINDIR@/postfix start
11ExecReload=@SBINDIR@/postfix reload 12ExecReload=@SBINDIR@/postfix reload
diff --git a/meta-networking/recipes-daemons/postfix/postfix.inc b/meta-networking/recipes-daemons/postfix/postfix.inc
index 6d39570d34..dc652d7da1 100644
--- a/meta-networking/recipes-daemons/postfix/postfix.inc
+++ b/meta-networking/recipes-daemons/postfix/postfix.inc
@@ -23,6 +23,7 @@ SRC_URI = "ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-${PV
23 file://internal_recipient \ 23 file://internal_recipient \
24 file://postfix.service \ 24 file://postfix.service \
25 file://aliasesdb \ 25 file://aliasesdb \
26 file://check_hostname.sh \
26" 27"
27 28
28S = "${WORKDIR}/postfix-${PV}" 29S = "${WORKDIR}/postfix-${PV}"
@@ -145,6 +146,8 @@ do_install () {
145 install -m 644 ${WORKDIR}/main.cf_2.0 ${D}${sysconfdir}/postfix/main.cf 146 install -m 644 ${WORKDIR}/main.cf_2.0 ${D}${sysconfdir}/postfix/main.cf
146 sed -i 's#@LIBEXECDIR@#${libexecdir}#' ${D}${sysconfdir}/postfix/main.cf 147 sed -i 's#@LIBEXECDIR@#${libexecdir}#' ${D}${sysconfdir}/postfix/main.cf
147 148
149 install -m 755 ${WORKDIR}/check_hostname.sh ${D}${sbindir}/
150
148 install -m 755 ${WORKDIR}/postfix ${D}${sysconfdir}/init.d/postfix 151 install -m 755 ${WORKDIR}/postfix ${D}${sysconfdir}/init.d/postfix
149 install -m 644 ${WORKDIR}/internal_recipient ${D}${sysconfdir}/postfix/internal_recipient 152 install -m 644 ${WORKDIR}/internal_recipient ${D}${sysconfdir}/postfix/internal_recipient
150 153