Package: thermald
Version: 1.1~rc2-7
Severity: wishlist
Tags: patch
Forwarded: https://github.com/01org/thermal_daemon/pull/20

Hi,
Thanks for packaging thermald in Debian.

I noticed that upstream thermald has a systemd unit, but your Debian
packaging does not. I've made some improvements to that systemd unit,
sent them upstream, and done a branch of the Debian package that
installs the systemd unit: see attached.

Patch 0003 is a matter of taste; please feel free to drop it if you
prefer hardening-wrapper, but I get the impression that using
dpkg-buildflags is the preferred approach these days.

If you have the thermald packaging in a git (or other VCS) repository
somewhere, please consider uploading it to Alioth. I've uploaded a
version imported from snapshot.debian.org with git-import-dscs to:

    ssh://git.debian.org/home/users/smcv/public_git/thermald.git

with gitweb at:

    http://anonscm.debian.org/gitweb/?p=users/smcv/thermald.git

That version also contains all of the attached patches.

Regards,
    S
>From a4159facfbafc7c2818855015a295baa31e8eb71 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Wed, 12 Feb 2014 10:20:20 +0000
Subject: [PATCH] Add a patch to install thermald to ${sbindir} without needing
 a workaround in debian/rules, and have the systemd service file use that path
 automatically

---
 debian/changelog                                   |  8 +++
 ...rmald-in-sbindir-and-point-systemd-servic.patch | 57 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 debian/rules                                       |  1 -
 4 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 debian/patches/0014-Install-thermald-in-sbindir-and-point-systemd-servic.patch

diff --git a/debian/changelog b/debian/changelog
index adcf065..b402217 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+thermald (1.1~rc2-7+smcv1) UNRELEASED; urgency=low
+
+  * Add a patch to install thermald to ${sbindir} without needing a
+    workaround in debian/rules, and have the systemd service file
+    use that path automatically
+
+ -- Simon McVittie <s...@debian.org>  Wed, 12 Feb 2014 10:16:15 +0000
+
 thermald (1.1~rc2-7) unstable; urgency=low
 
   * Redirect fd 0, 1, 2 to /dev/null to stop poll() spinning (Closes: #737093)
diff --git a/debian/patches/0014-Install-thermald-in-sbindir-and-point-systemd-servic.patch b/debian/patches/0014-Install-thermald-in-sbindir-and-point-systemd-servic.patch
new file mode 100644
index 0000000..f32ba19
--- /dev/null
+++ b/debian/patches/0014-Install-thermald-in-sbindir-and-point-systemd-servic.patch
@@ -0,0 +1,57 @@
+From 4592eac08fb8f1f9682a4f8e8cb00eb3a7bdfbcd Mon Sep 17 00:00:00 2001
+From: Simon McVittie <s...@debian.org>
+Date: Wed, 12 Feb 2014 10:18:30 +0000
+Subject: [PATCH] Install thermald in ${sbindir}, and point systemd service to
+ it
+
+Substituting @sbindir@ in thermald.service.in means that the systemd
+unit will work if compiled with a non-default --sbindir, or a
+non-/usr prefix.
+
+Distributions that don't distinguish between /usr/sbin and /usr/bin
+can configure with --sbindir=/usr/bin or similar.
+---
+ Makefile.am                                  | 2 +-
+ data/thermald.service.in                     | 2 +-
+ distribution_integration/thermal-daemon.spec | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 981972c..57a2057 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -23,7 +23,7 @@ EXTRA_DIST=Makefile.glib \
+ 	thermald.pc.in
+ 
+ # Programs to build
+-bin_PROGRAMS = thermald
++sbin_PROGRAMS = thermald
+ 
+ # Evaluate Table Application
+ thermald_CPPFLAGS = \
+diff --git a/data/thermald.service.in b/data/thermald.service.in
+index 6d01518..1d5a704 100644
+--- a/data/thermald.service.in
++++ b/data/thermald.service.in
+@@ -5,7 +5,7 @@ After=syslog.target
+ [Service]
+ Type=dbus
+ BusName=org.freedesktop.thermald
+-ExecStart=/usr/bin/thermald --no-daemon --dbus-enable
++ExecStart=@sbindir@/thermald --no-daemon --dbus-enable
+ StandardError=null
+ 
+ [Install]
+diff --git a/distribution_integration/thermal-daemon.spec b/distribution_integration/thermal-daemon.spec
+index d2b9f38..c9f905c 100644
+--- a/distribution_integration/thermal-daemon.spec
++++ b/distribution_integration/thermal-daemon.spec
+@@ -47,7 +47,7 @@ make %{?_smp_mflags}
+ %systemd_postun_with_restart thermald.service
+ 
+ %files
+-%{_bindir}/thermald
++%{_sbindir}/thermald
+ %config(noreplace) %{_sysconfdir}/dbus-1/system.d/org.freedesktop.thermald.conf
+ %{_datadir}/dbus-1/system-services/org.freedesktop.thermald.service
+ %config(noreplace) %{_sysconfdir}/thermald/thermal-conf.xml
diff --git a/debian/patches/series b/debian/patches/series
index 2bf2576..9453ff6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,3 +11,4 @@
 0011-pic-fixes.patch
 0012-Prevent-exception-for-invalid-sysfs-file-reads.patch
 0013-Redirect-stderr-stdout-and-stdin-to-dev-null-to-stop.patch
+0014-Install-thermald-in-sbindir-and-point-systemd-servic.patch
diff --git a/debian/rules b/debian/rules
index 021e826..25ff600 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,7 +2,6 @@
 
 override_dh_install:
 	dh_install
-	mv debian/thermald/usr/bin debian/thermald/usr/sbin
 
 %:
 	dh $@ --with autoreconf
>From 397929da1194e4c368a234071207f5347036b91c Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Wed, 12 Feb 2014 10:34:22 +0000
Subject: [PATCH] Install the systemd service file (Closes: #nnnnnn)

---
 debian/changelog | 1 +
 debian/rules     | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index b402217..b36f902 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ thermald (1.1~rc2-7+smcv1) UNRELEASED; urgency=low
   * Add a patch to install thermald to ${sbindir} without needing a
     workaround in debian/rules, and have the systemd service file
     use that path automatically
+  * Install the systemd service file (Closes: #nnnnnn)
 
  -- Simon McVittie <s...@debian.org>  Wed, 12 Feb 2014 10:16:15 +0000
 
diff --git a/debian/rules b/debian/rules
index 25ff600..b5bedfe 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,5 +1,10 @@
 #!/usr/bin/make -f
 
+# this path for systemdsystemunitdir is correct for Debian, and avoids
+# needing to build-depend on systemd for systemd.pc
+override_dh_auto_configure:
+	dh_auto_configure -- --with-systemdsystemunitdir=/lib/systemd/system
+
 override_dh_install:
 	dh_install
 
>From fa1e3b1056a13a121b14099c5dcaf0deea6848c4 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Wed, 12 Feb 2014 10:33:10 +0000
Subject: [PATCH] Activate hardening via DEB_BUILD_MAINT_OPTIONS instead of
 hardening-wrapper

---
 debian/changelog | 2 ++
 debian/control   | 2 +-
 debian/rules     | 3 +++
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index b36f902..c6e2ade 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ thermald (1.1~rc2-7+smcv1) UNRELEASED; urgency=low
     workaround in debian/rules, and have the systemd service file
     use that path automatically
   * Install the systemd service file (Closes: #nnnnnn)
+  * Activate hardening via DEB_BUILD_MAINT_OPTIONS instead of
+    hardening-wrapper
 
  -- Simon McVittie <s...@debian.org>  Wed, 12 Feb 2014 10:16:15 +0000
 
diff --git a/debian/control b/debian/control
index aa37d4f..6cb0891 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: admin
 Priority: optional
 Maintainer: Colin King <colin.k...@canonical.com>
 Standards-Version: 3.9.5
-Build-Depends: debhelper (>= 9), dh-autoreconf, quilt, autoconf, libglib2.0-dev, libdbus-1-dev, libdbus-glib-1-dev, libxml2-dev, hardening-wrapper
+Build-Depends: debhelper (>= 9), dh-autoreconf, quilt, autoconf, libglib2.0-dev, libdbus-1-dev, libdbus-glib-1-dev, libxml2-dev
 Homepage: https://github.com/01org/thermal_daemon
 
 Package: thermald
diff --git a/debian/rules b/debian/rules
index b5bedfe..585dd34 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,5 +1,8 @@
 #!/usr/bin/make -f
 
+export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+include /usr/share/dpkg/default.mk
+
 # this path for systemdsystemunitdir is correct for Debian, and avoids
 # needing to build-depend on systemd for systemd.pc
 override_dh_auto_configure:
>From 9c2467759905026a5d43176a6c48c648cffdb029 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Wed, 12 Feb 2014 10:40:35 +0000
Subject: [PATCH] Add patches to improve the systemd service

---
 debian/changelog                                   |  1 +
 ...service.in-do-not-depend-on-syslog.target.patch | 22 ++++++++++++++++++++
 ...hermald.service.in-do-not-suppress-stderr.patch | 24 ++++++++++++++++++++++
 debian/patches/series                              |  2 ++
 4 files changed, 49 insertions(+)
 create mode 100644 debian/patches/0015-thermald.service.in-do-not-depend-on-syslog.target.patch
 create mode 100644 debian/patches/0016-thermald.service.in-do-not-suppress-stderr.patch

diff --git a/debian/changelog b/debian/changelog
index c6e2ade..ad46713 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,7 @@ thermald (1.1~rc2-7+smcv1) UNRELEASED; urgency=low
   * Install the systemd service file (Closes: #nnnnnn)
   * Activate hardening via DEB_BUILD_MAINT_OPTIONS instead of
     hardening-wrapper
+  * Add patches to improve the systemd service
 
  -- Simon McVittie <s...@debian.org>  Wed, 12 Feb 2014 10:16:15 +0000
 
diff --git a/debian/patches/0015-thermald.service.in-do-not-depend-on-syslog.target.patch b/debian/patches/0015-thermald.service.in-do-not-depend-on-syslog.target.patch
new file mode 100644
index 0000000..51a178b
--- /dev/null
+++ b/debian/patches/0015-thermald.service.in-do-not-depend-on-syslog.target.patch
@@ -0,0 +1,22 @@
+From 6dd9ae1cb6c512fcff03e559371e55ed09a039ad Mon Sep 17 00:00:00 2001
+From: Simon McVittie <s...@debian.org>
+Date: Wed, 12 Feb 2014 10:36:57 +0000
+Subject: [PATCH] thermald.service.in: do not depend on syslog.target
+
+systemd uses socket activation for syslog.target, so it's unnecessary
+to depend on it.
+---
+ data/thermald.service.in | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/data/thermald.service.in b/data/thermald.service.in
+index 1d5a704..3667dde 100644
+--- a/data/thermald.service.in
++++ b/data/thermald.service.in
+@@ -1,6 +1,5 @@
+ [Unit]
+ Description=Thermal Daemon Service
+-After=syslog.target
+ 
+ [Service]
+ Type=dbus
diff --git a/debian/patches/0016-thermald.service.in-do-not-suppress-stderr.patch b/debian/patches/0016-thermald.service.in-do-not-suppress-stderr.patch
new file mode 100644
index 0000000..1f5f927
--- /dev/null
+++ b/debian/patches/0016-thermald.service.in-do-not-suppress-stderr.patch
@@ -0,0 +1,24 @@
+From 57403e1581464b738f0877599285c2ed553abf66 Mon Sep 17 00:00:00 2001
+From: Simon McVittie <s...@debian.org>
+Date: Wed, 12 Feb 2014 10:38:55 +0000
+Subject: [PATCH] thermald.service.in: do not suppress stderr
+
+Unless thermald's stderr is really spammy, it's better to capture
+all of its output so that any error/warning messages appear in
+the Journal.
+---
+ data/thermald.service.in | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/data/thermald.service.in b/data/thermald.service.in
+index 3667dde..253ac0d 100644
+--- a/data/thermald.service.in
++++ b/data/thermald.service.in
+@@ -5,7 +5,6 @@ Description=Thermal Daemon Service
+ Type=dbus
+ BusName=org.freedesktop.thermald
+ ExecStart=@sbindir@/thermald --no-daemon --dbus-enable
+-StandardError=null
+ 
+ [Install]
+ WantedBy=multi-user.target
diff --git a/debian/patches/series b/debian/patches/series
index 9453ff6..0c2afe9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -12,3 +12,5 @@
 0012-Prevent-exception-for-invalid-sysfs-file-reads.patch
 0013-Redirect-stderr-stdout-and-stdin-to-dev-null-to-stop.patch
 0014-Install-thermald-in-sbindir-and-point-systemd-servic.patch
+0015-thermald.service.in-do-not-depend-on-syslog.target.patch
+0016-thermald.service.in-do-not-suppress-stderr.patch
>From 04cce451f90947ab30f44e0bc347046559cc8ca7 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Wed, 12 Feb 2014 10:49:20 +0000
Subject: [PATCH] Use dh-systemd to sync up enabledness status between sysvinit
 and systemd

---
 debian/changelog | 1 +
 debian/control   | 2 +-
 debian/rules     | 3 +--
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index ad46713..c6de4e0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,7 @@ thermald (1.1~rc2-7+smcv1) UNRELEASED; urgency=low
   * Activate hardening via DEB_BUILD_MAINT_OPTIONS instead of
     hardening-wrapper
   * Add patches to improve the systemd service
+  * Use dh-systemd to sync up enabledness status between sysvinit and systemd
 
  -- Simon McVittie <s...@debian.org>  Wed, 12 Feb 2014 10:16:15 +0000
 
diff --git a/debian/control b/debian/control
index 6cb0891..8fa1fe3 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: admin
 Priority: optional
 Maintainer: Colin King <colin.k...@canonical.com>
 Standards-Version: 3.9.5
-Build-Depends: debhelper (>= 9), dh-autoreconf, quilt, autoconf, libglib2.0-dev, libdbus-1-dev, libdbus-glib-1-dev, libxml2-dev
+Build-Depends: debhelper (>= 9), dh-autoreconf, quilt, autoconf, libglib2.0-dev, libdbus-1-dev, libdbus-glib-1-dev, libxml2-dev, dh-systemd (>= 1.5)
 Homepage: https://github.com/01org/thermal_daemon
 
 Package: thermald
diff --git a/debian/rules b/debian/rules
index 585dd34..c546a02 100755
--- a/debian/rules
+++ b/debian/rules
@@ -12,5 +12,4 @@ override_dh_install:
 	dh_install
 
 %:
-	dh $@ --with autoreconf
-
+	dh $@ --with autoreconf,systemd

Reply via email to