From 27892ea741e2a7fa82bbba07077fd3606e517c7d Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Tue, 14 Jul 2015 16:24:29 +0200 Subject: [PATCH] remove dependency on initscripts (#1098172) --- dhclient-script | 60 ++++++++++++++++++++++++++++++++++++++----------- dhcp.spec | 7 ++++-- 2 files changed, 52 insertions(+), 15 deletions(-) diff --git a/dhclient-script b/dhclient-script index e2a233c..6700287 100644 --- a/dhclient-script +++ b/dhclient-script @@ -654,6 +654,53 @@ dh6config() { execute_client_side_configuration_scripts "config" } +# Functions from /etc/sysconfig/network-scripts/network-functions + +need_hostname () +{ + CHECK_HOSTNAME=$(hostname) + if [ "$CHECK_HOSTNAME" = "(none)" -o "$CHECK_HOSTNAME" = "localhost" -o \ + "$CHECK_HOSTNAME" = "localhost.localdomain" ]; then + return 0 + else + return 1 + fi +} + +change_resolv_conf () +{ + s=$(grep '^[\ \ ]*option' /etc/resolv.conf 2>/dev/null); + if [ $# -eq 1 ]; then + if [ "x$s" != "x" ]; then + s="$s"$'\n'$(grep -vF "$s" $1); + else + s=$(cat $1); + fi; + fi; + (echo "$s" > /etc/resolv.conf;) >/dev/null 2>&1; + r=$?; + if [ $r -eq 0 ]; then + logger -p local7.notice -t "NET" -i "$0 : updated /etc/resolv.conf"; + [ -e /var/run/nscd/socket ] && /usr/sbin/nscd -i hosts; # invalidate cache + fi; + return $r; +} + +need_config () +{ + # Do we really need this ? + # The original one from /etc/sysconfig/network-scripts/network-functions + # seems to set CONFIG variable, which we don't use anywhere AFAICT. + : +} + +source_config () +{ + # Do we really need to source /etc/sysconfig/network-scripts/$CONFIG ? + # I don't think we use for example + # DEVNAME, DEVICE, DEVICETYPE, HWADDR, MACADDR, ISALIAS or UUID anywhere. + : +} # # ### MAIN @@ -663,19 +710,6 @@ dh6config() { run_hook "${ETCDIR}/dhclient-enter-hooks" || exit $? run_hookdir "${ETCDIR}/dhclient-enter-hooks.d" || exit $? -if [ ! -r /etc/sysconfig/network-scripts/network-functions ]; then - echo "Missing /etc/sysconfig/network-scripts/network-functions, exiting." >&2 - exit 1 -fi - -if [ ! -r /etc/rc.d/init.d/functions ]; then - echo "Missing /etc/rc.d/init.d/functions, exiting." >&2 - exit 1 -fi - -. /etc/sysconfig/network-scripts/network-functions -. /etc/rc.d/init.d/functions - if [ -f /etc/sysconfig/network ]; then . /etc/sysconfig/network fi diff --git a/dhcp.spec b/dhcp.spec index fc75054..cc14c34 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -18,7 +18,7 @@ Summary: Dynamic host configuration protocol software Name: dhcp Version: 4.3.2 -Release: 10%{?dist} +Release: 11%{?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. @@ -155,7 +155,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 hostname initscripts iproute iputils sed gawk /usr/bin/ipcalc +Requires: coreutils grep sed gawk hostname iproute iputils /bin/ipcalc Requires: %{name}-common = %{epoch}:%{version}-%{release} Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release} @@ -675,6 +675,9 @@ done %doc doc/html/ %changelog +* Tue Jul 14 2015 Jiri Popelka - 12:4.3.2-11 +- remove dependency on initscripts (#1098172) + * Thu Jul 09 2015 Jiri Popelka - 12:4.3.2-10 - spec cleanup