问题
I built and installed a debian package from the following folder structure:
- myprog
- DEBIAN
- control
- usr
- local
- bin
- myprog.sh
- bin
- local
- DEBIAN
... using the following commands:
dpkg -b myprog/ myprog.deb && dpkg -i myprog.deb
When i now remove the package by typing:
dpkg -r myprog
.. I got the following warning:
dpkg: warning: while removing myprog, directory '/usr/local' not empty so not removed.
As I think this is an every day scenario, how can I avoid the warning?
Greets Thorsten!
# Edit
I tried to install the file to /bin instead of /usr/local/bin and got no warning when removing it. Seems so, that the /usr/local/.. folder will not treated as a system folder (?) by dpkg.
回答1:
That's right -- packages should never touch /usr/local
directory, it's reserved for system administrators by Filesystem Hierarchy Standard and is their zone of responsibility.
回答2:
To avoid the warning, according to this post, is to create a "core-custom"/dummy package, which will install in /opt, and be required by your main package.
So, when you'll uninstall your main package, at least your dummy package will be left in /opt and dpkg will not issue the warning.
You can also use that dummy package as a meta-package to install all the regular packages you like.
来源:https://stackoverflow.com/questions/3704354/dpkg-warning-while-removing-directory-usr-local-not-empty-so-not-removed