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

Re: /etc/udev/rules.d non-symlinks



Marco d'Itri wrote:
> It's OK, I planned to discuss this after the release.
> Experience showed that generally other packages do not need an easy way
> to disable their whole rules files, so I think we can conclude that
> usage of symlinks can be restricted to some of udev's own files and
> eventually packages with special needs.
> Do we need special code to move the conffiles on upgrades (and only do
> that if the symlink does not exist)?

Code such as the following is needed to deal with moving the conffile
and replacing the symlink with the conffile:

preinst:

if [ "$1" = install ] || [ "$1" = upgrade ]; then
	if [ -e /etc/udev/#FILE# ]; then
		if [ "`md5sum \"/etc/udev/#FILE#\" | sed -e \"s/ .*//\"`" = \
		     "`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' /etc/udev/#FILE#'{s/.* //;p}}\" /var/lib/dpkg/status`" ]
		then
			rm -f /etc/udev/#FILE#
		fi
	fi
	if [ -L /etc/udev/rules.d/#PRIO##FILE# ]; then
		rm -f /etc/udev/rules.d/#PRIO##FILE#
	fi
fi

postinst:

if [ "$1" = configure ]; then
	if [ -e /etc/udev/#FILE# ]; then
		echo "Preserving user changes to /etc/udev/rules.d/#PRIO##FILE# ..."
		if [ -e /etc/udev/rules.d/#PRIO##FILE# ]; then
			mv -f /etc/udev/rules.d/#PRIO##FILE# /etc/udev/rules.d/#PRIO##FILE#.dpkg-new
		fi
		mv -f /etc/udev/#FILE# /etc/udev/rules.d/#PRIO##FILE#
	fi
fi

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature


Reply to: