diff options
Diffstat (limited to 'meta-networking/recipes-daemons/postfix/files/check_hostname.sh')
-rwxr-xr-x | meta-networking/recipes-daemons/postfix/files/check_hostname.sh | 13 |
1 files changed, 13 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 | |||
3 | HOSTNAME=$(/bin/hostname) | ||
4 | |||
5 | if [ -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 | ||
12 | fi | ||
13 | |||