diff --git a/dhclient-script b/dhclient-script index c3eb9af..20e6d28 100644 --- a/dhclient-script +++ b/dhclient-script @@ -48,7 +48,7 @@ logmessage() { eventually_add_hostnames_domain_to_search() { # For the case when hostname for this machine has a domain that is not in domain_search list -# 1) get a hostname with `ipcalc --hostname` or `hostname` +# 1) get a hostname with `ipcalc --hostname` or `hostnamectl --transient` # 2) get the domain from this hostname # 3) add this domain to search line in resolv.conf if it's not already # there (domain list that we have recently added there is a parameter of this function) @@ -68,7 +68,7 @@ eventually_add_hostnames_domain_to_search() { domain=$(echo "${HOSTNAME}" | cut -s -d "." -f 2-) fi else - domain=$(hostname 2>/dev/null | cut -s -d "." -f 2-) + domain=$(hostnamectl --transient 2>/dev/null | cut -s -d "." -f 2-) fi if [ -n "${domain}" ] && @@ -550,7 +550,7 @@ dhconfig() { make_resolv_conf if [ -n "${new_host_name}" ] && need_hostname; then - hostname "${new_host_name}" || echo "See -nc option in dhclient(8) man page." + hostnamectl set-hostname --transient --no-ask-password "${new_host_name}" fi if [[ ( "${DHCP_TIME_OFFSET_SETS_TIMEZONE}" = [yY1]* ) && @@ -680,7 +680,7 @@ dh6config() { need_hostname () { - CHECK_HOSTNAME=$(hostname) + CHECK_HOSTNAME=$(hostnamectl --transient) if [[ "${CHECK_HOSTNAME}" = "(none)" ]] || [[ "${CHECK_HOSTNAME}" = "localhost" ]] || [[ "${CHECK_HOSTNAME}" = "localhost.localdomain" ]]; then diff --git a/dhcp.spec b/dhcp.spec index 38b487d..375bfcb 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -18,7 +18,7 @@ Summary: Dynamic host configuration protocol software Name: dhcp Version: 4.3.3 -Release: 6%{?dist} +Release: 7%{?dist} # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # dcantrell maintaining the package) made incorrect use of the epoch and # that's why it is at 12 now. It should have never been used, but it was. @@ -157,7 +157,7 @@ Summary: Provides the ISC DHCP client daemon and dhclient-script Provides: dhclient = %{epoch}:%{version}-%{release} Obsoletes: dhclient < %{epoch}:%{version}-%{release} # dhclient-script requires: -Requires: coreutils grep sed gawk hostname iproute iputils /usr/bin/ipcalc +Requires: coreutils gawk grep ipcalc iproute iputils sed systemd Requires: %{name}-common = %{epoch}:%{version}-%{release} Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release} @@ -663,6 +663,9 @@ done %doc doc/html/ %changelog +* Mon Nov 23 2015 Jiri Popelka - 12:4.3.3-7 +- dhclient-script: hostname -> hostnamectl --transient + * Tue Nov 03 2015 Jiri Popelka - 12:4.3.3-6 - dhclient-script: source ifcfg-* because of PEERDNS (#1277253)