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

Re: How to move a conffile to a new location?




>Previously Eloy A. Paris wrote:
>> My question is: how should I handle this situation? Obviously, I want
>> that the install scripts handle the situation in a way that the
>> /etc/conffile gets moved to /etc/package/conffile.
>>=20
>> Anyone one has faced this situation before?

I need to do this in one of my packages, too.


Wichert Akkerman replied:
>Multiple times actually :). What you have to do is *carefully* move the
>conffile in the preinst.

What kind of care is required?

The nearest thing to an example I found on my system was this from
ncurses-term.preinst:

  set -e
  # /usr/lib/terminfo used to be the standard place for terminfo
  # entries.  Now, it's /usr/share/terminfo.  So if /usr/lib/terminfo
  # _isn't_ a symbolic link, move the whole thing to /usr/share.
  if [ -e /usr/lib/terminfo -a ! -L /usr/lib/terminfo ]; then
    cp -dR /usr/lib/terminfo /usr/share;
    rm -rf /usr/lib/terminfo;
  fi


I see these points:
 - check that the original file exists, and is the right type of file
 - if cp fails, die before deleting the old file
 - idempotent, of course (so running the script twice does no harm)

Anything else to watch for?

Should "prerm failed-upgrade" move the file back?

			      - Jim Van Zandt


Reply to: