Re: Removing self-managed configuration files?
On Sat, Jan 20, 2007 at 07:03:24PM +0100, Florent Rougon wrote:
> Marc Haber <mh+debian-mentors@zugschlus.de> wrote:
> > but ucf does not know about the file any more if it is not in the new
> > package and will therefore not handle it.
>
> Uh, if you don't 'ucf --purge' it, I fear it will remain in the ucf
> cache. There is code doing what you want in tetex-bin (not written by
> me). For instance, in debian/common.functions.in, you can find:
>
> ucf_md5sum(){
> file=$1
> md5sum=$(grep "$file$" /var/lib/ucf/hashfile | cut -f 1 -d ' ')
> if [ -z "$md5sum" ]; then
> get_sarge_md5sum_from_list $file
> fi
> echo $md5sum
> }
>
> [...]
>
> preinst_remove_or_move_ucf(){
> file=/etc/texmf/$1
> newname=$(get_newfilename $1)
> debug $file
> test -f "$file" || return 0
> debug "handled\n"
> oldmd5sum=$(ucf_md5sum $file)
> currmd5sum=$(md5sum $file | cut -d ' ' -f 1)
> if [ "$oldmd5sum" != "$currmd5sum" ]; then
> mv $file $oldstuff_dir/$(basename $file).$PREINST_MOVE_EXT
> else
> rm $file
> if [ -x /usr/bin/ucf ]; then ucf --purge $file; fi
> fi
> }
These are 23 lines of code which have the potential for a lot of bugs.
I do not think it is a good idea to cut&paste this code into a hundred
packages.
Greetings
Marc
--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature | How to make an American Quilt | Fax: *49 621 72739835
Reply to: