Amend last commit.

This commit is contained in:
Jiri Popelka 2013-01-17 18:30:30 +01:00
parent dd39224418
commit de40db7e76

View File

@ -493,22 +493,22 @@ fi
%triggerun -- dhcp < 12:4.2.4-14.P1 %triggerun -- dhcp < 12:4.2.4-14.P1
# convert DHC*ARGS from /etc/sysconfig/dhc* to /etc/systemd/system/dhc*.service # convert DHC*ARGS from /etc/sysconfig/dhc* to /etc/systemd/system/dhc*.service
for servicename in dhcpd dhcpd6 dhcrelay; do for servicename in dhcpd dhcpd6 dhcrelay; do
if [ -f %{dhcpconfdir}/sysconfig/${servicename} ]; then if [ -f %{_sysconfdir}/sysconfig/${servicename} ]; then
if [ "${servicename}" == "dhcrelay" ]; then if [ "${servicename}" == "dhcrelay" ]; then
key="DHCRELAYARGS" key="DHCRELAYARGS"
else else
key="DHCPDARGS" key="DHCPDARGS"
fi fi
# get the value of $key from /etc/sysconfig/$servicename # get the value of $key from /etc/sysconfig/$servicename
args=$(grep $key %{dhcpconfdir}/sysconfig/${servicename} | sed -r "s/${key}=\"?([^\"]*)\"?/\1/") args=$(grep "^${key}" %{_sysconfdir}/sysconfig/${servicename} | sed -r "s/${key}=\"?([^\"]*)\"?/\1/")
# value is non-empty (i.e. user modified) and there isn't a service unit yet # 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 if [ -n "${args}" -a ! -f %{_sysconfdir}/systemd/system/${servicename}.service ]; then
# in $args replace / with \/ otherwise the next sed won't take it # in $args replace / with \/ otherwise the next sed won't take it
args=$(echo $args | sed 's/\//\\\//'g) args=$(echo $args | sed 's/\//\\\//'g)
# add $args to the end of ExecStart line # add $args to the end of ExecStart line
sed -r -e "s/(ExecStart=[^$]*)/\1 ${args}/" \ sed -r -e "s/(ExecStart=[^$]*)/\1 ${args}/" \
< %{_unitdir}/${servicename}.service \ < %{_unitdir}/${servicename}.service \
> %{dhcpconfdir}/systemd/system/${servicename}.service > %{_sysconfdir}/systemd/system/${servicename}.service
fi fi
fi fi
done done