[hddtemp] Patch to allow binding to a listen address that doesn't exist yet.

Ville Skyttä scop at fedoraproject.org
Fri Jan 10 07:06:18 UTC 2014


commit b7c1f5f81046f4c487e4f363dc127878b169c6f0
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Fri Jan 10 09:05:42 2014 +0200

    Patch to allow binding to a listen address that doesn't exist yet.
    
    - Use systemd macros in scriptlets (#850145).

 ...ng-to-a-listen-address-that-doesn-t-exist.patch |   26 +++++++++++++++++++
 hddtemp.spec                                       |   27 +++++++++++---------
 2 files changed, 41 insertions(+), 12 deletions(-)
---
diff --git a/0001-Allow-binding-to-a-listen-address-that-doesn-t-exist.patch b/0001-Allow-binding-to-a-listen-address-that-doesn-t-exist.patch
new file mode 100644
index 0000000..0aeb35a
--- /dev/null
+++ b/0001-Allow-binding-to-a-listen-address-that-doesn-t-exist.patch
@@ -0,0 +1,26 @@
+From e677018004a41a1895a44fca88a6ff2323093064 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta at iki.fi>
+Date: Fri, 10 Jan 2014 00:21:07 +0200
+Subject: [PATCH] Allow binding to a listen address that doesn't exist yet
+
+---
+ src/daemon.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/daemon.c b/src/daemon.c
+index 3e211f2..ee836e5 100644
+--- a/src/daemon.c
++++ b/src/daemon.c
+@@ -98,6 +98,9 @@ void daemon_open_sockets(void)
+     /* Allow local port reuse in TIME_WAIT */
+     setsockopt(sks_serv[sks_serv_num], SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+ 
++    /* Allow binding to a listen address that doesn't exist yet */
++    setsockopt(sks_serv[sks_serv_num], SOL_IP, IP_FREEBIND, &on, sizeof(on));
++
+     /* Now we've got a socket - we need to bind it. */
+     if (bind(sks_serv[sks_serv_num], resp->ai_addr, resp->ai_addrlen) < 0) {
+       /* Nope, try another */
+-- 
+1.8.3.1
+
diff --git a/hddtemp.spec b/hddtemp.spec
index 5ddd3cf..bb247db 100644
--- a/hddtemp.spec
+++ b/hddtemp.spec
@@ -3,7 +3,7 @@
 
 Name:           hddtemp
 Version:        0.3
-Release:        0.27.%{beta}%{?dist}
+Release:        0.28.%{beta}%{?dist}
 Summary:        Hard disk temperature tool
 
 License:        GPLv2+
@@ -19,12 +19,14 @@ Patch1:         http://ftp.debian.org/debian/pool/main/h/hddtemp/hddtemp_0.3-bet
 # https://bugzilla.redhat.com/show_bug.cgi?id=717479
 # https://bugzilla.redhat.com/show_bug.cgi?id=710055
 Patch2:         %{name}-0.3-beta15-autodetect-717479.patch
+Patch3:         0001-Allow-binding-to-a-listen-address-that-doesn-t-exist.patch
 
 BuildRequires:  gettext
-BuildRequires:  systemd-units
-Requires(post): systemd-units
-Requires(preun): systemd-units
-Requires(postun): systemd-units
+# systemd >= 186 for scriptlet macros
+BuildRequires:  systemd >= 186
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
 Requires:       %{_bindir}/consolehelper
 
 %description
@@ -38,6 +40,7 @@ cp -p %{SOURCE1} ./hddtemp.db
 %patch0 -p0
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 sed -i -e 's|/etc/hddtemp.db|/usr/share/misc/hddtemp.db|' doc/hddtemp.8
 chmod -x contribs/analyze/*
 rm COPYING ; cp -p GPL-2 COPYING
@@ -64,17 +67,13 @@ install -Dpm 644 %{SOURCE5} \
 
 
 %post
-[ $1 -eq 1 ] && systemctl daemon-reload &>/dev/null || :
+%systemd_post hddtemp.service
 
 %preun
-if [ $1 -eq 0 ] ; then
-    systemctl --no-reload disable hddtemp.service &>/dev/null
-    systemctl stop hddtemp.service &>/dev/null || :
-fi
+%systemd_preun hddtemp.service
 
 %postun
-systemctl daemon-reload &>/dev/null
-[ $1 -gt 0 ] && systemctl try-restart hddtemp.service &>/dev/null || :
+%systemd_postun_with_restart hddtemp.service
 
 
 %files -f %{name}.lang
@@ -90,6 +89,10 @@ systemctl daemon-reload &>/dev/null
 
 
 %changelog
+* Thu Jan  9 2014 Ville Skyttä <ville.skytta at iki.fi> - 0.3-0.28.beta15
+- Patch to allow binding to a listen address that doesn't exist yet.
+- Use systemd macros in scriptlets (#850145).
+
 * Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.3-0.27.beta15
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 


More information about the scm-commits mailing list