Skip to content
Commits on Source (2)
......@@ -120,17 +120,15 @@ if $USEMAC && [ -z "$HOSTNAME" ] ; then
SOURCE="hardware MAC address"
fi
# Already got the correct host name?
if [ "$HOSTNAME" = "$(uname -n)" ] ; then
exit 0
fi
if [ "$HOSTNAME" ]; then
if $onlyprint ; then
echo $HOSTNAME
exit 0
else
sethostname "$HOSTNAME" "$SOURCE"
# Already got the correct host name?
if [ "$HOSTNAME" != "$(uname -n)" ] ; then
sethostname "$HOSTNAME" "$SOURCE"
fi
fi
else
exit 1
......
......@@ -88,7 +88,7 @@ setup_from_ldap() {
}
lookup_mac_addrs() {
PATH=/sbin:$PATH LANG=C ifconfig 2>/dev/null | grep -i hwaddr | awk '{print $5}' | sort -u
PATH=/sbin:$PATH LANG=C ip link 2>/dev/null | grep -i link/ether | awk '{print $2}' | sort -u
}
# Only check LDAP when the result can be cached
......