我的deb文件删除了/ opt

编程入门 行业动态 更新时间:2024-10-17 04:52:59
本文介绍了我的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

本文发布于:2023-11-01 01:53:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547904.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   deb   opt

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!