if [[ -z "${hostname}" ]] ; then
hostname="template.pixelpark.com"
fi
-IP_ADDRESS_ETH0=$( host "${hostname}" | sed -e 's/.*has address[ ][ ]*//' )
-DOMAIN=$( echo "${hostname}" | cut -d. -f2,3 )
-SIMPLE_HOSTNAME=$( echo "${hostname}" | cut -d. -f1 )
+
+DEVNAME_ETH0=$( ip -oneline link show | \
+ grep -v ' lo: ' | \
+ head -n 1 | \
+ awk '{print $2}' | \
+ sed -e 's/:$//' )
+IP_ADDRESS_ETH0=$( ip -oneline addr show dev "${DEVNAME_ETH0}" | \
+ grep ' inet ' | \
+ head -n 1 | \
+ awk '{print $4}' | \
+ sed -e 's|/.*||' )
+GATEWAY=$( ip -oneline route show | grep ^default | head -n 1 | awk '{print $3}' )
+DOMAIN=$( echo "${hostname}" | sed -e 's/^[^\.]*\.//' )
+SIMPLE_HOSTNAME=$( echo "${hostname}" | sed -e 's/\..*//' )
if [[ -z "${ip_address_eth0}" ]] ; then
ip_address_eth0="${IP_ADDRESS_ETH0}"
fi
-POSTFIX_MYORIGIN='pixelpark.net'
+if [[ -z "${gateway}" ]] ; then
+ gateway="${GATEWAY}"
+fi
+
+if [[ -z "${mac_address_eth0}" ]] ; then
+ mac_address_eth0=$( ip -oneline link show dev "${DEVNAME_ETH0}" | \
+ grep -P -o 'link/ether\s+\S+' | \
+ awk '{print $2}' )
+fi
+
+POSTFIX_MYORIGIN='pixelpark.com'
POSTFIX_RELAYHOST='[mx.pixelpark.com]'
ERROR_POINTER="/root/postinst-error.txt"