Package: src:sg3-utils
Version: 1.39-1
Tags: patch

Hi Ritesh,

This patch creates the binary package sg3-utils-udev, which installs
the upstream udev rules in the initramfs, so SCSI_IDENT_* properties
are defined for multipath-tools/-boot to correctly whitelist sd devs.

May you please consider it for an upload to jessie?

Thanks!



Details:
-------

Package and installed/initramfs files:

        # dpkg-deb -c sg3-utils-udev_1.39-1udevrules1_all.deb
        drwxr-xr-x root/root         0 2015-04-13 04:32 ./
        drwxr-xr-x root/root         0 2015-04-13 04:31 ./usr/
        drwxr-xr-x root/root         0 2015-04-13 04:31 ./usr/share/
drwxr-xr-x root/root 0 2015-04-13 04:31 ./usr/share/initramfs-tools/ drwxr-xr-x root/root 0 2015-04-13 04:31 ./usr/share/initramfs-tools/hooks/ -rwxr-xr-x root/root 485 2015-04-13 04:31 ./usr/share/initramfs-tools/hooks/sg3-utils
        drwxr-xr-x root/root         0 2015-04-13 04:31 ./usr/share/doc/
drwxr-xr-x root/root 0 2015-04-13 04:31 ./usr/share/doc/sg3-utils-udev/ -rw-r--r-- root/root 3907 2015-04-13 04:19 ./usr/share/doc/sg3-utils-udev/changelog.Debian.gz -rw-r--r-- root/root 2804 2014-04-03 12:07 ./usr/share/doc/sg3-utils-udev/copyright -rw-r--r-- root/root 21142 2014-06-12 19:05 ./usr/share/doc/sg3-utils-udev/changelog.gz
        drwxr-xr-x root/root         0 2015-04-13 04:31 ./lib/
        drwxr-xr-x root/root         0 2015-04-13 04:31 ./lib/udev/
        drwxr-xr-x root/root         0 2015-04-13 04:31 ./lib/udev/rules.d/
-rw-r--r-- root/root 1878 2015-04-13 04:31 ./lib/udev/rules.d/58-scsi-sg3_symlink.rules -rw-r--r-- root/root 2468 2015-04-13 04:31 ./lib/udev/rules.d/55-scsi-sg3_id.rules

        # dpkg -i 
{sg3-utils-udev,sg3-utils,libsgutils2-2}_1.39-1udevrules1_*.deb
        ...
        Setting up sg3-utils-udev (1.39-1udevrules1) ...
        update-initramfs: deferring update (trigger activated)
        ...
        Processing triggers for initramfs-tools (0.119) ...
        update-initramfs: Generating /boot/initrd.img-3.19.0-trunk-powerpc64le
        ...

        # gzip -dc /boot/initrd.img | cpio -t | grep sg
        118989 blocks
        bin/dmesg
        usr/bin/sg_inq
        usr/lib/libsgutils2.so.2
        lib/modules/3.19.0-trunk-powerpc64le/kernel/drivers/scsi/sg.ko
        lib/udev/rules.d/58-scsi-sg3_symlink.rules
        lib/udev/rules.d/55-scsi-sg3_id.rules

        # ls -l /lib/udev/rules.d/*scsi-sg3*.rules
-rw-r--r-- 1 root root 2468 Apr 12 19:50 /lib/udev/rules.d/55-scsi-sg3_id.rules -rw-r--r-- 1 root root 1878 Apr 12 19:50 /lib/udev/rules.d/58-scsi-sg3_symlink.rules


After reboot (i.e., udev changes active), the SCSI/SCSI_IDENT properties are defined:

        # udevadm info -q property /dev/sda
DEVLINKS=/dev/disk/by-id/scsi-0IBM_IPR-0_5EC99A00_0 /dev/disk/by-id/scsi-1IBM_IPR-0_5EC99A0000000430 /dev/disk/by-path/pci-0001:08:00.0-scsi-0:2:3:0
        DEVNAME=/dev/sda
        
DEVPATH=/devices/pci0001:00/0001:00:00.0/0001:01:00.0/0001:02:08.0/0001:08:00.0/host0/target0:2:3/0:2:3:0/block/sda
        DEVTYPE=disk
        ID_BUS=scsi
        ID_MODEL=IPR-0_5EC99A00
        ID_MODEL_ENC=IPR-0\x20\x20\x205EC99A00
        ID_PATH=pci-0001:08:00.0-scsi-0:2:3:0
        ID_PATH_TAG=pci-0001_08_00_0-scsi-0_2_3_0
        ID_SCSI=1
        ID_SERIAL=1IBM_IPR-0_5EC99A0000000430
        ID_SERIAL_SHORT=IBM_IPR-0_5EC99A0000000430
        ID_TYPE=disk
        ID_VENDOR=IBM
        ID_VENDOR_ENC=IBM\x20\x20\x20\x20\x20
        MAJOR=8
        MINOR=0
        SCSI_IDENT_LUN_T10=IBM_IPR-0_5EC99A0000000430
        SCSI_IDENT_LUN_VENDOR=0
        SCSI_IDENT_PORT_RELATIVE=53722
        SCSI_IDENT_PORT_TARGET_PORT_GROUP=0xd1da
        SCSI_MODEL=IPR-0_5EC99A00
        SCSI_MODEL_ENC=IPR-0\x20\x20\x205EC99A00
        SCSI_TPGS=1
        SCSI_TYPE=disk
        SCSI_VENDOR=IBM
        SCSI_VENDOR_ENC=IBM\x20\x20\x20\x20\x20
        SUBSYSTEM=block
        USEC_INITIALIZED=94634646


--
Mauricio Faria de Oliveira
IBM Linux Technology Center
diff -Nru sg3-utils-1.39/debian/changelog sg3-utils-1.39/debian/changelog
--- sg3-utils-1.39/debian/changelog     2014-09-29 05:01:40.000000000 -0300
+++ sg3-utils-1.39/debian/changelog     2015-04-12 19:49:18.000000000 -0300
@@ -1,3 +1,14 @@
+sg3-utils (1.39-1udevrules1) UNRELEASED; urgency=medium
+
+  * sg3-utils-udev (new binary package):  provide the udev rules for SCSI-ID
+    mappings and symlinks at boot time for multipath-tools:
+    - debian/control: add sg3-utils-udev
+    - debian/rules: build it with override_dh_{install,clean}
+    - debian/initramfs/hooks: add_udev_rules() and copy_exec() 'sg_inq' to 
initramfs
+    - debian/sg3-utils-udev.post{inst,rm}: call update-initramfs
+
+ -- Mauricio Faria de Oliveira <mauri...@linux.vnet.ibm.com>  Sun, 12 Apr 2015 
19:22:02 -0300
+
 sg3-utils (1.39-1) unstable; urgency=medium
 
   * [a3a22b2] Imported Upstream version 1.39
diff -Nru sg3-utils-1.39/debian/control sg3-utils-1.39/debian/control
--- sg3-utils-1.39/debian/control       2014-04-03 03:37:10.000000000 -0300
+++ sg3-utils-1.39/debian/control       2015-04-12 19:21:27.000000000 -0300
@@ -62,3 +62,18 @@
  Developer files (i.e. headers and a static library) which are associated with
  the utilities in the sg3-utils package.
 
+Package: sg3-utils-udev
+Architecture: all
+Depends: sg3-utils, initramfs-tools
+Description: utilities for devices using the SCSI command set (udev rules)
+ Most OSes have SCSI pass-through interfaces that enable user space programs
+ to send SCSI commands to a device and fetch the response. With SCSI to ATA
+ Translation (SAT) many ATA disks now can process SCSI commands. Typically
+ each utility in this package implements one SCSI command. See the draft
+ standards at www.t10.org for SCSI command definitions plus SAT. ATA
+ commands are defined in the draft standards at www.t13.org . For a mapping
+ between supported SCSI and ATA commands and utility names in this package
+ see the COVERAGE file.
+ .
+ udev rules which are associated with the utilities in the sg3-utils package.
+
diff -Nru sg3-utils-1.39/debian/initramfs/hooks 
sg3-utils-1.39/debian/initramfs/hooks
--- sg3-utils-1.39/debian/initramfs/hooks       1969-12-31 21:00:00.000000000 
-0300
+++ sg3-utils-1.39/debian/initramfs/hooks       2015-04-12 19:21:27.000000000 
-0300
@@ -0,0 +1,33 @@
+#!/bin/sh
+# (based on multipath-tools-boot)
+
+PREREQS="udev"
+
+prereqs() { echo "$PREREQS"; }
+
+case $1 in
+prereqs)
+       prereqs
+       exit 0
+       ;;
+esac
+
+if [ ! -x /usr/bin/sg_inq ]; then
+       exit 0
+fi
+
+. /usr/share/initramfs-tools/hook-functions
+
+add_udev_rules()
+{
+  for rules in 55-scsi-sg3_id.rules 58-scsi-sg3_symlink.rules; do
+    if [ -e /lib/udev/rules.d/$rules ]; then
+      cp -p /lib/udev/rules.d/$rules $DESTDIR/lib/udev/rules.d/
+    fi
+  done
+}
+
+copy_exec /usr/bin/sg_inq /usr/bin
+
+add_udev_rules
+
diff -Nru sg3-utils-1.39/debian/rules sg3-utils-1.39/debian/rules
--- sg3-utils-1.39/debian/rules 2014-04-03 03:37:10.000000000 -0300
+++ sg3-utils-1.39/debian/rules 2015-04-12 19:21:27.000000000 -0300
@@ -16,10 +16,32 @@
 DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
 PKG_VERS=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p')
 
+INITRAMFS=$(CURDIR)/debian/sg3-utils-udev/usr/share/initramfs-tools/
+
 get-orig-source:
        uscan --force-download --rename --repack --download-version=$(PKG_VERS) 
--destdir=.
 
 %:
        dh "$@" --with autoreconf
 
+override_dh_install:
+       dh_testdir
+       dh_install
+
+       [ ! -f scripts/55-scsi-sg3_id.rules ] || cp 
scripts/55-scsi-sg3_id.rules debian/sg3-utils-udev.scsi-sg3_id.udev
+       [ ! -f scripts/58-scsi-sg3_symlink.rules ] || cp 
scripts/58-scsi-sg3_symlink.rules debian/sg3-utils-udev.scsi-sg3_symlink.udev
+
+       dh_installudev -psg3-utils-udev --priority=55 --name=scsi-sg3_id 
+       dh_installudev -psg3-utils-udev --priority=58 --name=scsi-sg3_symlink 
+
+       install -D -m 755 debian/initramfs/hooks $(INITRAMFS)/hooks/sg3-utils
+
+override_dh_clean:
+       dh_testdir
+
+       rm -f debian/sg3-utils-udev.scsi-sg3_id.udev
+       rm -f debian/sg3-utils-udev.scsi-sg3_symlink.udev
+
+       dh_clean
+
 .PHONY: get-orig-source
diff -Nru sg3-utils-1.39/debian/sg3-utils-udev.postinst 
sg3-utils-1.39/debian/sg3-utils-udev.postinst
--- sg3-utils-1.39/debian/sg3-utils-udev.postinst       1969-12-31 
21:00:00.000000000 -0300
+++ sg3-utils-1.39/debian/sg3-utils-udev.postinst       2015-04-12 
19:21:27.000000000 -0300
@@ -0,0 +1,35 @@
+#!/bin/sh
+# postinst script for sg3-utils-udev
+# (based on multipath-tools-boot)
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# Source debconf library.
+. /usr/share/debconf/confmodule
+
+case "$1" in
+    configure)
+       if [ -x /usr/sbin/update-initramfs -a -e 
/etc/initramfs-tools/initramfs.conf ]; then
+               update-initramfs -u
+       fi
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff -Nru sg3-utils-1.39/debian/sg3-utils-udev.postrm 
sg3-utils-1.39/debian/sg3-utils-udev.postrm
--- sg3-utils-1.39/debian/sg3-utils-udev.postrm 1969-12-31 21:00:00.000000000 
-0300
+++ sg3-utils-1.39/debian/sg3-utils-udev.postrm 2015-04-12 19:21:27.000000000 
-0300
@@ -0,0 +1,46 @@
+#!/bin/sh
+# postrm script for sg3-utils-udev
+# (based on multipath-tools-boot)
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <overwriter>
+#          <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    remove)
+       if [ -x /usr/sbin/update-initramfs -a -e 
/etc/initramfs-tools/initramfs.conf ]; then
+               update-initramfs -u
+       fi
+    ;;
+
+    purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+

Reply via email to