[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#251114: mt-st: [PATCH] integrate stinit with udev



Package: mt-st
Version: 0.8-2
Tags: patch
Followup-For: Bug #251114

Thinking about this some more I think udev rules are the way forward as then the device is (re-)initiallised if the scsi layer is made to 
rescan for devices etc. 

Attached is a patch to that effect.

Alex Owen

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-1-686
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages mt-st depends on:
ii  libc6                         2.3.6-15   GNU C Library: Shared libraries

mt-st recommends no packages.

-- no debconf information
diff -urN mt-st-0.8.orig/debian/mt-st.init mt-st-0.8/debian/mt-st.init
--- mt-st-0.8.orig/debian/mt-st.init	2006-07-14 12:08:06.000000000 +0100
+++ mt-st-0.8/debian/mt-st.init	2006-07-14 12:11:44.000000000 +0100
@@ -24,7 +24,13 @@
 	fi
 	;;
     modload|reload|restart|force-reload)
-        stinit || exit $?
+	# If we have an optional arg pass on to stinit
+        if test -n "$2" 
+        then
+            stinit "$2" || $?
+        else
+            stinit || $?
+        fi
         ;;
     stop)
 	;;
diff -urN mt-st-0.8.orig/debian/mt-st.postinst mt-st-0.8/debian/mt-st.postinst
--- mt-st-0.8.orig/debian/mt-st.postinst	2006-07-14 12:08:06.000000000 +0100
+++ mt-st-0.8/debian/mt-st.postinst	2006-07-14 12:39:03.000000000 +0100
@@ -8,6 +8,7 @@
 	/usr/share/man/man1/mt.1.gz mt.1.gz /usr/share/man/man1/mt-st.1.gz
     update-rc.d mt-st start 30 S . > /dev/null
     command -v update-modules >/dev/null 2>&1 && update-modules
+    ln -s ../mt-st.rules /etc/udev/rules.d/z60_mt-st.rules
 
   	if which invoke-rc.d >/dev/null 2>&1; then
    		invoke-rc.d mt-st reload 
diff -urN mt-st-0.8.orig/debian/mt-st.postrm mt-st-0.8/debian/mt-st.postrm
--- mt-st-0.8.orig/debian/mt-st.postrm	2006-07-14 12:08:06.000000000 +0100
+++ mt-st-0.8/debian/mt-st.postrm	2006-07-14 12:40:07.000000000 +0100
@@ -6,4 +6,7 @@
 then
     update-rc.d mt-st remove >/dev/null
     command -v update-modules >/dev/null 2>&1 && update-modules
+    [ -L /etc/udev/rules.d/z60_mt-st.rules ] && \
+        rm /etc/udev/rules.d/z60_mt-st.rules
 fi
+
diff -urN mt-st-0.8.orig/debian/mt-st.udev mt-st-0.8/debian/mt-st.udev
--- mt-st-0.8.orig/debian/mt-st.udev	1970-01-01 01:00:00.000000000 +0100
+++ mt-st-0.8/debian/mt-st.udev	2006-07-14 12:14:34.000000000 +0100
@@ -0,0 +1,4 @@
+#Use stinit to set default parameters on st device creation
+KERNEL=="st[0-9]",       RUN+="/etc/init.d/mt-st modload %n"
+KERNEL=="st[0-9]*[0-9]", RUN+="/etc/init.d/mt-st modload %n"
+
diff -urN mt-st-0.8.orig/debian/rules mt-st-0.8/debian/rules
--- mt-st-0.8.orig/debian/rules	2006-07-14 12:08:06.000000000 +0100
+++ mt-st-0.8/debian/rules	2006-07-14 12:40:22.000000000 +0100
@@ -69,6 +69,7 @@
 	dh_installexamples stinit.def.examples
 	dh_installinit -n
 	dh_installmodules -n
+	dh_installudev -n
 	dh_installchangelogs
 	dh_link
 	dh_strip

Reply to: