Linux:卸载程序后删除应用程序设置?
我正在为Linux 编写一个程序,它将其数据和设置存储在主目录中(例如/home/username/.program-name/stuff.xml)。数据可能占用 100 MB 甚至更多。
我一直想知道当系统管理员删除该程序时,数据和设置会发生什么情况。然后我应该从每个(!)主目录中删除这些文件,还是应该不理会它们?在主目录中留下数百 MB 似乎相当浪费......
I'm writing a program for Linux that stores its data and settings in the home directory (e.g. /home/username/.program-name/stuff.xml). The data can take up 100 MB and more.
I've always wondered what should happen with the data and the settings when the system admin removes the program. Should I then delete these files from every (!) home directory, or should I just leave them alone? Leaving hundreds of MB in the home directories seems quite wasteful...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您不应该删除用户数据,因为该程序将来可能会再次安装,或者因为用户可以选择将其数据移动到安装该程序的另一台计算机上。
无论如何,此类内容通常由某些删除脚本处理(可以是 make uninstall,更常见的是由包管理器运行的卸载脚本)。不同的经销商有不同的政策。一些包管理器有一个选项来指定是否删除日志、配置内容(来自
/etc
)等。据我所知,没有人接触用户家中的文件。I don't think you should remove user data, since the program could be installed again in future, or since the user could choose to move his data on another machine, where the program is installed.
Anyway this kind of stuff is usually handled by some removal script (it can be
make uninstall
, more often it's an unsinstallation script ran by your package manager). Different distributors have got different policies. Some package managers have got an option to specify whether to remove logs, configuration stuff (from/etc
) and so on. None touches files in user homes, as far as I know.如果主目录在多个工作站之间共享(即挂载 NFS)会发生什么情况?如果您从其中一个工作站中删除该程序,然后将文件从每个主目录中删除,那么您可能会真正惹恼仍在其他工作站上使用该程序的人。
What happens if the home directories are shared between multiple workstations (ie. NFS mounted)? If you remove the program from one of those workstations and then go blasting the files out of every home directory, you'll probably really annoy the people who are still using the program on other workstations.