kadischi/livecd_generator kadischi.py, 1.7, 1.8 movefiles.py, 1.1.1.1, 1.2
Jasper O'neal Hartline (autopsy)
fedora-extras-commits at redhat.com
Fri Mar 31 21:03:38 UTC 2006
Author: autopsy
Update of /cvs/devel/kadischi/livecd_generator
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25007/kadischi/livecd_generator
Modified Files:
kadischi.py movefiles.py
Log Message:
Contributor: Toshio Kuratomi (Consistency between spaces vs. tabs), commit
Index: kadischi.py
===================================================================
RCS file: /cvs/devel/kadischi/livecd_generator/kadischi.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- kadischi.py 30 Mar 2006 05:46:06 -0000 1.7
+++ kadischi.py 31 Mar 2006 21:03:36 -0000 1.8
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import os
import sys
@@ -56,23 +56,23 @@
force = options.force
if options.ksfile != None:
- anaconda_args = anaconda_args + ' --kickstart=' + options.ksfile
+ anaconda_args = anaconda_args + ' --kickstart=' + options.ksfile
if options.buildstamp != None:
- buildstamp = options.buildstamp
+ buildstamp = options.buildstamp
else:
- buildstamp = normalize_path ([confdir, 'buildstamp'])
+ buildstamp = normalize_path ([confdir, 'buildstamp'])
# set display mode
display_mode = ''
if options.graphical:
- display_mode = ' --graphical'
+ display_mode = ' --graphical'
if options.text:
- display_mode = ' -T'
+ display_mode = ' -T'
if options.cmdline:
- display_mode = ' -C'
+ display_mode = ' -C'
anaconda_args = display_mode + anaconda_args
@@ -81,12 +81,12 @@
# checking arguments
if len (args) < 2:
- flc_log ('Not enough arguments.\n')
- parser.parse_args (['-h'])
-
+ flc_log ('Not enough arguments.\n')
+ parser.parse_args (['-h'])
+
if len (args) > 2:
- flc_log ('Too many arguments.\n')
- parser.parse_args (['-h'])
+ flc_log ('Too many arguments.\n')
+ parser.parse_args (['-h'])
method = args [0]
isoimage = normalize_path ([args [1]])
@@ -96,14 +96,14 @@
flc_log ('Checking UID')
if os.getuid () != 0:
- flc_log ('You have to be root to run this application. Please restart with root permissions.\n')
- sys.exit (1)
+ flc_log ('You have to be root to run this application. Please restart with root permissions.\n')
+ sys.exit (1)
# check if we can open buildstamp file
if not os.access(buildstamp, os.R_OK):
- flc_log ('Can`t open buildstamp file %s. ' % buildstamp)
- sys.exit (1)
+ flc_log ('Can`t open buildstamp file %s. ' % buildstamp)
+ sys.exit (1)
# loading productPath from buildstamp
@@ -112,11 +112,11 @@
f = open(buildstamp, "r")
lines = f.readlines()
if len(lines) >= 4:
- product_path = lines[3][:-1]
- flc_log ('Product path set to %s. ' % product_path)
+ product_path = lines[3][:-1]
+ flc_log ('Product path set to %s. ' % product_path)
else:
- flc_log ('Product path can`t be found in buildstamp file %s (Product path should be on the 4th line of the file)' % buildstamp)
- sys.exit (1)
+ flc_log ('Product path can`t be found in buildstamp file %s (Product path should be on the 4th line of the file)' % buildstamp)
+ sys.exit (1)
# validating the repository
@@ -125,34 +125,34 @@
valid = True
if method.find (':') == -1:
- method = normalize_path ([method])
- valid = path_exists (method) and path_exists (method + '/' + product_path) and path_exists (method + '/' + product_path + '/' + 'base') and path_exists (method + '/' + product_path + '/' + 'RPMS')
+ method = normalize_path ([method])
+ valid = path_exists (method) and path_exists (method + '/' + product_path) and path_exists (method + '/' + product_path + '/' + 'base') and path_exists (method + '/' + product_path + '/' + 'RPMS')
elif method.find ('http') == 0 or method.find ('ftp') == 0:
- method = method.rstrip('/')
- valid = url_exists (method) and url_exists (method + '/' + product_path) and url_exists (method + '/' + product_path + '/' + 'base') and url_exists (method + '/' + product_path + '/' + 'RPMS')
+ method = method.rstrip('/')
+ valid = url_exists (method) and url_exists (method + '/' + product_path) and url_exists (method + '/' + product_path + '/' + 'base') and url_exists (method + '/' + product_path + '/' + 'RPMS')
if valid:
- flc_log ('Repository seems to be OK.')
+ flc_log ('Repository seems to be OK.')
else:
- flc_log ('Repository validation failed. Aborting execution.')
- sys.exit (1)
+ flc_log ('Repository validation failed. Aborting execution.')
+ sys.exit (1)
# format method string the way anaconda likes it
if method.find (':') == -1:
- method = 'nfs:/' + method
-
+ method = 'nfs:/' + method
+
# checking if everything is OK with destination (iso image) file
if os.path.isfile (isoimage):
- flc_log ('File %s already exists. ' % isoimage)
- if force:
- flc_log ('It will be overwritten.')
- else:
- flc_log ('Please choose some other file name, or use -f option to overwrite the existing file.')
- sys.exit (1)
+ flc_log ('File %s already exists. ' % isoimage)
+ if force:
+ flc_log ('It will be overwritten.')
+ else:
+ flc_log ('Please choose some other file name, or use -f option to overwrite the existing file.')
+ sys.exit (1)
elif not os.path.isdir (os.path.dirname (isoimage)):
- os.makedirs (os.path.dirname (isoimage))
+ os.makedirs (os.path.dirname (isoimage))
# check for installed rpms
@@ -169,19 +169,19 @@
missing_rpms = check_installed_rpms ('/', required_rpms, False)
if len (missing_rpms) != 0:
- flc_log ('Required packages:')
- for rpm in missing_rpms:
- flc_log (' %s' % rpm)
- flc_log ('are missing. Aborting execution.')
- sys.exit (1)
+ flc_log ('Required packages:')
+ for rpm in missing_rpms:
+ flc_log (' %s' % rpm)
+ flc_log ('are missing. Aborting execution.')
+ sys.exit (1)
# check for the config file
flc_log ('Looking for config file')
if not os.path.isfile (normalize_path([confdir, 'kadischi.conf'])):
- flc_log ('Can`t find config file %s.' % normalize_path([confdir, 'kadischi.conf']))
- sys.exit (1)
+ flc_log ('Can`t find config file %s.' % normalize_path([confdir, 'kadischi.conf']))
+ sys.exit (1)
# load config file options
@@ -195,8 +195,8 @@
buildconf.write ()
if builddir == '' or builddir == None:
- flc_log ('No build dir defined. Please, edit config file option BUILDDIR.')
- sys.exit(1)
+ flc_log ('No build dir defined. Please, edit config file option BUILDDIR.')
+ sys.exit(1)
# prepare dirs
@@ -214,14 +214,14 @@
# Moving the buildstamp file to /tmp/product/.buildstamp so anaconda can find it
if not os.path.exists ('/tmp/product'):
- os.makedirs ('/tmp/product')
+ os.makedirs ('/tmp/product')
elif not os.path.isdir ('/tmp/product'):
- flc_log ('Path /tmp/product is not a directory, temporarly moving to %s' % normalize_path([builddir, 'product']))
- shutil.move ('/tmp/product', normalize_path([builddir, 'product']))
- os.makedirs ('/tmp/product')
+ flc_log ('Path /tmp/product is not a directory, temporarly moving to %s' % normalize_path([builddir, 'product']))
+ shutil.move ('/tmp/product', normalize_path([builddir, 'product']))
+ os.makedirs ('/tmp/product')
elif os.path.exists ('/tmp/product/.buildstamp'):
- flc_log ('Path /tmp/product/.buildstamp already exists, temporarly moving to %s' % normalize_path([builddir, '.buildstamp']))
- shutil.move ('/tmp/product/.buildstamp', normalize_path([builddir, '.buildstamp']))
+ flc_log ('Path /tmp/product/.buildstamp already exists, temporarly moving to %s' % normalize_path([builddir, '.buildstamp']))
+ shutil.move ('/tmp/product/.buildstamp', normalize_path([builddir, '.buildstamp']))
shutil.copy2 (buildstamp, '/tmp/product/.buildstamp')
@@ -244,16 +244,16 @@
scripts = []
for root, dirs, files in os.walk (normalize_path([bindir, 'post_install_scripts'])):
- for filename in files:
- filename = normalize_path([bindir, 'post_install_scripts', filename])
- if os.access(filename, 1):
- scripts.append (filename)
+ for filename in files:
+ filename = normalize_path([bindir, 'post_install_scripts', filename])
+ if os.access(filename, 1):
+ scripts.append (filename)
scripts.sort()
for script in scripts:
- flc_log ('%s' % script)
- run ("%s %s" % (script, sysdir), builddir)
+ flc_log ('%s' % script)
+ run ("%s %s" % (script, sysdir), builddir)
# make initrd image
@@ -272,18 +272,18 @@
flc_log ('compressing the tree (order a pizza `cause this will take a while)')
if options.filesystem == 'squashfs':
- # zisofs has a tree which can be seen; squashfs is a file that we mount
- # loopback. So we need to create supporting files and directories
- # seperately.
- os.makedirs (os.path.join(csysdir, 'boot/isolinux'))
- os.makedirs(normalize_path([csysdir, '/livecd']))
- touch = file(normalize_path([csysdir, '.livecd']), 'w')
- touch.close()
- # compress a squashfs tree
- run("mksquashfs %s %s" % (sysdir, normalize_path([csysdir, 'kadischi.sqsh'])))
+ # zisofs has a tree which can be seen; squashfs is a file that we mount
+ # loopback. So we need to create supporting files and directories
+ # separately.
+ os.makedirs (os.path.join(csysdir, 'boot/isolinux'))
+ os.makedirs(normalize_path([csysdir, '/livecd']))
+ touch = file(normalize_path([csysdir, '.livecd']), 'w')
+ touch.close()
+ # compress a squashfs tree
+ run("mksquashfs %s %s" % (sysdir, normalize_path([csysdir, 'kadischi.sqsh'])))
else:
- # compress a zisofs tree
- run ("mkzftree -z 3 %s %s" % (sysdir, csysdir), builddir)
+ # compress a zisofs tree
+ run ("mkzftree -z 3 %s %s" % (sysdir, csysdir), builddir)
# install boot & conf files in compressed tree (they shoudn`t be compressed)
@@ -304,9 +304,9 @@
flc_log ('creating iso image %s' % isoimage)
if options.filesystem == 'squashfs':
- mkisoflags=''
+ mkisoflags=''
else:
- mkisoflags='MKISOFSOPTION=-z '
+ mkisoflags='MKISOFSOPTION=-z '
run ("%s%s %s %s" % (mkisoflags, normalize_path([bindir, 'create-iso.sh']), csysdir, isoimage), builddir)
# delete builddir
Index: movefiles.py
===================================================================
RCS file: /cvs/devel/kadischi/livecd_generator/movefiles.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- movefiles.py 21 Aug 2005 17:09:00 -0000 1.1.1.1
+++ movefiles.py 31 Mar 2006 21:03:36 -0000 1.2
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import os
import sys
@@ -8,16 +8,16 @@
# Files that we want to be moved to tmpfs
# and mounted back to original locations
files_to_be_writable = [
- '/var',
- '/tmp',
- '/etc',
- '/home',
- '/root',
- '/opt',
- '/mnt',
- '/media',
- ]
-
+ '/var',
+ '/tmp',
+ '/etc',
+ '/home',
+ '/root',
+ '/opt',
+ '/mnt',
+ '/media',
+ ]
+
# Files that we don`t want to be on tmpfs,
# but they are in dirs that are on tmpfs.
# These files will be moved to /moved, and
@@ -25,56 +25,56 @@
# The reason we don`t want then on tmpfs is that
# they are big and we don`t need them to be writable
files_to_be_moved = [
- '/var/lib/rpm',
- ]
+ '/var/lib/rpm',
+ ]
# Files that we need to stay in their original
# locations cause we need them before rc.readonly
# or during init.d/halt
files_to_stay = [
- '/etc/inittab',
- '/etc/init.d',
- '/etc/initlog.conf',
- '/etc/rc',
- '/etc/rc.d',
- '/etc/rc.local',
- '/etc/rc.readonly',
- '/etc/passwd',
- '/etc/shadow',
- '/etc/group',
- '/etc/fstab',
- '/etc/mtab',
- '/etc/makedev.d',
- ]
+ '/etc/inittab',
+ '/etc/init.d',
+ '/etc/initlog.conf',
+ '/etc/rc',
+ '/etc/rc.d',
+ '/etc/rc.local',
+ '/etc/rc.readonly',
+ '/etc/passwd',
+ '/etc/shadow',
+ '/etc/group',
+ '/etc/fstab',
+ '/etc/mtab',
+ '/etc/makedev.d',
+ ]
rootdir = sys.argv[1]
for file in files_to_be_moved:
- src = normalize_path ([file],rootdir)
- dst = normalize_path (['/livecd/moved',file],rootdir)
- os.renames (src, dst)
- if os.path.isfile (dst):
- os.system ("touch %s" % src)
- else:
- os.makedirs (src)
-
+ src = normalize_path ([file],rootdir)
+ dst = normalize_path (['/livecd/moved',file],rootdir)
+ os.renames (src, dst)
+ if os.path.isfile (dst):
+ os.system ("touch %s" % src)
+ else:
+ os.makedirs (src)
+
for file in files_to_be_writable:
- src = normalize_path ([file],rootdir)
- dst = normalize_path (['/livecd/tmpfs',file],rootdir)
- os.renames (src, dst)
- if os.path.isfile (dst):
- os.system ("touch %s" % src)
- else:
- os.makedirs (src)
+ src = normalize_path ([file],rootdir)
+ dst = normalize_path (['/livecd/tmpfs',file],rootdir)
+ os.renames (src, dst)
+ if os.path.isfile (dst):
+ os.system ("touch %s" % src)
+ else:
+ os.makedirs (src)
for file in files_to_stay:
- src = normalize_path (['/livecd/tmpfs',file],rootdir)
- dst = normalize_path ([file],rootdir)
- if os.path.isfile (src):
- shutil.copy2 (src, dst)
- else:
- shutil.copytree (src, dst)
-
+ src = normalize_path (['/livecd/tmpfs',file],rootdir)
+ dst = normalize_path ([file],rootdir)
+ if os.path.isfile (src):
+ shutil.copy2 (src, dst)
+ else:
+ shutil.copytree (src, dst)
+
run ("cd %s/livecd/tmpfs; tar -czf %s/livecd/kadischi.tar.gz *" % (rootdir, rootdir))
-clean_directory (normalize_path (['/livecd/tmpfs'],rootdir), False)
\ No newline at end of file
+clean_directory (normalize_path (['/livecd/tmpfs'],rootdir), False)
More information about the fedora-extras-commits
mailing list