Source: hdparm
Version: 9.65+ds-1
Severity: normal
Tags: patch moreinfo
User: [email protected]
Usertags: dep17m2

Dear Maintainer,

your package installs files into /sbin and /lib.  These files need
to be moved to paths below /usr as part of Debian's usr-merge effort
[1].

Attached you will find a patch to implement this (unconditionally).
The same patch can be found here as a salsa merge request:
  https://salsa.debian.org/debian/hdparm/-/merge_requests/5
  (draft status, see below)

Important notes:

1. Backports to bookworm or earlier must revert this change.

2. The change should not happen in unstable at this time (see
   Helmut's mail on debian-devel). Once it can happen, I will remove
   the "moreinfo" tag and ping the bug, and mark the merge request
   as "ready".

3. Per the wiki, it is advisable to upload to experimental first, and
   wait a few days for the dumat tool to check your package. The same
   is advisable when any structural changes are done in the trixie
   cycle.

4. The udev rule is installed using dh_installudev, and that
   currently continues to install into /lib. Once dh_installudev is
   changed, a binNMU, or a new upload, whatever comes first, will
   correct hdparm too.


Thank you for considering,
Chris

[1] https://wiki.debian.org/UsrMerge
>From 105f7e84be1256263e2d81826aff7814bacfd9c8 Mon Sep 17 00:00:00 2001
From: Chris Hofstaedtler <[email protected]>
Date: Fri, 8 Dec 2023 12:55:36 +0100
Subject: [PATCH] Move all files below /usr

Stop installing directly into /lib and /sbin, and patch all scripts and
config files to refer to the respective paths below /usr.

idectl, ultrabay are not updated as they are not installed.
wiper.sh is also left untouched, as its only installed into
/usr/share/doc.

Backports to bookworm or earlier MUST revert this change.

Gbp-Dch: full
---
 debian/95hdparm-apm                            |  2 +-
 debian/README.Debian                           |  2 +-
 debian/hdparm-udeb.install                     |  2 +-
 debian/hdparm.conf                             |  6 +++---
 debian/hdparm.conf.5                           |  2 +-
 debian/hdparm.install                          |  8 ++++----
 debian/hdparm.udev                             |  2 +-
 debian/patches/Makefile-install-into-usr.patch | 13 +++++++++++++
 debian/patches/series                          |  1 +
 debian/udev-scripts/hdparm                     |  4 ++--
 10 files changed, 28 insertions(+), 14 deletions(-)
 create mode 100644 debian/patches/Makefile-install-into-usr.patch

diff --git a/debian/95hdparm-apm b/debian/95hdparm-apm
index 59767af..e87e4f1 100755
--- a/debian/95hdparm-apm
+++ b/debian/95hdparm-apm
@@ -29,7 +29,7 @@ if [ -e /usr/sbin/laptop_mode ] ; then
     fi
 fi
 
-. /lib/hdparm/hdparm-functions
+. /usr/lib/hdparm/hdparm-functions
 
 resume_hdparm_apm()
 {
diff --git a/debian/README.Debian b/debian/README.Debian
index da7be72..a39fe85 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -13,7 +13,7 @@ No config (/etc/hdparm.conf doesn't list any drives):
 
 If disk config is present in /etc/hdparm.conf:
   * disk supports APM
-    - on boot, udev will call /lib/udev/hdparm, which in turn will call
+    - on boot, udev will call /usr/lib/udev/hdparm, which in turn will call
       /usr/lib/pm-utils/power.d/95hdparm-apm for apm options and hdparm
       for other options.
     - on power, /usr/lib/pm-utils/power.d/95hdparm-apm
diff --git a/debian/hdparm-udeb.install b/debian/hdparm-udeb.install
index 7afb31a..cd2849c 100644
--- a/debian/hdparm-udeb.install
+++ b/debian/hdparm-udeb.install
@@ -1 +1 @@
-debian/tmp/sbin/hdparm
+debian/tmp/usr/sbin/hdparm
diff --git a/debian/hdparm.conf b/debian/hdparm.conf
index 3c8023c..8f97ff6 100644
--- a/debian/hdparm.conf
+++ b/debian/hdparm.conf
@@ -5,7 +5,7 @@
 ## ignored, so you can space control fields as you like.  ANYTHING ELSE
 ## IS PARSED!!  This means that lines with stray characters or lines that
 ## use non # comment characters will be interpreted by the helper scripts (
-## /lib/udev/hdparm, /usr/lib/pm-utils/power.d/95hdparm-apm ).
+## /usr/lib/udev/hdparm, /usr/lib/pm-utils/power.d/95hdparm-apm ).
 ## This has probably minor, but potentially serious, side effects for your
 ## hard drives, so please follow the guidelines.  Patches to improve
 ## flexibilty welcome.  Please read /usr/share/doc/hdparm/README.Debian for
@@ -19,13 +19,13 @@
 ##
 ## If an option is listed twice, the second instance replaces the first.
 ##
-## /sbin/hdparm parses blocks of the form:
+## /usr/sbin/hdparm parses blocks of the form:
 ##      DEV {
 ##         option
 ##         option
 ##         ...
 ##      }
-## This blocks will cause /sbin/hdparm OPTIONS DEV to be run.
+## This blocks will cause /usr/sbin/hdparm OPTIONS DEV to be run.
 ## Where OPTIONS is the concatenation of all options previously defined
 ## outside of a block and all options defined with in the block.
 
diff --git a/debian/hdparm.conf.5 b/debian/hdparm.conf.5
index 08a25bc..c459208 100644
--- a/debian/hdparm.conf.5
+++ b/debian/hdparm.conf.5
@@ -18,7 +18,7 @@ Still one can re-apply settings from the config file by calling either
 .LP
 or by calling
 .LP
-.B DEVNAME=/dev/<disk> /lib/udev/hdparm
+.B DEVNAME=/dev/<disk> /usr/lib/udev/hdparm
 .LP
 Note that an in\-line comment is not supported.  If a line
 consists of whitespace only (tabs, spaces, carriage return), it will be
diff --git a/debian/hdparm.install b/debian/hdparm.install
index 604bc57..8402b29 100644
--- a/debian/hdparm.install
+++ b/debian/hdparm.install
@@ -1,9 +1,9 @@
 debian/hdparm.conf	etc/
-debian/hdparm-functions lib/hdparm/
+debian/hdparm-functions usr/lib/hdparm/
 debian/95hdparm-apm	usr/lib/pm-utils/power.d/
-debian/tmp/sbin/hdparm
-debian/udev-scripts/hdparm	lib/udev/
-debian/systemd-sleep/hdparm	lib/systemd/system-sleep/
+debian/tmp/usr/sbin/hdparm
+debian/udev-scripts/hdparm	usr/lib/udev/
+debian/systemd-sleep/hdparm	usr/lib/systemd/system-sleep/
 
 wiper/wiper.sh		usr/share/doc/hdparm/wiper
 wiper/README.txt	usr/share/doc/hdparm/wiper
diff --git a/debian/hdparm.udev b/debian/hdparm.udev
index 3a86f7e..be29faa 100644
--- a/debian/hdparm.udev
+++ b/debian/hdparm.udev
@@ -1,2 +1,2 @@
-ACTION=="add", SUBSYSTEM=="block", KERNEL=="[sh]d[a-z]", RUN+="/lib/udev/hdparm"
+ACTION=="add", SUBSYSTEM=="block", KERNEL=="[sh]d[a-z]", RUN+="/usr/lib/udev/hdparm"
 
diff --git a/debian/patches/Makefile-install-into-usr.patch b/debian/patches/Makefile-install-into-usr.patch
new file mode 100644
index 0000000..ed99c99
--- /dev/null
+++ b/debian/patches/Makefile-install-into-usr.patch
@@ -0,0 +1,13 @@
+Index: hdparm/Makefile
+===================================================================
+--- hdparm.orig/Makefile
++++ hdparm/Makefile
+@@ -3,7 +3,7 @@
+ # DESTDIR is for non root installs (eg packages, NFS) only!
+ DESTDIR =
+ 
+-binprefix = 
++binprefix = /usr
+ manprefix = /usr
+ exec_prefix = $(binprefix)/
+ sbindir = $(exec_prefix)sbin
diff --git a/debian/patches/series b/debian/patches/series
index 5c06375..1374885 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 0001-Fix-faults-in-Makefile.patch
 makefile.patch
 hdparm.8.patch
+Makefile-install-into-usr.patch
diff --git a/debian/udev-scripts/hdparm b/debian/udev-scripts/hdparm
index 5262bc1..d5c8d7e 100755
--- a/debian/udev-scripts/hdparm
+++ b/debian/udev-scripts/hdparm
@@ -4,7 +4,7 @@ set -e
 
 [ -n "$DEVNAME" ] || exit 1
 
-. /lib/hdparm/hdparm-functions
+. /usr/lib/hdparm/hdparm-functions
 
 if [ -e /proc/cmdline ]; then #linux only - future proofing against BSD and Hurd :)
         if grep -wq nohdparm /proc/cmdline ; then
@@ -43,7 +43,7 @@ if [ -n "$OPTIONS" ]; then
         # apm options are handled by /usr/lib/pm-utils/power.d/95hdparm-apm
         OPTIONS=$(echo $OPTIONS | perl -pe 's/((-S|-B|force_spindown_time)[\d]{1,3})|(-q\s?)//g')
         if [ -n "$OPTIONS" ]; then
-                /sbin/hdparm -q $OPTIONS $DEVNAME 2>/dev/null
+                /usr/sbin/hdparm -q $OPTIONS $DEVNAME 2>/dev/null
         fi
 fi
 
-- 
2.39.2

Reply via email to