我的deb文件删除了/ opt [英] My deb file removes /opt

查看:157
本文介绍了我的deb文件删除了/ opt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆