From 2771685b89d0f0e7ff16ef88cb4bb674271f0d8722b2e91b75caaa91933532e0 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Fri, 4 Feb 2022 13:21:47 +0000 Subject: [PATCH] Accepting request 951570 from home:manfred999 - modify source if-up.d.dhcpd-restart-hook: * fix option parsing * do not call /usr/libexec/dhcp/dhcpd directly, use systemd for it OBS-URL: https://build.opensuse.org/request/show/951570 OBS-URL: https://build.opensuse.org/package/show/network:dhcp/dhcp?expand=0&rev=241 --- dhcp.changes | 7 +++++++ if-up.d.dhcpd-restart-hook | 26 +++++++++++++++++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/dhcp.changes b/dhcp.changes index 859b46e..acaa366 100644 --- a/dhcp.changes +++ b/dhcp.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Jan 19 09:53:39 UTC 2022 - Manfred Schwarb + +- modify source if-up.d.dhcpd-restart-hook: + * fix option parsing + * do not call /usr/libexec/dhcp/dhcpd directly, use systemd for it + ------------------------------------------------------------------- Mon Jan 17 08:52:07 UTC 2022 - Johannes Segitz diff --git a/if-up.d.dhcpd-restart-hook b/if-up.d.dhcpd-restart-hook index 8fd1783..9bfbfbf 100644 --- a/if-up.d.dhcpd-restart-hook +++ b/if-up.d.dhcpd-restart-hook @@ -44,10 +44,22 @@ INTERFACE="$1" if test "x$2" != x -a "x$2" != "x-o" ; then CONFIG=$INTERFACE INTERFACE="$2" + shift else CONFIG=$INTERFACE fi +shift +mode="" +args=$(getopt -o "o:" -- "$@") +eval set -- "$args" +while [ $# -gt 0 ]; do + case "$1" in + --) shift; break;; + -o) mode="$2"; shift;; + esac + shift +done . /etc/sysconfig/network/config if test -f /etc/sysconfig/network/scripts/functions ; then @@ -102,7 +114,9 @@ dhcpv4_server_restart() fi if test "$restart_needed" = yes ; then - @LIBEXECDIR@/dhcp/dhcpd -4 try-restart + if test "`/usr/bin/systemctl --value -p SubState show dhcpd.service`" = "running"; then + /usr/bin/systemctl restart dhcpd.service + fi fi } dhcpv6_server_restart() @@ -140,16 +154,18 @@ dhcpv6_server_restart() fi if test "$restart_needed" = yes ; then - @LIBEXECDIR@/dhcp/dhcpd -6 try-restart + if test "`/usr/bin/systemctl --value -p SubState show dhcpd6.service`" = "running"; then + /usr/bin/systemctl restart dhcpd6.service + fi fi } -case "$0" in -*if-up.d*) +case "$mode" in +*-up*) dhcpv4_server_restart dhcpv6_server_restart ;; -*if-down.d*) +*-down*) # don't do anything ;; *)