THIS IS VERY BASIC AND DOES NOT COVER ALL USE CASES.  I will attempt to patch this with better logic tomorrow.  I'm trying to determine if it's best to use 'du' (which can take a while, and is subject to permissions issues...) or maybe 'sar' (which might not be universally installed...).  Any guidance on other potential tools and/or approaches is appreciated.
<br><br>#!/usr/bin/python -tt<br><br># This program is free software; you can redistribute it and/or modify<br># it under the terms of the GNU General Public License as published by<br># the Free Software Foundation; version 2 of the License.
<br>#<br># This program is distributed in the hope that it will be useful,<br># but WITHOUT ANY WARRANTY; without even the implied warranty of<br># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&nbsp; See the<br># GNU Library General Public License for more details.
<br>#<br># You should have received a copy of the GNU General Public License<br># along with this program; if not, write to the Free Software<br># Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<br><br># A very basic (and potential partial patch to livecd-creator)<br># by Adam M. Dutko - (<a href="mailto:dutko.adam@gmail.com">dutko.adam@gmail.com</a>)<br><br># This code is valid for systems with an actual /var partition.&nbsp; 
<br># In cases where we only have a root (/), /boot and swap on the system<br># it will fail.&nbsp; I need to write a patch for that case and append to<br># this code.&nbsp; Will try to do this week.<br>#<br>import os<br>import string
<br><br># Get a print out of disk space<br>the_disk = os.popen(&quot;df -P&quot;)<br><br># We have six columns when using the &#39;Posix Switch&#39; (-P).<br>#&nbsp;&nbsp; partition_details[0] = Filesystem&nbsp; <br>#&nbsp;&nbsp; partition_details[1] = 1024-blocks
<br>#&nbsp;&nbsp; partition_details[2] = Used <br>#&nbsp;&nbsp; partition_details[3] = Available <br>#&nbsp;&nbsp; partition_details[4] = Capacity <br>#&nbsp;&nbsp; partition_details[5] = Mounted on<br><br>for the_partitions in the_disk.readlines():<br>&nbsp;&nbsp;&nbsp; # Cleanup b/c internal pointers are messy for some reason
<br>&nbsp;&nbsp;&nbsp; check_size = &quot;&quot;<br>&nbsp;&nbsp;&nbsp; check_var = &#39;&#39;<br><br>&nbsp;&nbsp;&nbsp; partition_details = the_partitions.split()<br><br>&nbsp;&nbsp;&nbsp; check_size = partition_details[3].strip() <br>&nbsp;&nbsp;&nbsp; check_var = partition_details[5].strip()&nbsp;&nbsp;&nbsp; 
<br>&nbsp;&nbsp;&nbsp; if check_var == &#39;/var&#39; and check_size &lt; &quot;3000000&quot;:&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print &quot;You do not have enough free space to proceed with the installation. &quot; \<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot; Please allocate at least 3 gigabytes of space to /var so the &quot; \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;livecd-creator tool can continue with the build under /var/tmp/livecd-creator.&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit <br><br><br>-Adam<br>