Makefile | 2
imgcreate/creator.py | 2
imgcreate/live.py | 4 +
tools/edit-livecd | 101 ++++++++++++++++++++++++--------------------
tools/livecd-iso-to-disk.sh | 25 +++++++++-
5 files changed, 83 insertions(+), 51 deletions(-)
New commits:
commit b52bcec7dc254ae653fc0d08d239072f8a71be37
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Fri Feb 18 14:09:48 2011 -0800
Version 15.5
diff --git a/Makefile b/Makefile
index be948ab..5d360aa 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-VERSION = 15.4
+VERSION = 15.5
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
commit ed957cf59bbcfc5a8d3e73e51daca91d98cec06b
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Thu Feb 17 12:10:26 2011 -0800
Print reason for sudden exit
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 213985e..700eac4 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -740,17 +740,26 @@ SRC=$(readlink -f "$1")
TGTDEV=$(readlink -f "$2")
if [ -z "$SRC" ]; then
+ echo "Missing source"
shortusage
exit 1
fi
if [ ! -b "$SRC" -a ! -f "$SRC" ]; then
+ echo "$SRC is not a file or block device"
shortusage
exit 1
fi
# FIXME: If --format is given, we shouldn't care and just use /dev/foo1
-if [ -z "$TGTDEV" -o ! -b "$TGTDEV" ]; then
+if [ -z "$TGTDEV" ]; then
+ echo "Missing target device"
+ shortusage
+ exit 1
+fi
+
+if [ ! -b "$TGTDEV" ]; then
+ echo "$TGTDEV is not a block device"
shortusage
exit 1
fi
commit 1aa9744bb05d29f34a67c35ce67492192dc9529d
Author: Bruce Jerrick <bmj001(a)gmail.com>
Date: Thu Feb 17 11:00:44 2011 -0800
Fix skipcopy usage with DVD iso (#644194)
Fix size estimation with skipcopy
Copy install.img when using skipcopy with a DVD iso
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 607783f..213985e 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -912,7 +912,11 @@ fi
# Verify available space for DVD installer
if [ "$srctype" = "installer" ]; then
- srcsize=$(du -s -B 1M $SRC | awk {'print $1;'})
+ if [ -z "$skipcopy" ]; then
+ srcsize=$(du -s -B 1M $SRC | awk {'print $1;'})
+ else
+ srcsize=0
+ fi
if [ "$imgtype" = "install" ]; then
imgpath=images/install.img
else
@@ -981,13 +985,13 @@ if [ "$srctype" = "live" -a -z "$skipcopy" ]; then
fi
# DVD installer copy
-if [ \( "$srctype" = "installer" -o "$srctype" = "netinst" \) -a -z "$skipcopy" ]; then
+if [ \( "$srctype" = "installer" -o "$srctype" = "netinst" \) ]; then
echo "Copying DVD image to target device."
mkdir -p $TGTMNT/images/
if [ "$imgtype" = "install" ]; then
copyFile $SRCMNT/images/install.img $TGTMNT/images/install.img || exitclean
fi
- if [ "$srctype" = "installer" ]; then
+ if [ "$srctype" = "installer" -a -z "$skipcopy" ]; then
cp $SRC $TGTMNT/
fi
sync
commit b8bfa24dba71036ddd941b8cdf773f6e44e2428e
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Thu Feb 17 08:38:36 2011 -0800
Move selinux relabel to after %post (#648591)
diff --git a/imgcreate/creator.py b/imgcreate/creator.py
index b915b11..ec4c1ba 100644
--- a/imgcreate/creator.py
+++ b/imgcreate/creator.py
@@ -738,7 +738,6 @@ class ImageCreator(object):
kickstart.KeyboardConfig(self._instroot).apply(ksh.keyboard)
kickstart.TimezoneConfig(self._instroot).apply(ksh.timezone)
kickstart.AuthConfig(self._instroot).apply(ksh.authconfig)
- kickstart.SelinuxConfig(self._instroot).apply(ksh.selinux)
kickstart.FirewallConfig(self._instroot).apply(ksh.firewall)
kickstart.RootPasswordConfig(self._instroot).apply(ksh.rootpw)
kickstart.ServicesConfig(self._instroot).apply(ksh.services)
@@ -749,6 +748,7 @@ class ImageCreator(object):
self._create_bootconfig()
self.__run_post_scripts()
+ kickstart.SelinuxConfig(self._instroot).apply(ksh.selinux)
def launch_shell(self):
"""Launch a shell in the install root.
commit 9a98af9cee78fa48442e513a4128eb5d794d6f40
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Wed Feb 16 09:41:43 2011 -0800
Add support for virtio disks to livecd (#672936)
VirtIO disks need their own drivers.
diff --git a/imgcreate/live.py b/imgcreate/live.py
index 708ff05..10d5cec 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -73,7 +73,9 @@ class LiveImageCreatorBase(LoopImageCreator):
self.__isodir = None
- self.__modules = ["=ata", "sym53c8xx", "aic7xxx", "=usb", "=firewire", "=mmc", "=pcmcia", "mptsas", "udf"]
+ self.__modules = ["=ata", "sym53c8xx", "aic7xxx", "=usb", "=firewire",
+ "=mmc", "=pcmcia", "mptsas", "udf", "virtio_blk",
+ "virtio_pci"]
self.__modules.extend(kickstart.get_modules(self.ks))
self._isofstype = "iso9660"
commit c15e1f51924286abdf5ba42fda3bd82f6d6943b0
Author: Frederick Grose <fgrose(a)gmail.com>
Date: Wed Feb 16 09:35:27 2011 -0800
Support attached LiveOS devices as well as image files for LiveOS editing.
Adjust naming of iso, log the iso name, adjust usage text, restore script
option.
diff --git a/tools/edit-livecd b/tools/edit-livecd
index 79a6061..659cfae 100755
--- a/tools/edit-livecd
+++ b/tools/edit-livecd
@@ -72,8 +72,9 @@ class LiveImageEditor(LiveImageCreator):
self._include = None
"""A string of file or directory paths to include in __copy_img_root."""
- self._builder = "someone"
- """The name of the Remix builder for _branding."""
+ self._builder = os.getlogin()
+ """The name of the Remix builder for _branding.
+ Default = os.getlogin()"""
self.compress_type = None
"""mksquashfs compressor to use. Use 'None' to force reading of the
@@ -119,21 +120,7 @@ class LiveImageEditor(LiveImageCreator):
rtn = self._LoopImageCreator__imagedir + "/ext3fs.img"
return rtn
_image = property(__get_image)
- """The location of the image file or filesystem root."""
-
- def _get_fstype(self, filesystem):
- dev_null = os.open('/dev/null', os.O_WRONLY)
- args = ['/sbin/blkid', '-s', 'TYPE', '-o', 'value', filesystem]
- try:
- fs_type = subprocess.Popen(args,
- stdout=subprocess.PIPE,
- stderr=dev_null).communicate()[0]
- except IOError, e:
- raise CreatorError("Failed to determine fsimage TYPE: %s" % e )
- finally:
- os.close(dev_null)
-
- return fs_type.rstrip()
+ """The location of the filesystem image file."""
def _get_fslabel(self):
dev_null = os.open("/dev/null", os.O_WRONLY)
@@ -211,11 +198,11 @@ class LiveImageEditor(LiveImageCreator):
if self.clone:
# Need to clone base_on into ext3fs.img at this point
- self._base_on(base_on)
self._LoopImageCreator__fslabel = self.name
+ self._base_on(base_on)
else:
LiveImageCreator._base_on(self, base_on)
- self._LoopImageCreator__fstype = self._get_fstype(self._image)
+ self._LoopImageCreator__fstype = get_fsvalue(self._image, 'TYPE')
self._get_fslabel()
self.fslabel = self._LoopImageCreator__fslabel
@@ -250,7 +237,6 @@ class LiveImageEditor(LiveImageCreator):
self.__copy_img_root(base_on)
self._brand(self._builder)
-
def _base_on(self, base_on):
"""Clone the running LiveOS image as the basis for the new image."""
@@ -353,6 +339,7 @@ class LiveImageEditor(LiveImageCreator):
"""Adjust the image branding to show its variation from original
source by builder and build date."""
+ self.fslabel = self.name
dt = time.strftime('%d-%b-%Y')
lst = ['isolinux/isolinux.cfg', 'syslinux/syslinux.cfg',
@@ -371,12 +358,11 @@ class LiveImageEditor(LiveImageCreator):
for line in cfgf:
i = line.find('Welcome to ')
if i > -1:
- self.name = line[i+11:-2]
+ release = line[i+11:-2]
break
cfgf.close()
- ntext = dt.translate(None,
- '-') + '-' + _builder + '-Remix-' + self.name
+ ntext = dt.translate(None, '-') + '-' + _builder + '-Remix-' + release
# Update fedora-release message with Remix details.
releasefiles = '/etc/fedora-release, /etc/generic-release'
@@ -392,8 +378,8 @@ class LiveImageEditor(LiveImageCreator):
raise CreatorError("Failed to open or write '%s' : %s" %
(f.name, e))
- self.name = ntext
- self.fslabel += '-' + os.uname()[4] + '-' + time.strftime('%Y%m%d.%H')
+ self._releasefile = ntext
+ self.name += '-' + os.uname()[4] + '-' + time.strftime('%Y%m%d.%H%M')
def _configure_bootloader(self, isodir):
@@ -411,8 +397,8 @@ class LiveImageEditor(LiveImageCreator):
os.rename(src, cfgf)
args = ['/bin/sed', '-i',
- '-e', 's/Welcome to .*/Welcome to ' + self.name + '!/',
- '-e', 's/root=[^ ]*/root=live:CDLABEL=' + self.fslabel + '/',
+ '-e', 's/Welcome to .*/Welcome to ' + self._releasefile + '!/',
+ '-e', 's/root=[^ ]*/root=live:CDLABEL=' + self.name + '/',
'-e', 's/rootfstype=[^ ]* [^ ]*/rootfstype=auto ro/',
'-e', 's/liveimg .* quiet/liveimg quiet/', cfgf]
@@ -430,20 +416,21 @@ class LiveImageEditor(LiveImageCreator):
os.close(dev_null)
def parse_options(args):
- parser = optparse.OptionParser(usage = "\n %prog [-n=<name>]"
- "\n [-o=<output>]"
- "\n [-s=<script.sh>]"
- "\n [-t=<tmpdir>]"
- "\n [-e=<excludes>]"
- "\n [-f=<exclude-file>]"
- "\n [-i=<includes>]"
- "\n [-r=<releasefile>]"
- "\n [-b=<builder>]"
- "\n [--clone]"
- "\n [-c=<compress_type>]"
- "\n [--skip-compression]"
- "\n [--skip-minimize]"
- "\n <LIVEIMG.src>")
+ parser = optparse.OptionParser(usage = """
+ %prog [-n=<name>]
+ [-o=<output>]
+ [-s=<script.sh>]
+ [-t=<tmpdir>]
+ [-e=<excludes>]
+ [-f=<exclude-file>]
+ [-i=<includes>]
+ [-r=<releasefile>]
+ [-b=<builder>]
+ [--clone]
+ [-c=<compress_type>]
+ [--skip-compression]
+ [--skip-minimize]
+ <LIVEIMG.src>""")
parser.add_option("-n", "--name", type="string", dest="name",
help="name of new LiveOS (don't include .iso, it will "
@@ -476,7 +463,8 @@ def parse_options(args):
parser.add_option("-r", "--releasefile", type="string", dest="releasefile",
help="Specify release file/s for branding.")
- parser.add_option("-b", "--builder", type="string", dest="builder",
+ parser.add_option("-b", "--builder", type="string",
+ dest="builder", default=os.getlogin(),
help="Specify the builder of a Remix.")
parser.add_option("", "--clone", action="store_true", dest="clone",
@@ -507,6 +495,20 @@ def parse_options(args):
return (args[0], options)
+def get_fsvalue(filesystem, tag):
+ dev_null = os.open('/dev/null', os.O_WRONLY)
+ args = ['/sbin/blkid', '-s', tag, '-o', 'value', filesystem]
+ try:
+ fs_type = subprocess.Popen(args,
+ stdout=subprocess.PIPE,
+ stderr=dev_null).communicate()[0]
+ except IOError, e:
+ raise CreatorError("Failed to determine fs %s: %s" % value, e )
+ finally:
+ os.close(dev_null)
+
+ return fs_type.rstrip()
+
def rebuild_iso_symlinks(isodir):
# remove duplicate files and rebuild symlinks to reduce iso size
efi_vmlinuz = "%s/EFI/boot/vmlinuz0" % isodir
@@ -528,7 +530,9 @@ def main():
print >> sys.stderr, "You must run edit-liveos as root"
return 1
- if options.name and options.name != os.path.basename(LiveOS):
+ if stat.S_ISBLK(os.stat(LiveOS).st_mode):
+ name = get_fsvalue(LiveOS, 'LABEL') + '.edited'
+ elif options.name and options.name != os.path.basename(LiveOS):
name = options.name
else:
name = os.path.basename(LiveOS) + ".edited"
@@ -537,6 +541,8 @@ def main():
output = options.output
else:
output = os.path.dirname(LiveOS)
+ if output == '/dev':
+ output = options.tmpdir
editor = LiveImageEditor(name)
editor._exclude = options.exclude
@@ -553,10 +559,17 @@ def main():
try:
editor.mount(LiveOS, cachedir = None)
editor._configure_bootloader(editor._LiveImageCreatorBase__isodir)
- editor.name = editor.fslabel
+ if options.script:
+ print "Running edit script '%s'" % options.script
+ editor._run_script(options.script)
+ else:
+ print "Launching shell. Exit to continue."
+ print "----------------------------------"
+ editor.launch_shell()
rebuild_iso_symlinks(editor._LiveImageCreatorBase__isodir)
editor.unmount()
editor.package(output)
+ logging.info("%s.iso saved to %s" % (editor.name, output))
except CreatorError, e:
logging.error(u"Error editing LiveOS : %s" % e)
return 1
commit a6d7414ed5ecf8c495d4bd3be7b132a1dc8fa6aa
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Tue Feb 15 16:37:47 2011 -0800
Check return value on udevadm (#637258)
Make sure we don't proceed with an empty $device
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index ad0eebc..607783f 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -292,6 +292,10 @@ getdisk() {
fi
p=$(udevadm info -q path -n $DEV)
+ if [ $? -gt 0 ]; then
+ echo "Error getting udev path to $DEV"
+ exitclean
+ fi
if [ -e /sys/$p/device ]; then
device=$(basename /sys/$p)
else