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

Re: Removing self-managed configuration files?



Marc Haber <mh+debian-mentors@zugschlus.de> wrote:

> The file is under ucf control (I omitted that to lessen complexity),

Hey! We are doctors. You have to tell us _everything_. :-)

> 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
}

HTH.

-- 
Florent



Reply to: