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.