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

How to properly drop an obsolete directory from a package



Hello Debian mentors,
I have a simple (or maybe not so simple) question I have not been able
to find documentation about.

I am the maintainer of the apt-listbugs package.
In some remote past (before year 2008), the program used to download
some indices which were stored in /var/cache/apt-listbugs/

Now those indices are no longer needed and there is some code to clean
them up in the postinst script:

        # remove obsolete index files
        for OLDFILE in /var/cache/apt-listbugs/*indices*
        do
            if test -f "$OLDFILE"
            then
                echo -n "Removing obsolete $OLDFILE ... "
                rm -f "$OLDFILE"
                echo "done"
            fi
        done

This cleanup code has been in place since 2009.
Hence I think that, at this point, no index file has probably survived
on any user's system.
But some user could have placed some other extraneous file
into /var/cache/apt-listbugs/
If this extraneous file does not include the string "indices" in its
name, it could have survived...


Now, I realized that this directory (/var/cache/apt-listbugs/) is still
created at package install time, since it is listed in the debian/dirs
file: 

  $ grep cache debian/dirs 
  var/cache/apt-listbugs/

but is currently useless (and has probably been so for a long time!).

I would like to drop this directory from the next version of
apt-listbugs.
How can I get rid of it?

Is dropping it from the debian/dirs file enough?

Will dpkg gracefully handle an upgrade for a user who has extraneous
files in /var/cache/apt-listbugs/ ?
Will it issue a warning saying "directory not empty, so not removed"?
Is this the Right Thing™ to do, when dealing with this kind of
situations?

Please take into account that the postrm script, when called with the
"purge" argument, removes the directory, along with all its content,
with the following command:

        rm -rf /var/cache/apt-listbugs/

Should this be kept in the postrm script?

Or should it be moved to the postinst script, to replace the
above-mentioned index cleanup code?


Could you please clarify?
Thanks for your time and patience!


P.S.: Please Cc me on replies, as I am not subscribed to
      debian-mentors. Thanks!

-- 
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

Attachment: pgpiIdc1CWzT7.pgp
Description: PGP signature


Reply to: