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?

  • 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 '17 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 – George Udosen Jul 25 '17 at 15:27
  • How can I let it know about files that aren't in the package? – Miguel Jul 26 '17 at 5:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.