0

I'm creating a package for an application that installs a lot of assets when it first runs. It's looking like they'll have to live in /var/lib/<myapp>, which is fine. However, because these files aren't part of the original package, dpkg/apt doesn't know to delete them when it's removed. Is there some way to automate this?

I have seen it suggested that I put rm -rf /var/lib/<myapp> in the postrm script, but this doesn't seem to play nicely when I install the package over itself (it removes the directory when I don't want it to). Surely there's a built-in way to handle this, in the deb format?

3
  • 1
    If they were installed using dpkg or apt-get, then `sudo apt-get autoremove' should remove any auto-installed packages that are no longer used
    – ravery
    Jul 25, 2017 at 14:19
  • Perhaps this rm -rf /var/lib/<myapp>/* will work better. The dir remains. Or let the deb package know about them so it can remove them Jul 25, 2017 at 15:27
  • How can I let it know about files that aren't in the package?
    – Migwell
    Jul 26, 2017 at 5:44

0

You must log in to answer this question.

Browse other questions tagged .