Permalink
Browse files

common: Updated postinst to be more picky about its hostname

  • Loading branch information...
patch0 committed Apr 28, 2017
1 parent 9eb6014 commit 94fddde10d8cbcc37863e341d1113e3d9318ab72
Showing with 8 additions and 1 deletion.
  1. +8 −1 common/debian/postinst
View
@@ -54,14 +54,21 @@ fi
#
# Find the hostname, if not set already.
#
if [ -z "$HOSTNAME" ] ; then
if ! ( echo "$HOSTNAME" | grep -q '^[_a-z0-9-]\+\.\([_a-z0-9-]\+\.\?\)\+$' ) ; then
if [ -f /etc/hostname ] ; then
HOSTNAME=$(< /etc/hostname)
else
HOSTNAME=$(hostname --fqdn)
fi
fi
#
# If the hostname is still invalid, add ".localdomain" to the end
#
if ! ( echo "$HOSTNAME" | grep -q '^[_a-z0-9-]\+\.\([_a-z0-9-]\+\.\?\)\+$' ) ; then
HOSTNAME="${HOSTNAME}.localdomain"
fi
#
# If there are no existing directories beneath /srv/ create a default.
#

0 comments on commit 94fddde

Please sign in to comment.