Accepting request 835242 from network:dhcp
- Don't create dhclient.leases in %post. It affects transactional updates and the files don't need to pre-exist (boo#1129951). - Drop dependency on insserv-compat It was required to call the rc_status helpers from the sysvinit scripts. These scripts are supposed to be called by systemd, which has its own mechanism to report service status. Please note that this package still needs to be converted to ship proper systemd units. - /var/run is legacy -> /run should be used instead OBS-URL: https://build.opensuse.org/request/show/835242 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/dhcp?expand=0&rev=121
This commit is contained in:
commit
014174f825
23
dhcp.changes
23
dhcp.changes
@ -1,3 +1,26 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Sep 17 14:55:25 UTC 2020 - Reinhard Max <max@suse.com>
|
||||||
|
|
||||||
|
- Don't create dhclient.leases in %post. It affects transactional
|
||||||
|
updates and the files don't need to pre-exist (boo#1129951).
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Sep 3 13:52:57 UTC 2020 - Franck Bui <fbui@suse.com>
|
||||||
|
|
||||||
|
- Drop dependency on insserv-compat
|
||||||
|
|
||||||
|
It was required to call the rc_status helpers from the sysvinit
|
||||||
|
scripts. These scripts are supposed to be called by systemd, which
|
||||||
|
has its own mechanism to report service status.
|
||||||
|
|
||||||
|
Please note that this package still needs to be converted to ship
|
||||||
|
proper systemd units.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Sep 3 12:56:11 UTC 2020 - Franck Bui <fbui@suse.com>
|
||||||
|
|
||||||
|
- /var/run is legacy -> /run should be used instead
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Jun 29 07:11:52 UTC 2020 - Dominique Leuenberger <dimstar@opensuse.org>
|
Mon Jun 29 07:11:52 UTC 2020 - Dominique Leuenberger <dimstar@opensuse.org>
|
||||||
|
|
||||||
|
13
dhcp.spec
13
dhcp.spec
@ -101,13 +101,6 @@ BuildRequires: sysuser-tools
|
|||||||
%package server
|
%package server
|
||||||
Summary: ISC DHCP Server
|
Summary: ISC DHCP Server
|
||||||
Group: Productivity/Networking/Boot/Servers
|
Group: Productivity/Networking/Boot/Servers
|
||||||
%if 0%{?suse_version} > 1500
|
|
||||||
# Workaround: require insserv-compat, until this package is
|
|
||||||
# converted to be shipping proper systemd units (boo#1133632, boo#1173440)
|
|
||||||
# There are .service units in place, but they call out to sysv init scripts
|
|
||||||
# that source rc.status
|
|
||||||
Requires: insserv-compat
|
|
||||||
%endif
|
|
||||||
Requires: dhcp = %{version}
|
Requires: dhcp = %{version}
|
||||||
%if 0%{?suse_version} < 1500
|
%if 0%{?suse_version} < 1500
|
||||||
Requires: net-tools
|
Requires: net-tools
|
||||||
@ -466,12 +459,6 @@ fi
|
|||||||
%service_del_postun dhcrelay.service
|
%service_del_postun dhcrelay.service
|
||||||
%service_del_postun dhcrelay6.service
|
%service_del_postun dhcrelay6.service
|
||||||
|
|
||||||
%post client
|
|
||||||
test -e %{_localstatedir}/lib/dhcp/dhclient.leases || \
|
|
||||||
echo -n > %{_localstatedir}/lib/dhcp/dhclient.leases
|
|
||||||
test -e %{_localstatedir}/lib/dhcp6/dhclient6.leases || \
|
|
||||||
echo -n > %{_localstatedir}/lib/dhcp6/dhclient6.leases
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%{_bindir}/omshell
|
%{_bindir}/omshell
|
||||||
|
82
dhcpd.script
82
dhcpd.script
@ -34,7 +34,7 @@ SUPPORTS_HUP="no"
|
|||||||
# $DAEMON_STATE$DAEMON_PIDFILE (also
|
# $DAEMON_STATE$DAEMON_PIDFILE (also
|
||||||
# while DHCPD_RUN_CHROOTED=no) now,
|
# while DHCPD_RUN_CHROOTED=no) now,
|
||||||
# as DHCPD_RUN_AS is not allowed to
|
# as DHCPD_RUN_AS is not allowed to
|
||||||
# create pid files in /var/run.
|
# create pid files in /run.
|
||||||
|
|
||||||
DHCPv_OPT=$1 ; shift
|
DHCPv_OPT=$1 ; shift
|
||||||
case $DHCPv_OPT in
|
case $DHCPv_OPT in
|
||||||
@ -44,7 +44,7 @@ case $DHCPv_OPT in
|
|||||||
DAEMON_CONF=/etc/dhcpd.conf
|
DAEMON_CONF=/etc/dhcpd.conf
|
||||||
DAEMON_STATE=/var/lib/dhcp
|
DAEMON_STATE=/var/lib/dhcp
|
||||||
DAEMON_LEASES=dhcpd.leases
|
DAEMON_LEASES=dhcpd.leases
|
||||||
DAEMON_PIDFILE=/var/run/dhcpd.pid
|
DAEMON_PIDFILE=/run/dhcpd.pid
|
||||||
STARTPROC_LOGFILE=/var/log/rc.dhcpd.log
|
STARTPROC_LOGFILE=/var/log/rc.dhcpd.log
|
||||||
LDAP_CONF=/etc/openldap/ldap.conf
|
LDAP_CONF=/etc/openldap/ldap.conf
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ case $DHCPv_OPT in
|
|||||||
DAEMON_CONF=/etc/dhcpd6.conf
|
DAEMON_CONF=/etc/dhcpd6.conf
|
||||||
DAEMON_STATE=/var/lib/dhcp6
|
DAEMON_STATE=/var/lib/dhcp6
|
||||||
DAEMON_LEASES=dhcpd6.leases
|
DAEMON_LEASES=dhcpd6.leases
|
||||||
DAEMON_PIDFILE=/var/run/dhcpd6.pid
|
DAEMON_PIDFILE=/run/dhcpd6.pid
|
||||||
STARTPROC_LOGFILE=/var/log/rc.dhcpd6.log
|
STARTPROC_LOGFILE=/var/log/rc.dhcpd6.log
|
||||||
LDAP_CONF=""
|
LDAP_CONF=""
|
||||||
|
|
||||||
@ -77,20 +77,6 @@ case $DHCPv_OPT in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Shell functions sourced from /etc/rc.status:
|
|
||||||
# rc_check check and set local and overall rc status
|
|
||||||
# rc_status check and set local and overall rc status
|
|
||||||
# rc_status -v ditto but be verbose in local rc status
|
|
||||||
# rc_status -v -r ditto and clear the local rc status
|
|
||||||
# rc_failed set local and overall rc status to failed
|
|
||||||
# rc_failed <num> set local and overall rc status to <num><num>
|
|
||||||
# rc_reset clear local rc status (overall remains)
|
|
||||||
# rc_exit exit appropriate to overall rc status
|
|
||||||
. /etc/rc.status
|
|
||||||
|
|
||||||
# First reset status of this service
|
|
||||||
rc_reset
|
|
||||||
|
|
||||||
# Return values acc. to LSB for all commands but status:
|
# Return values acc. to LSB for all commands but status:
|
||||||
# 0 - success
|
# 0 - success
|
||||||
# 1 - generic or unspecified error
|
# 1 - generic or unspecified error
|
||||||
@ -111,13 +97,12 @@ if ! [ -x "$DAEMON_BIN" ]; then
|
|||||||
stop) ;;
|
stop) ;;
|
||||||
*) echo -n >&2 "\"$DAEMON_BIN\" is not an executable file. Exiting."
|
*) echo -n >&2 "\"$DAEMON_BIN\" is not an executable file. Exiting."
|
||||||
case $1 in
|
case $1 in
|
||||||
status) rc_failed 4 ;;
|
status) exit 4 ;;
|
||||||
*) rc_failed 5 ;;
|
*) exit 5 ;;
|
||||||
esac
|
esac
|
||||||
rc_status -v
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
rc_exit
|
exit
|
||||||
fi
|
fi
|
||||||
if ! [ -r "$DAEMON_CONF" ] ; then
|
if ! [ -r "$DAEMON_CONF" ] ; then
|
||||||
case $1 in
|
case $1 in
|
||||||
@ -129,9 +114,7 @@ if ! [ -r "$DAEMON_CONF" ] ; then
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo -n >&2 "\"$DAEMON_CONF\" config file missed. Exiting."
|
echo -n >&2 "\"$DAEMON_CONF\" config file missed. Exiting."
|
||||||
rc_failed 6
|
exit 6
|
||||||
rc_status -v
|
|
||||||
rc_exit
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@ -149,8 +132,6 @@ case "$1" in
|
|||||||
## and return with "program not configured"
|
## and return with "program not configured"
|
||||||
if ! [ -f $DAEMON_CONF ]; then
|
if ! [ -f $DAEMON_CONF ]; then
|
||||||
echo -n "... no configuration file found";
|
echo -n "... no configuration file found";
|
||||||
# Tell the user this has skipped
|
|
||||||
rc_status -s
|
|
||||||
# service is not configured
|
# service is not configured
|
||||||
exit 6;
|
exit 6;
|
||||||
fi
|
fi
|
||||||
@ -161,8 +142,6 @@ case "$1" in
|
|||||||
var="DHCPD_INTERFACE"
|
var="DHCPD_INTERFACE"
|
||||||
case $DHCPv_OPT in -6) var=DHCPD6_INTERFACE ;; esac
|
case $DHCPv_OPT in -6) var=DHCPD6_INTERFACE ;; esac
|
||||||
echo -n "... set $var in /etc/sysconfig/dhcpd"
|
echo -n "... set $var in /etc/sysconfig/dhcpd"
|
||||||
# Tell the user this has skipped
|
|
||||||
rc_status -s
|
|
||||||
# service is not configured
|
# service is not configured
|
||||||
exit 6;
|
exit 6;
|
||||||
fi
|
fi
|
||||||
@ -206,7 +185,7 @@ case "$1" in
|
|||||||
for i in $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES $LDAP_CONF /etc/{gai.conf,nsswitch.conf,resolv.conf,host.conf,hosts,localtime,bindresvport.blacklist} /dev/urandom; do
|
for i in $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES $LDAP_CONF /etc/{gai.conf,nsswitch.conf,resolv.conf,host.conf,hosts,localtime,bindresvport.blacklist} /dev/urandom; do
|
||||||
if ! test -e "$i"; then continue; fi # neither of them is absolutely necessary
|
if ! test -e "$i"; then continue; fi # neither of them is absolutely necessary
|
||||||
cp -aL "$i" "${CHROOT_PREFIX}/${i%/*}/" &>/dev/null \
|
cp -aL "$i" "${CHROOT_PREFIX}/${i%/*}/" &>/dev/null \
|
||||||
|| { echo "...$0:$LINENO: could not copy $i to chroot jail"; rc_failed; rc_status -v1; exit 6; }
|
|| { echo "...$0:$LINENO: could not copy $i to chroot jail"; exit 6; }
|
||||||
done
|
done
|
||||||
libdir=@LIBDIR@
|
libdir=@LIBDIR@
|
||||||
if test -x /usr/bin/ldd ; then
|
if test -x /usr/bin/ldd ; then
|
||||||
@ -236,7 +215,7 @@ case "$1" in
|
|||||||
for i in $cplibs ; do
|
for i in $cplibs ; do
|
||||||
if [ -s "$i" ]; then
|
if [ -s "$i" ]; then
|
||||||
cp -pL "$i" "${CHROOT_PREFIX}/$libdir/" \
|
cp -pL "$i" "${CHROOT_PREFIX}/$libdir/" \
|
||||||
|| { echo "...$0:$LINENO: could not copy $i to chroot jail"; rc_failed; rc_status -v1; exit 6; }
|
|| { echo "...$0:$LINENO: could not copy $i to chroot jail"; exit 6; }
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -247,7 +226,7 @@ case "$1" in
|
|||||||
DHCPD_ARGS="-chroot $CHROOT_PREFIX -lf /db/$DAEMON_LEASES"
|
DHCPD_ARGS="-chroot $CHROOT_PREFIX -lf /db/$DAEMON_LEASES"
|
||||||
|
|
||||||
## If there is a pid file containing a pid, the machine might have crashed. pid files in
|
## If there is a pid file containing a pid, the machine might have crashed. pid files in
|
||||||
## /var/run are always cleaned up at boot time, but this is not the case for the pid file in
|
## /run are always cleaned up at boot time, but this is not the case for the pid file in
|
||||||
## the chroot jail. Therefore, and old pid file may exist. This is only a problem if it
|
## the chroot jail. Therefore, and old pid file may exist. This is only a problem if it
|
||||||
## incidentally contains the pid of a running process. If this process is not a 'dhcpd',
|
## incidentally contains the pid of a running process. If this process is not a 'dhcpd',
|
||||||
## we remove the pid. (dhcpd itself only checks whether the pid is alive or not.)
|
## we remove the pid. (dhcpd itself only checks whether the pid is alive or not.)
|
||||||
@ -296,14 +275,11 @@ case "$1" in
|
|||||||
echo ""
|
echo ""
|
||||||
echo -n " please see $STARTPROC_LOGFILE for details "
|
echo -n " please see $STARTPROC_LOGFILE for details "
|
||||||
## set status to failed
|
## set status to failed
|
||||||
rc_failed
|
exit 1
|
||||||
else
|
else
|
||||||
ln -sf "$DAEMON_STATE$DAEMON_PIDFILE" "$DAEMON_PIDFILE"
|
ln -sf "$DAEMON_STATE$DAEMON_PIDFILE" "$DAEMON_PIDFILE"
|
||||||
[ "$DHCPD_RUN_CHROOTED" = "yes" ] && echo -n "[chroot]" || :
|
[ "$DHCPD_RUN_CHROOTED" = "yes" ] && echo -n "[chroot]" || :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remember status and be verbose
|
|
||||||
rc_status -v
|
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo -n "Shutting down $DAEMON "
|
echo -n "Shutting down $DAEMON "
|
||||||
@ -339,9 +315,7 @@ case "$1" in
|
|||||||
rm -f $CHROOT_PREFIX/lib*/*
|
rm -f $CHROOT_PREFIX/lib*/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remember status and be verbose
|
exit $ret
|
||||||
rc_failed $ret
|
|
||||||
rc_status -v
|
|
||||||
;;
|
;;
|
||||||
try-restart)
|
try-restart)
|
||||||
## Do a restart only if the service was active before.
|
## Do a restart only if the service was active before.
|
||||||
@ -350,11 +324,7 @@ case "$1" in
|
|||||||
$0 $DHCPv_OPT status
|
$0 $DHCPv_OPT status
|
||||||
if test $? = 0; then
|
if test $? = 0; then
|
||||||
$0 $DHCPv_OPT restart
|
$0 $DHCPv_OPT restart
|
||||||
else
|
|
||||||
rc_reset # Not running is not a failure.
|
|
||||||
fi
|
fi
|
||||||
# Remember status and be quiet
|
|
||||||
rc_status
|
|
||||||
;;
|
;;
|
||||||
restart)
|
restart)
|
||||||
## Check syntax and when it is OK, stop the service
|
## Check syntax and when it is OK, stop the service
|
||||||
@ -362,14 +332,11 @@ case "$1" in
|
|||||||
## start it again.
|
## start it again.
|
||||||
if ! $0 $DHCPv_OPT check-syntax &>/dev/null ; then
|
if ! $0 $DHCPv_OPT check-syntax &>/dev/null ; then
|
||||||
echo -n "Syntax check reports errors, see log messages"
|
echo -n "Syntax check reports errors, see log messages"
|
||||||
rc_failed
|
exit 1
|
||||||
rc_status -v
|
|
||||||
else
|
else
|
||||||
$0 $DHCPv_OPT stop
|
$0 $DHCPv_OPT stop
|
||||||
sleep 3
|
sleep 3
|
||||||
$0 $DHCPv_OPT start
|
$0 $DHCPv_OPT start
|
||||||
# Remember status and be quiet
|
|
||||||
rc_status
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
force-reload)
|
force-reload)
|
||||||
@ -381,14 +348,11 @@ case "$1" in
|
|||||||
echo -n "Reload service $DAEMON"
|
echo -n "Reload service $DAEMON"
|
||||||
killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN
|
killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN
|
||||||
#touch $DAEMON_STATE/$DAEMON_PIDFILE
|
#touch $DAEMON_STATE/$DAEMON_PIDFILE
|
||||||
rc_status -v
|
|
||||||
elif ! $0 $DHCPv_OPT check-syntax &>/dev/null ; then
|
elif ! $0 $DHCPv_OPT check-syntax &>/dev/null ; then
|
||||||
echo -n "Syntax check reports errors, see log messages"
|
echo -n "Syntax check reports errors, see log messages"
|
||||||
rc_failed
|
exit 1
|
||||||
rc_status -v
|
|
||||||
else
|
else
|
||||||
$0 $DHCPv_OPT stop && sleep 3 && $0 $DHCPv_OPT start
|
$0 $DHCPv_OPT stop && sleep 3 && $0 $DHCPv_OPT start
|
||||||
rc_status
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
reload)
|
reload)
|
||||||
@ -400,11 +364,9 @@ case "$1" in
|
|||||||
# If it supports signalling:
|
# If it supports signalling:
|
||||||
killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN
|
killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN
|
||||||
#touch $DAEMON_STATE/$DAEMON_PIDFILE
|
#touch $DAEMON_STATE/$DAEMON_PIDFILE
|
||||||
rc_status -v
|
|
||||||
else
|
else
|
||||||
## Otherwise if it does not support reload:
|
## Otherwise if it does not support reload:
|
||||||
rc_failed 3
|
exit 3
|
||||||
rc_status -v
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
@ -414,13 +376,12 @@ case "$1" in
|
|||||||
|
|
||||||
# Status has a slightly different for the status command:
|
# Status has a slightly different for the status command:
|
||||||
# 0 - service running
|
# 0 - service running
|
||||||
# 1 - service dead, but /var/run/ pid file exists
|
# 1 - service dead, but /run/ pid file exists
|
||||||
# 2 - service dead, but /var/lock/ lock file exists
|
# 2 - service dead, but /var/lock/ lock file exists
|
||||||
# 3 - service not running
|
# 3 - service not running
|
||||||
|
|
||||||
# NOTE: checkproc returns LSB compliant status values.
|
# NOTE: checkproc returns LSB compliant status values.
|
||||||
checkproc -p $DAEMON_STATE/$DAEMON_PIDFILE $DAEMON_BIN
|
checkproc -p $DAEMON_STATE/$DAEMON_PIDFILE $DAEMON_BIN
|
||||||
rc_status -v
|
|
||||||
;;
|
;;
|
||||||
probe)
|
probe)
|
||||||
## Optional: Probe for the necessity of a reload,
|
## Optional: Probe for the necessity of a reload,
|
||||||
@ -438,15 +399,13 @@ case "$1" in
|
|||||||
## this nice bit is from Edwin Groothuis:
|
## this nice bit is from Edwin Groothuis:
|
||||||
## check syntax (quiet)
|
## check syntax (quiet)
|
||||||
$DAEMON_BIN $DHCPv_OPT -q -t -cf $DAEMON_CONF
|
$DAEMON_BIN $DHCPv_OPT -q -t -cf $DAEMON_CONF
|
||||||
rc_status
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo ""
|
echo ""
|
||||||
## check syntax (verbose)
|
## check syntax (verbose)
|
||||||
$DAEMON_BIN $DHCPv_OPT -t -cf $DAEMON_CONF
|
$DAEMON_BIN $DHCPv_OPT -t -cf $DAEMON_CONF
|
||||||
echo -ne '\nConfig is NOT okay'
|
echo -ne '\nConfig is NOT okay'
|
||||||
rc_failed
|
exit 1
|
||||||
fi
|
fi
|
||||||
rc_status -v
|
|
||||||
;;
|
;;
|
||||||
check-lease|check-lease-file)
|
check-lease|check-lease-file)
|
||||||
echo -n "Checking lease file $DAEMON_LEASES: "
|
echo -n "Checking lease file $DAEMON_LEASES: "
|
||||||
@ -454,22 +413,17 @@ case "$1" in
|
|||||||
if [ -s ${DAEMON_STATE}/db/$DAEMON_LEASES ] ; then
|
if [ -s ${DAEMON_STATE}/db/$DAEMON_LEASES ] ; then
|
||||||
## check leases file (quiet)
|
## check leases file (quiet)
|
||||||
$DAEMON_BIN $DHCPv_OPT -q -T -cf /dev/null -lf ${DAEMON_STATE}/db/$DAEMON_LEASES
|
$DAEMON_BIN $DHCPv_OPT -q -T -cf /dev/null -lf ${DAEMON_STATE}/db/$DAEMON_LEASES
|
||||||
rc_status
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo ""
|
echo ""
|
||||||
## check leases file (verbose)
|
## check leases file (verbose)
|
||||||
$DAEMON_BIN $DHCPv_OPT -T -cf $DAEMON_CONF -lf ${DAEMON_STATE}/db/$DAEMON_LEASES
|
$DAEMON_BIN $DHCPv_OPT -T -cf $DAEMON_CONF -lf ${DAEMON_STATE}/db/$DAEMON_LEASES
|
||||||
echo -ne '\nLease file is NOT okay'
|
echo -ne '\nLease file is NOT okay'
|
||||||
rc_failed
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
rc_status -u
|
|
||||||
fi
|
fi
|
||||||
rc_status -v
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
SCRIPT="${SCRIPT:-${0##*/} $DHCPv_OPT}"
|
SCRIPT="${SCRIPT:-${0##*/} $DHCPv_OPT}"
|
||||||
echo "Usage: $SCRIPT {start|stop|status|try-restart|restart|force-reload|reload|probe|check-syntax} [-v]"
|
echo "Usage: $SCRIPT {start|stop|status|try-restart|restart|force-reload|reload|probe|check-syntax} [-v]"
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
rc_exit
|
|
||||||
|
@ -18,7 +18,7 @@ case $DHCPv_OPT in
|
|||||||
DAEMON="ISC DHCPv4 relay agent"
|
DAEMON="ISC DHCPv4 relay agent"
|
||||||
DAEMON_BIN=/usr/sbin/dhcrelay
|
DAEMON_BIN=/usr/sbin/dhcrelay
|
||||||
DAEMON_CONF=/etc/sysconfig/dhcrelay
|
DAEMON_CONF=/etc/sysconfig/dhcrelay
|
||||||
DAEMON_PIDFILE=/var/run/dhcrelay.pid
|
DAEMON_PIDFILE=/run/dhcrelay.pid
|
||||||
STARTPROC_LOGFILE=/var/log/rc.dhcrelay.log
|
STARTPROC_LOGFILE=/var/log/rc.dhcrelay.log
|
||||||
SUPPORTS_HUP="no"
|
SUPPORTS_HUP="no"
|
||||||
;;
|
;;
|
||||||
@ -26,7 +26,7 @@ case $DHCPv_OPT in
|
|||||||
DAEMON="ISC DHCPv6 relay agent"
|
DAEMON="ISC DHCPv6 relay agent"
|
||||||
DAEMON_BIN=/usr/sbin/dhcrelay6
|
DAEMON_BIN=/usr/sbin/dhcrelay6
|
||||||
DAEMON_CONF=/etc/sysconfig/dhcrelay
|
DAEMON_CONF=/etc/sysconfig/dhcrelay
|
||||||
DAEMON_PIDFILE=/var/run/dhcrelay6.pid
|
DAEMON_PIDFILE=/run/dhcrelay6.pid
|
||||||
STARTPROC_LOGFILE=/var/log/rc.dhcrelay6.log
|
STARTPROC_LOGFILE=/var/log/rc.dhcrelay6.log
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@ -41,29 +41,14 @@ if ! [ -x "$DAEMON_BIN" ]; then
|
|||||||
stop) ;;
|
stop) ;;
|
||||||
*) echo -n >&2 "$0: \"$DAEMON_BIN\" is not an executable file. Exiting."
|
*) echo -n >&2 "$0: \"$DAEMON_BIN\" is not an executable file. Exiting."
|
||||||
case $1 in
|
case $1 in
|
||||||
status) rc_failed 4 ;;
|
status) exit 4 ;;
|
||||||
*) rc_failed 5 ;;
|
*) exit 5 ;;
|
||||||
esac
|
esac
|
||||||
rc_status -v
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
rc_exit
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Shell functions sourced from /etc/rc.status:
|
|
||||||
# rc_check check and set local and overall rc status
|
|
||||||
# rc_status check and set local and overall rc status
|
|
||||||
# rc_status -v ditto but be verbose in local rc status
|
|
||||||
# rc_status -v -r ditto and clear the local rc status
|
|
||||||
# rc_failed set local and overall rc status to failed
|
|
||||||
# rc_failed <num> set local and overall rc status to <num><num>
|
|
||||||
# rc_reset clear local rc status (overall remains)
|
|
||||||
# rc_exit exit appropriate to overall rc status
|
|
||||||
. /etc/rc.status
|
|
||||||
|
|
||||||
# First reset status of this service
|
|
||||||
rc_reset
|
|
||||||
|
|
||||||
# Return values acc. to LSB for all commands but status:
|
# Return values acc. to LSB for all commands but status:
|
||||||
# 0 - success
|
# 0 - success
|
||||||
# 1 - generic or unspecified error
|
# 1 - generic or unspecified error
|
||||||
@ -81,9 +66,10 @@ rc_reset
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
|
# FIXME: this check is pointless since systemd already do it.
|
||||||
echo -n "Starting $DAEMON"
|
echo -n "Starting $DAEMON"
|
||||||
checkproc -p $DAEMON_PIDFILE $DAEMON_BIN && {
|
checkproc -p $DAEMON_PIDFILE $DAEMON_BIN && {
|
||||||
echo -n "... already running"; rc_status -v; exit 0;
|
echo -n "... already running"; exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case $DHCPv_OPT in
|
case $DHCPv_OPT in
|
||||||
@ -91,8 +77,6 @@ case "$1" in
|
|||||||
## If interfaces or servers are not set, skip starting of dhcrelay
|
## If interfaces or servers are not set, skip starting of dhcrelay
|
||||||
## and return with "program not configured"
|
## and return with "program not configured"
|
||||||
if [ -z "$DHCRELAY_INTERFACES" -o -z "$DHCRELAY_SERVERS" ]; then
|
if [ -z "$DHCRELAY_INTERFACES" -o -z "$DHCRELAY_SERVERS" ]; then
|
||||||
# Tell the user this has skipped
|
|
||||||
rc_status -s
|
|
||||||
# service is not configured
|
# service is not configured
|
||||||
exit 6;
|
exit 6;
|
||||||
fi
|
fi
|
||||||
@ -117,8 +101,6 @@ case "$1" in
|
|||||||
done
|
done
|
||||||
if [ "x$DHCRELAY6_LOWER_INTERFACES_ARGS" = x -o \
|
if [ "x$DHCRELAY6_LOWER_INTERFACES_ARGS" = x -o \
|
||||||
"x$DHCRELAY6_UPPER_INTERFACES_ARGS" = x ]; then
|
"x$DHCRELAY6_UPPER_INTERFACES_ARGS" = x ]; then
|
||||||
# Tell the user this has skipped
|
|
||||||
rc_status -s
|
|
||||||
# service is not configured
|
# service is not configured
|
||||||
exit 6;
|
exit 6;
|
||||||
fi
|
fi
|
||||||
@ -141,11 +123,8 @@ case "$1" in
|
|||||||
echo ""
|
echo ""
|
||||||
echo -n " please see $STARTPROC_LOGFILE for details "
|
echo -n " please see $STARTPROC_LOGFILE for details "
|
||||||
## set status to failed
|
## set status to failed
|
||||||
rc_failed
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remember status and be verbose
|
|
||||||
rc_status -v
|
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo -n "Shutting down $DAEMON"
|
echo -n "Shutting down $DAEMON"
|
||||||
@ -153,9 +132,6 @@ case "$1" in
|
|||||||
## set echo the echo return value.
|
## set echo the echo return value.
|
||||||
|
|
||||||
killproc -p $DAEMON_PIDFILE $DAEMON_BIN
|
killproc -p $DAEMON_PIDFILE $DAEMON_BIN
|
||||||
|
|
||||||
# Remember status and be verbose
|
|
||||||
rc_status -v
|
|
||||||
;;
|
;;
|
||||||
try-restart)
|
try-restart)
|
||||||
## Do a restart only if the service was active before.
|
## Do a restart only if the service was active before.
|
||||||
@ -164,11 +140,7 @@ case "$1" in
|
|||||||
$0 status
|
$0 status
|
||||||
if test $? = 0; then
|
if test $? = 0; then
|
||||||
$0 restart
|
$0 restart
|
||||||
else
|
|
||||||
rc_reset # Not running is not a failure.
|
|
||||||
fi
|
fi
|
||||||
# Remember status and be quiet
|
|
||||||
rc_status
|
|
||||||
;;
|
;;
|
||||||
restart)
|
restart)
|
||||||
## Stop the service and regardless of whether it was
|
## Stop the service and regardless of whether it was
|
||||||
@ -176,27 +148,21 @@ case "$1" in
|
|||||||
$0 stop
|
$0 stop
|
||||||
sleep 1
|
sleep 1
|
||||||
$0 start
|
$0 start
|
||||||
|
|
||||||
# Remember status and be quiet
|
|
||||||
rc_status
|
|
||||||
;;
|
;;
|
||||||
force-reload)
|
force-reload)
|
||||||
## Signal the daemon to reload its config. Most daemons
|
## Signal the daemon to reload its config. Most daemons
|
||||||
## do this on signal 1 (SIGHUP).
|
## do this on signal 1 (SIGHUP).
|
||||||
## If it does not support it, restart.
|
## If it does not support it, restart.
|
||||||
|
|
||||||
$0 stop && sleep 1 && $0 start
|
$0 stop && sleep 1 && $0 start || exit
|
||||||
rc_status
|
|
||||||
|
|
||||||
echo -n "Reload service $DAEMON"
|
echo -n "Reload service $DAEMON"
|
||||||
|
|
||||||
if [ "$SUPPORTS_HUP" = "yes" ] ; then
|
if [ "$SUPPORTS_HUP" = "yes" ] ; then
|
||||||
killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
|
killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
|
||||||
#touch $DAEMON_PIDFILE
|
#touch $DAEMON_PIDFILE
|
||||||
rc_status -v
|
|
||||||
else
|
else
|
||||||
$0 stop && $0 start
|
$0 stop && $0 start
|
||||||
rc_status
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
reload)
|
reload)
|
||||||
@ -208,11 +174,9 @@ case "$1" in
|
|||||||
echo -n "Reload service $DAEMON"
|
echo -n "Reload service $DAEMON"
|
||||||
killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
|
killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
|
||||||
#touch $DAEMON_PIDFILE
|
#touch $DAEMON_PIDFILE
|
||||||
rc_status -v
|
|
||||||
else
|
else
|
||||||
## Otherwise if it does not support reload:
|
## Otherwise if it does not support reload:
|
||||||
rc_failed 3
|
exit 3
|
||||||
rc_status -v
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
@ -222,13 +186,12 @@ case "$1" in
|
|||||||
|
|
||||||
# Status has a slightly different for the status command:
|
# Status has a slightly different for the status command:
|
||||||
# 0 - service running
|
# 0 - service running
|
||||||
# 1 - service dead, but /var/run/ pid file exists
|
# 1 - service dead, but /run/ pid file exists
|
||||||
# 2 - service dead, but /var/lock/ lock file exists
|
# 2 - service dead, but /var/lock/ lock file exists
|
||||||
# 3 - service not running
|
# 3 - service not running
|
||||||
|
|
||||||
# NOTE: checkproc returns LSB compliant status values.
|
# NOTE: checkproc returns LSB compliant status values.
|
||||||
checkproc -p $DAEMON_PIDFILE $DAEMON_BIN
|
checkproc -p $DAEMON_PIDFILE $DAEMON_BIN
|
||||||
rc_status -v
|
|
||||||
;;
|
;;
|
||||||
probe)
|
probe)
|
||||||
## Optional: Probe for the necessity of a reload,
|
## Optional: Probe for the necessity of a reload,
|
||||||
@ -248,4 +211,3 @@ case "$1" in
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
rc_exit
|
|
||||||
|
@ -8,7 +8,7 @@ Type=forking
|
|||||||
Restart=on-abort
|
Restart=on-abort
|
||||||
ExecStart=@LIBEXECDIR@/dhcp/dhcrelay -4 start
|
ExecStart=@LIBEXECDIR@/dhcp/dhcrelay -4 start
|
||||||
ExecStop=@LIBEXECDIR@/dhcp/dhcrelay -4 stop
|
ExecStop=@LIBEXECDIR@/dhcp/dhcrelay -4 stop
|
||||||
PIDFile=/var/run/dhcrelay.pid
|
PIDFile=/run/dhcrelay.pid
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
Loading…
Reference in New Issue
Block a user