I am building a custom Debian package and during the installation, I would like the package to check for available diskspace and only proceed if there is enough space. I would like this to happen during re-install as well.

I tried adding bash code to do the check in preinst and prerm file(for re-installations) with exit 1 if the check fails, but the installer went ahead and copied files and I end up with a broke installation.

What am I doing wrong?

link|improve this question

40% accept rate
What exactly do you have in the preinst? What happens if the system has many filesytems mounted? Will you check /,/usr,/var, and so on? How do you define re-install? Re you talking about upgrades? Can you paste the output of ab install? – Zoredache Nov 23 '11 at 3:54
In preinst I am doing various stuff like backing up any files left from previous installation and postinst will restore some of the data files to the new installation. – Debianuser Nov 23 '11 at 11:38
I only need to check disk space on / nothing else. This package is meant for machines within my LAN so I know the environment in advance. Install and re-install is always done by dpkg -i packagename.deb. Never using apt-get update. – Debianuser Nov 23 '11 at 11:47
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.