Feedback

type to search

dpkg -P removes /opt

Asked by

Hello All,
My deb file installs to /opt/blah/blah, when I purge the package with dpkg -P blah everything is removed - even /opt (if mine is the only package with files in /opt) - How can I avoid removing the /opt folder during a purge?

I have tried checking if /opt exist in the postrm and adding it if it doesn't but no joy...It seems that the folder is deleted after the postrm script is run. Currently I am adding a hidden file in /opt with postinst - this stops opt from being removed but feels hackey - there should be a better way.

Thank you, 


or Cancel

2 answers

0

helmut [ Editor ]

So the base-files package creates /opt during installation, but it does not “own” the directory. Once removed by a user or some package, it is gone. See /usr/share/doc/base-files/README for the reasoning.

Thanks to #debian-mentors for pointing me in the right direction.

or Cancel

Your answer

You need to join Debian to complete this action, click here to do so.