From: Frank Brehm Date: Fri, 12 Jun 2020 13:55:59 +0000 (+0200) Subject: Minor changes to snippets/tpl.001.basics.sh X-Git-Tag: 2.1.2^2~9^2~31^2~40 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=b9a1e6b3db0fec857fb449ade845489cb8ae1cb6;p=pixelpark%2Fcreate-vmware-tpl.git Minor changes to snippets/tpl.001.basics.sh --- diff --git a/snippets/tpl.001.basics.sh b/snippets/tpl.001.basics.sh index 86473d5..a344967 100644 --- a/snippets/tpl.001.basics.sh +++ b/snippets/tpl.001.basics.sh @@ -10,15 +10,36 @@ echo 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"