summaryrefslogtreecommitdiffstats
path: root/meta-openembedded/meta-networking/recipes-daemons/postfix/files/check_hostname.sh
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openembedded/meta-networking/recipes-daemons/postfix/files/check_hostname.sh')
-rwxr-xr-xmeta-openembedded/meta-networking/recipes-daemons/postfix/files/check_hostname.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/files/check_hostname.sh b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/check_hostname.sh
new file mode 100755
index 000000000..37a0dd088
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/check_hostname.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+HOSTNAME=$(/bin/hostname)
+
+if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" -o ! -z "`echo $HOSTNAME | sed -n '/^[0-9]*\.[0-9].*/p'`" ]; then
+ # If hostname is invalid, and myhostname not existed in main.cf
+ /usr/sbin/postconf -h "myhostname" 2>/dev/null
+ if [ $? -ne 0 ]; then
+ # Set "localhost" to main.cf
+ /usr/sbin/postconf -e "myhostname=localhost"
+ fi
+fi
+
OpenPOWER on IntegriCloud