[Utnubu-discuss] dmraid initramfs integration patch

Phillip Susi psusi at cfl.rr.com
Thu Mar 23 00:59:13 UTC 2006


Heh, would help if I actually attached the debdiff.  I guess that's what 
happens when you fire off email with one eye open in the wee hours of 
the morning.

Phillip Susi wrote:
> I had created this a while ago and posted it to utnubu-discuss but it 
> seems nothing came of it.  I have noticed that a new version of the 
> dmraid package has since been uploaded by Filippo Giunchedi that has 
> some minor changes to generate a second binary udeb package.
> 
> Attached is the debdiff that I made earlier with the intent of it being 
> -3.  Please review and let me know what you think.  The gist of the 
> changes are this:
> 
> 1) Added the -udeb binary target, now superseded by the current -3
> 
> 2) Yanked the dmraid.init file to remove dmraid being called from system 
> init scripts
> 
> 3) Added dmraid.postinst to install mkinitramfs scripts to cause dmraid 
> to be built into the initramfs and run from there.  This allows booting 
> from a dmraid.
> 
> 4) Switched back to using the standard libc instead of klibc, since the 
> standard libc shared lib is in the initramfs anyhow.
> 
> 
> I've built this on ubuntu so I'm not sure it will work as well with 
> debian's mkinitramfs.  Also I've been trying to figure out how to 
> integrate with d-i but that is quite a struggle for me.  Maybe someone 
> can give me some pointers.  Comments?  Flames?
> 
> 
> Please CC me on all replies.

-------------- next part --------------
diff -u dmraid-0.9.9+1.0.0.rc9/debian/control dmraid-0.9.9+1.0.0.rc9/debian/control
--- dmraid-0.9.9+1.0.0.rc9/debian/control
+++ dmraid-0.9.9+1.0.0.rc9/debian/control
@@ -31,0 +32,22 @@
+
+Package: dmraid-udeb
+Architecture: any
+XC-Package-Type: udeb
+Description: Device-Mapper Software RAID support tool
+ dmraid discovers, activates, deactivates and displays properties
+ of software RAID sets (eg, ATARAID) and contained DOS partitions.
+ .
+ dmraid uses the Linux device-mapper to create devices with respective
+ mappings for the ATARAID sets discovered.
+ .
+ The following formats are supported: 
+  Highpoint HPT37X/HPT45X
+  Intel Software RAID
+  LSI Logic MegaRAID 
+  NVidia NForce RAID (nvraid)
+  Promise FastTrack 
+  Silicon Image(tm) Medley(tm)
+  VIA Software RAID 
+ .
+ Please read the documentation in /usr/share/doc/dmraid BEFORE attempting
+ any use of this software. Improper use can cause data loss!
reverted:
--- dmraid-0.9.9+1.0.0.rc9/debian/dmraid.init
+++ dmraid-0.9.9+1.0.0.rc9.orig/debian/dmraid.init
@@ -1,44 +0,0 @@
-#!/bin/bash
-
-# try to load module in case that hasn't been done yet
-modprobe dm-mod >/dev/null 2>&1
-
-set -e
-
-. /lib/lsb/init-functions
-. /etc/default/rcS
-
-[ -x /sbin/dmraid ] || exit 0
-
-case "$1" in
-	start|"")
-		log_begin_msg "Setting up DMRAID devices..."
-		if [ "$VERBOSE" != no ]; then
-	                /sbin/dmraid --activate yes --ignorelocking --verbose
-		else
-	                /sbin/dmraid --activate yes --ignorelocking >/dev/null 2>&1
-		fi
-		log_end_msg $?
-		;;
-
-	stop)
-		log_begin_msg "Shutting down DMRAID devices... "
-		if [ "$VERBOSE" != no ]; then
-			/sbin/dmraid --activate no --ignorelocking --verbose
-		else
-			/sbin/dmraid --activate no --ignorelocking >/dev/null 2>&1
-		fi
-		log_end_msg $?
-		;;
-
-	restart|force-reload)
-		$0 stop
-		sleep 1
-		$0 start
-		;;
-	
-	*)
-		log_success_msg "Usage: dmraid {start|stop|restart|force-reload}"
-		exit 1
-		;;
-esac
diff -u dmraid-0.9.9+1.0.0.rc9/debian/changelog dmraid-0.9.9+1.0.0.rc9/debian/changelog
--- dmraid-0.9.9+1.0.0.rc9/debian/changelog
+++ dmraid-0.9.9+1.0.0.rc9/debian/changelog
@@ -1,3 +1,10 @@
+dmraid (0.9.9+1.0.0.rc9-3) unstable; urgency=low
+
+  * Integrated with initramfs for boot time startup
+  * Switched back to normal libc instead of klibc
+
+ -- Phillip Susi <psusi at cfl.rr.com>  Sat, 14 Jan 2006 20:56:23 -0500
+
 dmraid (0.9.9+1.0.0.rc9-2) unstable; urgency=low
 
   * fix Description: to a more accurate one this closes: #334805 and correctly
diff -u dmraid-0.9.9+1.0.0.rc9/debian/rules dmraid-0.9.9+1.0.0.rc9/debian/rules
--- dmraid-0.9.9+1.0.0.rc9/debian/rules
+++ dmraid-0.9.9+1.0.0.rc9/debian/rules
@@ -33,20 +33,7 @@
 	dh_testdir
 
 	cd ${buildroot}/initramfs && \
-	./configure ${common-config-flags} --enable-klibc
-
-	# klibc doesn't use standard headers. we need to copy them?
-	mkdir -p ${buildroot}/initramfs/include/{bits,sys,gnu,rpc}
-	cp /usr/include/libdevmapper.h ${buildroot}/initramfs/include
-	cp /usr/include/byteswap.h ${buildroot}/initramfs/include
-	cp /usr/include/bits/byteswap.h ${buildroot}/initramfs/include/bits
-	cp /usr/include/netdb.h ${buildroot}/initramfs/include
-	cp /usr/include/bits/netdb.h ${buildroot}/initramfs/include/bits
-	cp /usr/include/rpc/netdb.h ${buildroot}/initramfs/include/rpc
-	cp /usr/include/features.h ${buildroot}/initramfs/include
-	cp /usr/include/bits/wordsize.h ${buildroot}/initramfs/include/bits
-	cp /usr/include/sys/cdefs.h ${buildroot}/initramfs/include/sys
-	cp /usr/include/gnu/stubs.h ${buildroot}/initramfs/include/gnu
+	./configure ${common-config-flags}
 
 	touch $@
 
@@ -69,19 +56,20 @@
 	dh_testroot
 	dh_clean -k
 
-	dh_installdirs
+	dh_installdirs usr/share/initramfs-tools/hooks usr/share/initramfs-tools/scripts/local-top
+	install -m 755 -o root -g root debian/hook.script debian/dmraid/usr/share/initramfs-tools/hooks/dmraid
+	install -m 755 -o root -g root debian/detect.script debian/dmraid/usr/share/initramfs-tools/scripts/local-top/dmraid
 
 	cd ${buildroot}/standard && make DESTDIR=../../../dmraid install && rm -rf debian/dmraid/lib
 
 	dh_link
 	dh_installdocs ${version}/{CREDITS,KNOWN_BUGS,README,TODO}
 	dh_installchangelogs ${version}/CHANGELOG
-
+	dh_install --autodest --sourcedir=debian/dmraid/
 
 binary-arch: install
 	dh_testdir
 	dh_testroot
-	dh_installinit -p dmraid -- start 03 S . start 51 0 6 .
 	dh_strip -a
 	dh_compress -a
 	dh_fixperms -a
only in patch2:
unchanged:
--- dmraid-0.9.9+1.0.0.rc9.orig/debian/dmraid.postinst
+++ dmraid-0.9.9+1.0.0.rc9/debian/dmraid.postinst
@@ -0,0 +1,41 @@
+#!/bin/sh -e
+# This script can be called in the following ways:
+#
+# After the package was installed:
+#	<postinst> configure <old-version>
+#
+#
+# If prerm fails during upgrade or fails on failed upgrade:
+#	<old-postinst> abort-upgrade <new-version>
+#
+# If prerm fails during deconfiguration of a package:
+#	<postinst> abort-deconfigure in-favour <new-package> <version>
+#		   removing <old-package> <version>
+#
+# If prerm fails during replacement due to conflict:
+#	<postinst> abort-remove in-favour <new-package> <version>
+
+
+# Update all initramfs 
+update_initramfs()
+{
+    update-initramfs -u
+}
+
+
+case "$1" in
+    configure)
+	update_initramfs
+	;;
+
+    abort-upgrade|abort-deconfigure|abort-remove)
+	;;
+
+    *)
+	echo "$0 called with unknown argument \`$1'" 1>&2
+	exit 1
+	;;
+esac
+
+#DEBHELPER#
+exit 0
only in patch2:
unchanged:
--- dmraid-0.9.9+1.0.0.rc9.orig/debian/dmraid-udeb.install
+++ dmraid-0.9.9+1.0.0.rc9/debian/dmraid-udeb.install
@@ -0,0 +1 @@
+sbin/dmraid
only in patch2:
unchanged:
--- dmraid-0.9.9+1.0.0.rc9.orig/debian/hook.script
+++ dmraid-0.9.9+1.0.0.rc9/debian/hook.script
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+PREREQ=""
+
+prereqs()
+{
+        echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+        prereqs
+        exit 0
+        ;;
+esac
+
+. /usr/share/initramfs-tools/hook-functions
+
+copy_exec /sbin/dmraid /sbin
+
+exit 0
only in patch2:
unchanged:
--- dmraid-0.9.9+1.0.0.rc9.orig/debian/detect.script
+++ dmraid-0.9.9+1.0.0.rc9/debian/detect.script
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+PREREQ=""
+
+prereqs()
+{
+        echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+        prereqs
+        exit 0
+        ;;
+esac
+
+modprobe -q dm-mod
+modprobe -q dm-mirror
+
+/sbin/dmraid -ay
only in patch2:
unchanged:
--- dmraid-0.9.9+1.0.0.rc9.orig/debian/dmraid.postrm
+++ dmraid-0.9.9+1.0.0.rc9/debian/dmraid.postrm
@@ -0,0 +1,53 @@
+#!/bin/sh -e
+# This script can be called in the following ways:
+#
+# After the package was removed:
+#	<postrm> remove
+#
+# After the package was purged:
+#	<postrm> purge
+#
+# After the package was upgraded:
+#	<old-postrm> upgrade <new-version>
+# if that fails:
+#	<new-postrm> failed-upgrade <old-version>
+#
+#
+# After all of the packages files have been replaced:
+#	<postrm> disappear <overwriting-package> <version>
+#
+#
+# If preinst fails during install:
+#	<new-postrm> abort-install
+#
+# If preinst fails during upgrade of removed package:
+#	<new-postrm> abort-install <old-version>
+#
+# If preinst fails during upgrade:
+#	<new-postrm> abort-upgrade <old-version>
+
+
+# Update all initramfs 
+update_initramfs()
+{
+    update-initramfs -u
+}
+
+
+case "$1" in
+    remove)
+	update_initramfs
+	;;
+
+    purge|upgrade|failed-upgrade|disappear|abort-install|abort-upgrade)
+	;;
+
+
+    *)
+	echo "$0 called with unknown argument \`$1'" 1>&2
+	exit 1
+	;;
+esac
+
+#DEBHELPER#
+exit 0
only in patch2:
unchanged:
--- dmraid-0.9.9+1.0.0.rc9.orig/debian/dmraid-udeb.postinst
+++ dmraid-0.9.9+1.0.0.rc9/debian/dmraid-udeb.postinst
@@ -0,0 +1,18 @@
+#!/bin/sh -e
+
+case "$1" in
+    configure)
+# detect the hardware
+	dmraid -ay
+	;;
+
+    abort-upgrade|abort-deconfigure|abort-remove)
+	;;
+
+    *)
+	echo "$0 called with unknown argument \`$1'" 1>&2
+	exit 1
+	;;
+esac
+
+exit 0
\ No newline at end of file


More information about the Utnubu-discuss mailing list