当前位置: 动力学知识库 > 问答 > 编程问答 >

iphone - How to abort the installation of a deb package if the disk space is not enough

问题描述:

I'm developing a jailbroken program for iPhone. When the disk space is not enough, the installation will still continue, thus part of files were copied, while the other files were not, this makes the disk dirty.

I've written disk space check code at preinst and prerm scripts which are control files of deb package. When disk space is not enough, the control scripts will exit with nonzero code. But the problem is, when we are upgrading a package, if the disk space is not enough, the dpkg will still remove the old files even the prerm script exit with nonzero status, thus upgrading becomes removal which is not my expect result.

网友答案:

I don't know much about Cydia specifically, but if it works exactly like dpkg, then this should be solveable. See the activity diagram for package upgrades at http://people.debian.org/~srivasta/MaintainerScripts.html#sec-3.4.3 .

That shows a few different paths that could be taken in the course of running prerms and preinsts which lead the system back to a clean, old-version-still-installed state. For example, if the new-preinst fails, then the new-postrm will be run with "abort-upgrade" as the parameter. If that succeeds, then the old-postinst is also run with "abort-upgrade". And if that succeeds, you're back to a clean, installed state.

分享给朋友:
您可能感兴趣的文章:
随机阅读: