]> git.pld-linux.org Git - packages/dhcp_probe.git/commitdiff
- full blown systemd support with per-interface service generator
authorJan Rękorajski <baggins@pld-linux.org>
Sat, 21 Apr 2012 11:38:39 +0000 (11:38 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    dhcp_probe-service-generator -> 1.2
    dhcp_probe.spec -> 1.4
    dhcp_probe.sysconfig -> 1.3
    dhcp_probe@.service -> 1.3

dhcp_probe-service-generator
dhcp_probe.spec
dhcp_probe.sysconfig
dhcp_probe@.service

index dd4fef57a39083fc54d06dc12760428c16dfff6c..d2ab2465a9f25686681add96e2c74182b96c562d 100644 (file)
@@ -1,10 +1,18 @@
 #!/bin/sh
 
+destunitdir=${1:-/tmp}
+
 [ -f /etc/sysconfig/dhcp_probe ] && . /etc/sysconfig/dhcp_probe
 
+if [ -d $destunitdir/dhcp_probe.target.wants ]; then
+       rm -f $destunitdir/dhcp_probe.target.wants/dhcp_probe@*.service
+else
+       mkdir -p $destunitdir/dhcp_probe.target.wants
+fi
+
 for nic in $INTERFACES; do
-       [ -d /run/systemd/generator/multi-user.target.wants ] || \
-               mkdir -p /run/systemd/generator/multi-user.target.wants
+       [ -L $destunitdir/dhcp_probe.target.wants/dhcp_probe@$nic.service ] && \
+               continue
        ln -s /lib/systemd/system/dhcp_probe@.service \
-               /run/systemd/generator/multi-user.target.wants/dhcp_probe@$nic.service
+               $destunitdir/dhcp_probe.target.wants/dhcp_probe@$nic.service
 done
index a49c9d48a0a33156a51582aa5b0e3316e3688f95..a949142273d7dc74912dfd4aed29a5854e030f0b 100644 (file)
@@ -1,7 +1,7 @@
 Summary:       Tool for discovering DHCP and BootP servers
 Name:          dhcp_probe
 Version:       1.3.0
-Release:       0.3
+Release:       0.6
 License:       GPLv2+ and MIT
 Group:         Applications
 Source0:       http://www.net.princeton.edu/software/dhcp_probe/%{name}-%{version}.tar.gz
@@ -50,7 +50,8 @@ export CFLAGS="%{rpmcflags} -D__ARCH__=32"
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{systemdunitdir}}
+install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{systemdunitdir}} \
+       $RPM_BUILD_ROOT/lib/systemd/system-generators
 
 %{__make} install \
        DESTDIR=$RPM_BUILD_ROOT
@@ -60,7 +61,7 @@ install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcp_probe
 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/dhcp_probe
 install -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/dhcp_probe@.service
 ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/dhcp_probe.service
-install -p %{SOURCE4} $RPM_BUILD_ROOT/lib/systemd/generators/dhcp_probe-service-generator
+install -p %{SOURCE4} $RPM_BUILD_ROOT/lib/systemd/system-generators/dhcp_probe-service-generator
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -88,7 +89,7 @@ fi
 %attr(755,root,root) %{_sbindir}/dhcp_probe
 %attr(754,root,root) /etc/rc.d/init.d/dhcp_probe
 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dhcp_probe
-%attr(755,root,root) /lib/systemd/generators/dhcp_probe-service-generator
+%attr(755,root,root) /lib/systemd/system-generators/dhcp_probe-service-generator
 %{systemdunitdir}/%{name}.service
 %{systemdunitdir}/%{name}@.service
 %{_mandir}/man5/dhcp_probe.cf.5*
index bf192e818f2431eb69b4b9009d1b57a28e1725d9..1bcf722055d31d909a0cad71fc5ee9dbb8e9dfdd 100644 (file)
@@ -2,4 +2,11 @@
 #DHCP_PROBE_OPTIONS=
 
 # Space separated list of interfaces to listen on.
-#INTERFACES="eth0 eth1"
+#
+# On systems running systemd after updating the list below you have to
+# restart systemd to regenerate dhcp_probe@DEV.service services
+# (systemctl --system daemon-reload), stop and start dhcp_probe.target when
+# removing elements from list or restart dhcp_probe.target when only adding
+# elements (systemctl stop dhcp_probe.target / systemctl restart dhcp_probe.target).
+#
+INTERFACES="eth0"
index ed92984b74d3e64d714777db764cf9e1422fd8c4..739ecbefbb62a9939d80fe82b363f0e98a7d71c1 100644 (file)
@@ -1,10 +1,14 @@
 [Unit]
-Description=Start dhcp_probe on %I
-After=network.target
-Wants=network.target
+Description=dhcp_probe on %I
+Requires=dhcp_probe.target
+After=dhcp_probe.target
+PropagateReloadFrom=dhcp_probe.target
 
 [Service]
 Type=forking
 EnvironmentFile=-/etc/sysconfig/dhcp_probe
 PIDFile=/var/run/dhcp_probe.%I.pid
 ExecStart=/usr/sbin/dhcp_probe $DHCP_PROBE_OPTIONS -p /var/run/dhcp_probe.%I.pid %I
+
+[Install]
+WantedBy=dhcp_probe.target
This page took 0.103964 seconds and 4 git commands to generate.