[Fedora-livecd-list] Failed to create LiveCD
Adam Dutko
dutko.adam at gmail.com
Tue Jan 9 04:27:31 UTC 2007
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.
#!/usr/bin/python -tt
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# A very basic (and potential partial patch to livecd-creator)
# by Adam M. Dutko - (dutko.adam at gmail.com)
# This code is valid for systems with an actual /var partition.
# In cases where we only have a root (/), /boot and swap on the system
# it will fail. I need to write a patch for that case and append to
# this code. Will try to do this week.
#
import os
import string
# Get a print out of disk space
the_disk = os.popen("df -P")
# We have six columns when using the 'Posix Switch' (-P).
# partition_details[0] = Filesystem
# partition_details[1] = 1024-blocks
# partition_details[2] = Used
# partition_details[3] = Available
# partition_details[4] = Capacity
# partition_details[5] = Mounted on
for the_partitions in the_disk.readlines():
# Cleanup b/c internal pointers are messy for some reason
check_size = ""
check_var = ''
partition_details = the_partitions.split()
check_size = partition_details[3].strip()
check_var = partition_details[5].strip()
if check_var == '/var' and check_size < "3000000":
print "You do not have enough free space to proceed with the
installation. " \
" Please allocate at least 3 gigabytes of space to /var so
the " \
"livecd-creator tool can continue with the build under
/var/tmp/livecd-creator."
exit
-Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-livecd-list/attachments/20070108/1ca8cb80/attachment.htm>
More information about the Fedora-livecd-list
mailing list