SystemD unit files don't use Environment files any more (#850558)

NetworkManager dispatcher script doesn't use DHCPDARGS any more
This commit is contained in:
Tomas Hozza 2012-08-24 13:49:51 +02:00
parent 95a6f13614
commit c0272c7d8a
5 changed files with 8 additions and 51 deletions

View File

@ -1,31 +1,11 @@
#!/bin/bash #!/bin/bash
export LC_ALL=C export LC_ALL=C
[ -f /etc/sysconfig/dhcpd ] && . /etc/sysconfig/dhcpd
# restart dhcpd whenever $1 interface is brought up by NM (rhbz #565921) # restart dhcpd whenever $1 interface is brought up by NM (rhbz #565921)
if [ "$2" = "up" ]; then if [ "$2" = "up" ]; then
# exit if the service is not configured to be started in the current runlevel # exit if the service is not configured to be started in the current runlevel
/bin/systemctl is-enabled dhcpd.service || exit 0 /bin/systemctl is-enabled dhcpd.service || exit 0
ifaces="" # interfaces defined in DHCPDARGS
net=$(ls /sys/class/net) # all interfaces on system
if [ -n "${DHCPDARGS}" ]; then
for iface in ${net}; do
for arg in ${DHCPDARGS}; do
[ $arg == $iface ] && ifaces="$ifaces $iface"
done
done
fi
# exit if dhcpd is not defined to listen on $1
# i.e. if there are interfaces defined in DHCPDARGS and $1 is not among them
if [ -n "${ifaces}" ] &&
[[ "${ifaces}" != *$1* ]]; then
exit 0
fi
# restart service # restart service
/bin/systemctl restart dhcpd.service || : /bin/systemctl restart dhcpd.service || :
fi fi

View File

@ -18,7 +18,7 @@
Summary: Dynamic host configuration protocol software Summary: Dynamic host configuration protocol software
Name: dhcp Name: dhcp
Version: 4.2.4 Version: 4.2.4
Release: 13.%{patchver}%{?dist} Release: 14.%{patchver}%{?dist}
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
# dcantrell maintaining the package) made incorrect use of the epoch and # 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. # that's why it is at 12 now. It should have never been used, but it was.
@ -418,27 +418,6 @@ touch %{buildroot}%{_localstatedir}/lib/dhcpd/dhcpd.leases
touch %{buildroot}%{_localstatedir}/lib/dhcpd/dhcpd6.leases touch %{buildroot}%{_localstatedir}/lib/dhcpd/dhcpd6.leases
%{__mkdir} -p %{buildroot}%{_localstatedir}/lib/dhclient/ %{__mkdir} -p %{buildroot}%{_localstatedir}/lib/dhclient/
# Create default sysconfig files for dhcpd and dhcrelay
%{__mkdir} -p %{buildroot}%{_sysconfdir}/sysconfig
%{__cat} << EOF > %{buildroot}%{_sysconfdir}/sysconfig/dhcrelay
# Command line options here
#Example: DHCRELAYARGS="-4 -i eth0 192.168.0.1"
#Example: DHCRELAYARGS="-6 -l eth1 -u eth0"
DHCRELAYARGS=""
# Note: We don't use INTERFACES and DHCPSERVERS anymore (they were DHCPv4 only)
EOF
%{__cat} <<EOF > %{buildroot}%{_sysconfdir}/sysconfig/dhcpd
# Command line options here
DHCPDARGS=""
EOF
%{__cat} <<EOF > %{buildroot}%{_sysconfdir}/sysconfig/dhcpd6
# Command line options here
DHCPDARGS=""
EOF
# Copy sample conf files into position (called by doc macro) # Copy sample conf files into position (called by doc macro)
%{__cp} -p client/dhclient.conf dhclient.conf.sample %{__cp} -p client/dhclient.conf dhclient.conf.sample
%{__cp} -p server/dhcpd.conf dhcpd.conf.sample %{__cp} -p server/dhcpd.conf dhcpd.conf.sample
@ -523,9 +502,6 @@ fi
%attr(0755,dhcpd,dhcpd) %dir %{_localstatedir}/lib/dhcpd %attr(0755,dhcpd,dhcpd) %dir %{_localstatedir}/lib/dhcpd
%attr(0644,dhcpd,dhcpd) %verify(mode) %config(noreplace) %{_localstatedir}/lib/dhcpd/dhcpd.leases %attr(0644,dhcpd,dhcpd) %verify(mode) %config(noreplace) %{_localstatedir}/lib/dhcpd/dhcpd.leases
%attr(0644,dhcpd,dhcpd) %verify(mode) %config(noreplace) %{_localstatedir}/lib/dhcpd/dhcpd6.leases %attr(0644,dhcpd,dhcpd) %verify(mode) %config(noreplace) %{_localstatedir}/lib/dhcpd/dhcpd6.leases
%config(noreplace) %{_sysconfdir}/sysconfig/dhcpd
%config(noreplace) %{_sysconfdir}/sysconfig/dhcpd6
%config(noreplace) %{_sysconfdir}/sysconfig/dhcrelay
%config(noreplace) %{dhcpconfdir}/dhcpd.conf %config(noreplace) %{dhcpconfdir}/dhcpd.conf
%config(noreplace) %{dhcpconfdir}/dhcpd6.conf %config(noreplace) %{dhcpconfdir}/dhcpd6.conf
%config(noreplace) %{_sysconfdir}/openldap/schema/dhcp.schema %config(noreplace) %{_sysconfdir}/openldap/schema/dhcp.schema
@ -583,6 +559,10 @@ fi
%changelog %changelog
* Fri Aug 24 2012 Tomas Hozza <thozza@redhat.com> - 12:4.2.4-14.P1
- SystemD unit files don't use Environment files any more (#850558)
- NetworkManager dispatcher script doesn't use DHCPDARGS any more
* Wed Aug 22 2012 Tomas Hozza <thozza@redhat.com> - 12:4.2.4-13.P1 * Wed Aug 22 2012 Tomas Hozza <thozza@redhat.com> - 12:4.2.4-13.P1
- fixed SPEC file so it comply with new systemd-rpm macros guidelines (#850089) - fixed SPEC file so it comply with new systemd-rpm macros guidelines (#850089)

View File

@ -4,8 +4,7 @@ Documentation=man:dhcpd(8) man:dhcpd.conf(5)
After=network.target After=network.target
[Service] [Service]
EnvironmentFile=/etc/sysconfig/dhcpd ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid
ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid $DHCPDARGS
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -4,8 +4,7 @@ Documentation=man:dhcpd(8) man:dhcpd.conf(5)
After=network.target After=network.target
[Service] [Service]
EnvironmentFile=/etc/sysconfig/dhcpd6 ExecStart=/usr/sbin/dhcpd -f -6 -cf /etc/dhcp/dhcpd6.conf -user dhcpd -group dhcpd --no-pid
ExecStart=/usr/sbin/dhcpd -f -6 -cf /etc/dhcp/dhcpd6.conf -user dhcpd -group dhcpd --no-pid $DHCPDARGS
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -4,8 +4,7 @@ Documentation=man:dhcrelay(8)
After=network.target After=network.target
[Service] [Service]
EnvironmentFile=/etc/sysconfig/dhcrelay ExecStart=/usr/sbin/dhcrelay -d --no-pid
ExecStart=/usr/sbin/dhcrelay -d --no-pid $DHCRELAYARGS
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target