我的deb文件安装到/ opt / myCompany / myProgram,当我使用dpkg -P myProgram清除软件包时,所有内容都被删除-甚至/ opt(如果我的软件包是唯一包含/ opt中文件的软件包)-如何避免
My deb file installs to /opt/myCompany/myProgram, when I purge the package with dpkg -P myProgram 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?
我尝试检查/ opt是否存在于postrm中,如果不存在则添加它,但没有乐趣...在运行postrm脚本后,似乎删除了该文件夹。目前,我正在使用/ postinst在/ opt中添加一个隐藏文件-这将阻止opt的删除,但会感觉很乱-应该有更好的方法。
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.
谢谢,
推荐答案那只是debian。每当它从非Debian标准目录(例如您的 / opt )中删除软件包时,该目录中就没有文件 dpkg 将尝试删除该目录。
That's just debian. Whenever it removes a package from a non-debian standard directory (such as /opt in your case) and there are no files left in that directory, dpkg will try to remove that directory.
如果 / opt 在删除时,您会在 / opt不为空;未删除行中收到一条消息。就是这样。
If there are some other files in /opt at the time of removal, you'll get a message in the lines of "/opt is not empty; not removed" and that's it.
另一个 hacky 的方法是在 postrm 中添加/ opt的重新创建,但这并不比隐藏文件更干净:)
Another "hacky" way would be to add re-creation of /opt in postrm, but it's not way cleaner than your hidden file :)
更多推荐
我的deb文件删除了/ opt
发布评论