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

Re: Policy, updmap --enable and updmap.cfg in /etc or /var



Hi Florent,

Florent Rougon <f.rougon@free.fr> wrote:

> I'll simply attach
> the lmodern maintainer scripts with the comments removed (and one
> placeholder explained) so that you can get an idea of the simplicity (or
> complexity), of the process (there are many comments, so they make the
> files much bigger than they really are). Of course, if you want more
> info on the code, you have the versions with all the comments in your
> /var/lib/dpkg/info or in the Debian archive.

I had a look at this. You write in the comment of preinst:

# Unfortunately, we are in preinst, so the package is not unpacked
# yet, so we cannot simply copy $REF_CONFIG_FILE to
# $TEMP_CONFIG_FILE. And I cannot do that in postinst because it
# seems there is no way in postinst to know whether the previous
# state was "purged" (not simply "removed").

I do not see why it is necessary to know that. Why not do something like
the following in postinst:

    if [ ! -f $CONFIG_FILE ]; then
      # the config file does not exist (i.e. not simply an upgrade). 
      if [ -f $TEMP_CONFIG_FILE ]; then
	# an old version was in state rc, and the config file is wanted
	if [ ! -f $NO_CONFIG_FILE ]; then
	  mv "$TEMP_CONFIG_FILE" "$CONFIG_FILE"
	else
	  echo >&2 <<EOF
Error: 
...
EOF
	fi
      elif [ -f $NO_CONFIG_FILE ]; then
	# an old version is present, but the local admin does not want the file
	:
      else
	# no old version present
	cp $REF_CONFIG_FILE $CONFIG_FILE
      fi
    fi
    rm -f $NO_CONFIG_FILE

Even if the preinst script is generated anyway (as I'm currently testing
for tetex-3.0), I would prefer to copy the file from
/usr/share/$package.

Regards, Frank
-- 
Frank Küster
Inst. f. Biochemie der Univ. Zürich
Debian Developer



Reply to: