convert DHC*ARGS from /etc/sysconfig/dhc* to service unit

This commit is contained in:
Jiri Popelka 2013-01-17 17:45:01 +01:00
parent e812a0fa7b
commit dd39224418

View File

@ -18,7 +18,7 @@
Summary: Dynamic host configuration protocol software
Name: dhcp
Version: 4.2.5
Release: 1%{?dist}
Release: 2%{?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.
@ -490,6 +490,28 @@ fi
%postun libs -p /sbin/ldconfig
%triggerun -- dhcp < 12:4.2.4-14.P1
# convert DHC*ARGS from /etc/sysconfig/dhc* to /etc/systemd/system/dhc*.service
for servicename in dhcpd dhcpd6 dhcrelay; do
if [ -f %{dhcpconfdir}/sysconfig/${servicename} ]; then
if [ "${servicename}" == "dhcrelay" ]; then
key="DHCRELAYARGS"
else
key="DHCPDARGS"
fi
# get the value of $key from /etc/sysconfig/$servicename
args=$(grep $key %{dhcpconfdir}/sysconfig/${servicename} | sed -r "s/${key}=\"?([^\"]*)\"?/\1/")
# value is non-empty (i.e. user modified) and there isn't a service unit yet
if [ -n "${args}" -a ! -f %{dhcpconfdir}/systemd/system/${servicename}.service ]; then
# in $args replace / with \/ otherwise the next sed won't take it
args=$(echo $args | sed 's/\//\\\//'g)
# add $args to the end of ExecStart line
sed -r -e "s/(ExecStart=[^$]*)/\1 ${args}/" \
< %{_unitdir}/${servicename}.service \
> %{dhcpconfdir}/systemd/system/${servicename}.service
fi
fi
done
%files
%doc server/dhcpd.conf.example server/dhcpd6.conf.example
@ -555,6 +577,11 @@ fi
%changelog
* Thu Jan 17 2013 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.5-2
- during update convert DHC*ARGS from /etc/sysconfig/dhc*
to /etc/systemd/system/dhc*.service (#895475)
- 12-dhcpd NM dispatcher script now restarts also dhcpd6 service
* Thu Jan 10 2013 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.5-1
- 4.2.5