On Sat, 2005-07-23 at 11:18 -0400, Greg KH wrote:
> On Sat, Jul 23, 2005 at 10:53:15AM -0400, Alec Warner wrote:
> > Georgi Georgiev wrote:
> > > Just to make sure I am not missing something.
> > > 
> > > Does this cover the
> > > 
> > > - If you are upgrading from a version of udev prior to 046 ...
> > > - If you are upgrading from a version of udev prior to 050 ...
> > > - If you are upgrading from a version of udev prior to 057 ...
> > > - If you are upgrading from a version of udev prior to 059 ...
> > > 
> > > cases automatically? I.e. *not* showing irrelevant warnings on every
> > > upgrade/rebuild.
> > > 
> > 
> > The writer of pkg_warn() could do this, it's still in the ebuild and
> > could use the normal ebuild functions to determine what the user is
> > running ( has_version() and whatnot ) and then run a case statement on that.
> 
> Great, anyone care to send me a patch for the udev ebuild to do this so
> not everyone sees this message?  It will only get longer over time...
> 

Something like this maybe?  (Yes, I know using $T will be frowned upon,
but not much else you can do.  Also, might use has_version(), but that
is more difficult to parse, and I figured you normally only want those
for system udev ...)


-- 
Martin Schlemmer

Index: udev-063.ebuild
===================================================================
RCS file: /var/cvsroot/gentoo-x86/sys-fs/udev/udev-063.ebuild,v
retrieving revision 1.2
diff -u -r1.2 udev-063.ebuild
--- udev-063.ebuild	17 Jul 2005 06:10:06 -0000	1.2
+++ udev-063.ebuild	25 Jul 2005 07:46:59 -0000
@@ -135,6 +135,15 @@
 }
 
 pkg_preinst() {
+	local udev_version=$(udev -V 2>/dev/null)
+
+	if [ -n "${udev_version}" ]
+	then
+		# Strip leading '0'
+		udev_version=${udev_version##0}
+		echo "${udev_version}" > "${T}/udev_version"
+	fi
+	
 	if [ -f "${ROOT}/etc/udev/udev.config" -a \
 	     ! -f "${ROOT}/etc/udev/udev.rules" ]
 	then
@@ -155,6 +164,8 @@
 }
 
 pkg_postinst() {
+	local udev_version=0
+	
 	if [ "${ROOT}" = "/" -a -n "`pidof udevd`" ]
 	then
 		killall -15 udevd &>/dev/null
@@ -162,33 +173,48 @@
 		killall -9 udevd &>/dev/null
 	fi
 
+	[ -f "${T}/udev_version" ] && udev_version=$(< "${T}/udev_version")
+	
 	# people want reminders, I'll give them reminders.  Odds are they will
 	# just ignore them anyway...
-	ewarn "Note: If you are upgrading from a version of udev prior to 046"
-	ewarn "      and you rely on the output of udevinfo for anything, please"
-	ewarn "      either run 'udevstart' now, or reboot, in order to get a"
-	ewarn "      up-to-date udev database."
-	ewarn
-	ewarn "Note: If you are upgrading from a version of udev prior to 050"
-	ewarn "      and you had written some custom permissions rules, please"
-	ewarn "      realize that the permission rules are now part of the main"
-	ewarn "      udev rules files and are not stand-alone anymore.  This means"
-	ewarn "      you need to rewrite them."
-	ewarn
-	ewarn "Note: If you are upgrading from a version of udev prior to 057"
-	ewarn "      and you have written custom rules, and rely on the etc/dev.d/"
-	ewarn "      functionality, please read the RELEASE-NOTES file for details"
-	ewarn "      on what has changed with this feature, and how to change your"
-	ewarn "      rules to work properly."
-	ewarn
-	ewarn "Note: If you are upgrading from a version of udev prior to 059"
-	ewarn "      and you have written custom rules, and rely on the etc/dev.d/"
-	ewarn "      functionality, or the etc/hotplug.d functionality, or just"
-	ewarn "      want to write some very cool and power udev rules, please "
-	ewarn "      read the RELEASE-NOTES file for details on what has changed"
-	ewarn "      with this feature, and how to change your rules to work properly."
+	if [ "${udev_version}" -lt 46 ]
+	then
+		ewarn "Note: If you are upgrading from a version of udev prior to 046"
+		ewarn "      and you rely on the output of udevinfo for anything, please"
+		ewarn "      either run 'udevstart' now, or reboot, in order to get a"
+		ewarn "      up-to-date udev database."
+		echo
+	fi
+	if [ "${udev_version}" -lt 50 ]
+	then
+		ewarn "Note: If you are upgrading from a version of udev prior to 050"
+		ewarn "      and you had written some custom permissions rules, please"
+		ewarn "      realize that the permission rules are now part of the main"
+		ewarn "      udev rules files and are not stand-alone anymore.  This means"
+		ewarn "      you need to rewrite them."
+		echo
+	fi
+	if [ "${udev_version}" -lt 57 ]
+	then
+		ewarn "Note: If you are upgrading from a version of udev prior to 057"
+		ewarn "      and you have written custom rules, and rely on the etc/dev.d/"
+		ewarn "      functionality, please read the RELEASE-NOTES file for details"
+		ewarn "      on what has changed with this feature, and how to change your"
+		ewarn "      rules to work properly."
+		echo
+	fi
+	if [ "${udev_version}" -lt 59 ]
+	then
+		ewarn "Note: If you are upgrading from a version of udev prior to 059"
+		ewarn "      and you have written custom rules, and rely on the etc/dev.d/"
+		ewarn "      functionality, or the etc/hotplug.d functionality, or just"
+		ewarn "      want to write some very cool and power udev rules, please "
+		ewarn "      read the RELEASE-NOTES file for details on what has changed"
+		ewarn "      with this feature, and how to change your rules to work properly."
+		echo
+	fi
 
-	einfo
+	echo
 	einfo "For more information on udev on Gentoo, writing udev rules, and"
 	einfo "         fixing known issues visit:"
 	einfo "         http://www.gentoo.org/doc/en/udev-guide.xml";

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to