Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to create a Debian package that doesn't delete an empty directory after it's purged. Specifically, I'm creating my own package containing some CA certificates I trust.

I'm following Debian's suggested method of installing the certificates to /usr/local/share/ca-certificates. The problem I'm running in to is that the ca-certificates package creates /usr/local/share/ca-certificates when it's installed and I'd like that directory to stick around when my package is purged.

My goal is to install my trust chain into /usr/local/share/ca-certificates/mychain but when my Debian package is removed I want dpkg to not remove /usr/local/share/ca-certificates if it's empty since the ca-certificates package explicitly created that directory.

I searched around for a definitive answer but all I managed to find were long forum posts and e-mail threads.

share|improve this question

1 Answer 1

Install to a different local path and write a postinst script to create the directory in /usr/local and copy the files there.

As you can imagine, this probably violates both the letter and the spirit of the Debian policy. But it's your network, your rules, your users (and their easily discoverable workarounds).

For better usability, you could mark these files as conffiles so that at least they will be removed if you purge the package, but stay if you merely uninstall it.

Bottom line, files dpkg doesn't know about, it cannot remove.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.