--- pilgrim.py.orig	2007-08-05 18:14:41.000000000 +0200
+++ pilgrim.py	2007-08-05 20:20:38.000000000 +0200
@@ -34,6 +34,10 @@
 import pykickstart.parser
 import pykickstart.version
 
+# Translation
+from rhpl.translate import _, N_, getDefaultLangs
+import rhpl.translate as translate
+
 class MountError(Exception):
     def __init__(self, msg):
         Exception.__init__(self, msg)
@@ -60,7 +64,7 @@
                 os.makedirs(self.dest)
             rc = subprocess.call(["/bin/mount", "--bind", self.src, self.dest])
             if rc != 0:
-                raise MountError("Bind-mounting '%s' to '%s' failed" % (self.src, self.dest))
+                raise MountError(_("Bind-mounting '%s' to '%s' failed") % (self.src, self.dest))
             self.mounted = True
 
     def umount(self):
@@ -108,7 +112,7 @@
 
         rc = subprocess.call(["/sbin/losetup", "-f", self.lofile])
         if rc != 0:
-            raise MountError("Failed to allocate loop device for '%s'" % self.lofile)
+            raise MountError(_("Failed to allocate loop device for '%s'") % self.lofile)
 
         # succeeded; figure out which loopdevice we're using
         buf = subprocess.Popen(["/sbin/losetup", "-a"],
@@ -123,7 +127,7 @@
                 break
 
         if not self.loopdev:
-            raise MountError("Failed to find loop device associated with '%s' from '/sbin/losetup -a'" % self.lofile)
+            raise MountError(_("Failed to find loop device associated with '%s' from '/sbin/losetup -a'") % self.lofile)
 
         self.losetup = True
 
@@ -143,7 +147,7 @@
 
         rc = subprocess.call(args)
         if rc != 0:
-            raise MountError("Failed to mount '%s' to '%s'" % (self.loopdev, self.mountdir))
+            raise MountError(_("Failed to mount '%s' to '%s'") % (self.loopdev, self.mountdir))
 
         self.mounted = True
 
@@ -170,7 +174,7 @@
                               "-m", "1", "-b", "4096", self.lofile,
                               "%d" % ( self.size *  1024L * 1024L / 4096L )])
         if rc != 0:
-            raise MountError("Error creating ext3 filesystem")
+            raise MountError(_("Error creating ext3 filesystem"))
         rc = subprocess.call(["/sbin/tune2fs", "-c0", "-i0", "-Odir_index",
                               "-ouser_xattr,acl", self.lofile])
 
@@ -188,10 +192,10 @@
         # being left and an inability to clean up after ourself
         pass
 
-    def _writeConf(self, datadir, installroot):
+    def _writeConf(self, datadir, installroot, cachedir):
         conf  = "[main]\n"
         conf += "installroot=%s\n" % installroot
-        conf += "cachedir=/var/cache/yum\n"
+        conf += "cachedir=%s\n" % cachedir
         conf += "plugins=0\n"
         conf += "reposdir=\n"
 
@@ -205,8 +209,8 @@
 
         return path
 
-    def setup(self, datadir, installroot):
-        self.doConfigSetup(fn = self._writeConf(datadir, installroot),
+    def setup(self, datadir, installroot, cachedir):
+        self.doConfigSetup(fn = self._writeConf(datadir, installroot, cachedir),
                            root = installroot)
         self.conf.cache = 0
         self.doTsSetup()
@@ -219,7 +223,7 @@
         try:
             self.install(pattern = pkg)
         except yum.Errors.InstallError, e:
-            raise InstallationError("Failed to find package '%s' : %s" % (pkg, e))
+            raise InstallationError(_("Failed to find package '%s' : %s") % (pkg, e))
 
     def deselectPackage(self, pkg):
         """Deselect package.  Can be specified as name.arch or name*"""
@@ -236,13 +240,13 @@
         if len(txmbrs) > 0:
             map(lambda x: self.tsInfo.remove(x.pkgtup), txmbrs)
         else:
-            print >> sys.stderr, "No such package %s to remove" %(pkg,)
+            print >> sys.stderr, _("No such package %s to remove") %(pkg,)
 
     def selectGroup(self, grp, include = pykickstart.parser.GROUP_DEFAULT):
         try:
             yum.YumBase.selectGroup(self, grp)
         except (yum.Errors.InstallError, yum.Errors.GroupsError), e:
-            raise InstallationError("Failed to find group '%s' : %s" % (grp, e))
+            raise InstallationError(_("Failed to find group '%s' : %s") % (grp, e))
         if include == pykickstart.parser.GROUP_REQUIRED:
             map(lambda p: self.deselectPackage(p), grp.default_packages.keys())
         elif include == pykickstart.parser.GROUP_ALL:
@@ -276,9 +280,9 @@
         try:
             (res, resmsg) = self.buildTransaction()
         except yum.Errors.RepoError, e:
-            raise InstallationError("Unable to download from repo : %s" %(e,))
+            raise InstallationError(_("Unable to download from repo : %s") %(e,))
         if res != 2 and False:
-            raise InstallationError("Failed to build transaction : %s" % str.join("\n", resmsg))
+            raise InstallationError(_("Failed to build transaction : %s") % str.join("\n", resmsg))
 
         dlpkgs = map(lambda x: x.po, filter(lambda txmbr: txmbr.ts_state in ("i", "u"), self.tsInfo.getMembers()))
         self.downloadPkgs(dlpkgs)
@@ -297,7 +301,7 @@
         return self.runTransaction(cb)
 
 class InstallationTarget:
-    def __init__(self, repos, packages, epackages, groups, fs_label, skip_compression, skip_prelink,tmpdir):
+    def __init__(self, repos, packages, epackages, groups, fs_label, skip_compression, skip_prelink, tmpdir, bootloader_timeout, bootloader_options, preferred_kernel):
         self.ayum = None
         self.repos = repos
         self.packages = packages
@@ -306,7 +310,11 @@
         self.fs_label = fs_label
         self.skip_compression = skip_compression
         self.skip_prelink = skip_prelink
+        self.build_dir = None
         self.tmpdir = tmpdir
+        self.bootloader_timeout = bootloader_timeout
+        self.bootloader_options = bootloader_options
+        self.preferred_kernel = preferred_kernel
 
         self.build_dir = None
         self.instloop = None
@@ -320,9 +328,9 @@
             try:
                 self.ksparser.readKickstart(kscfg)
             except IOError, (err, msg):
-                raise InstallationError("Failed to read kickstart file '%s' : %s" % (kscfg, msg))
+                raise InstallationError(_("Failed to read kickstart file '%s' : %s") % (kscfg, msg))
             except pykickstart.errors.KickstartError, e:
-                raise InstallationError("Failed to parse kickstart file '%s' : %s" % (kscfg, e))
+                raise InstallationError(_("Failed to parse kickstart file '%s' : %s") % (kscfg, e))
 
             for repo in self.ksparser.handler.repo.repoList:
                 already_given = False
@@ -341,15 +349,15 @@
             self.epackages.extend(self.ksparser.handler.packages.excludedList)
 
         if not self.packages and not self.groups:
-            raise InstallationError("No packages or groups specified")
+            raise InstallationError(_("No packages or groups specified"))
 
         if not self.repos:
-            raise InstallationError("No repositories specified")
+            raise InstallationError(_("No repositories specified"))
 
         # more sanity checks
         if self.ksparser.handler.selinux.selinux and not \
                os.path.exists("/selinux/enforce"):
-            raise InstallationError("SELinux requested but not enabled on host system")
+            raise InstallationError(_("SELinux requested but not enabled on host system"))
 
     def base_on_iso(self, base_on):
         """helper function to extract ext3 file system from a live CD ISO"""
@@ -364,20 +372,20 @@
             try:
                 isoloop.mount()
             except MountError, e:
-                raise InstallationError("Failed to loopback mount '%s' : %s" % (base_on, e))
+                raise InstallationError(_("Failed to loopback mount '%s' : %s") % (base_on, e))
 
             if not os.path.exists(squashloop.lofile):
-                raise InstallationError("'%s' is not a valid live CD ISO : squashfs.img doesn't exist" % base_on)
+                raise InstallationError(_("'%s' is not a valid live CD ISO : squashfs.img doesn't exist") % base_on)
 
             try:
                 squashloop.mount()
             except MountError, e:
-                raise InstallationError("Failed to loopback mount squashfs.img from '%s' : %s" % (base_on, e))
+                raise InstallationError(_("Failed to loopback mount squashfs.img from '%s' : %s") % (base_on, e))
 
             os_image = self.build_dir + "/base_on_squashfs/os.img"
 
             if not os.path.exists(os_image):
-                raise InstallationError("'%s' is not a valid live CD ISO : os.img doesn't exist" % base_on)
+                raise InstallationError(_("'%s' is not a valid live CD ISO : os.img doesn't exist") % base_on)
 
             shutil.copyfile(os_image, self.build_dir + "/data/os.img")
         finally:
@@ -394,20 +402,36 @@
         fstab.write("sysfs                   /sys                    sysfs   defaults        0 0\n")
         fstab.close()
 
-    def setup(self, image_size, base_on = None):
+    def setup(self, image_size, base_on = None, build_dir = None, yum_installroot = None, yum_cachedir=None):
         """setup target ext3 file system in preparation for an install"""
 
         # setup temporary build dirs
-        try:
-            self.build_dir = tempfile.mkdtemp(dir=self.tmpdir, prefix="livecd-creator-")
-        except OSError, (err, msg):
-            raise InstallationError("Failed create build directory in %s: %s" % (self.tmpdir, msg))
+        if not build_dir:
+            try:
+                self.build_dir = tempfile.mkdtemp(dir="/var/tmp", prefix="livecd-creator-")
+            except OSError, (err, msg):
+                raise InstallationError(_("Failed create build directory in /var/tmp: %s") % msg)
+        else:
+            self.build_dir = build_dir
+            os.makedirs(self.build_dir)
 
         os.makedirs(self.build_dir + "/out/isolinux")
         os.makedirs(self.build_dir + "/out/sysroot")
         os.makedirs(self.build_dir + "/data/sysroot")
-        os.makedirs(self.build_dir + "/install_root")
-        os.makedirs(self.build_dir + "/yum-cache")
+
+        # Replace making the install_root directory with linking it
+        # to the existing install_root, if specified
+        if not yum_installroot:
+            os.makedirs(self.build_dir + "/install_root")
+        else:
+            os.symlink(yum_installroot,self.build_dir + "/install_root")
+
+        # Create a yum cache directory only if needed, or set it to the correct directory
+        if not yum_cachedir:
+            os.makedirs(self.build_dir + "/yum-cache")
+# Don't know if this is usefull for others, revisor doesn't need it
+#        else:
+#            os.symlink(yum_cachedir, self.build_dir + "/yum-cache")
 
         if base_on:
             # get backing ext3 image if we're based this build on an existing live CD ISO
@@ -428,7 +452,7 @@
         try:
             self.instloop.mount()
         except MountError, e:
-            raise InstallationError("Failed to loopback mount '%s' : %s" % (self.instloop.lofile, e))
+            raise InstallationError(_("Failed to loopback mount '%s' : %s") % (self.instloop.lofile, e))
 
         if not base_on:
             # create a few directories needed if it's a new image
@@ -439,10 +463,15 @@
 
         # bind mount system directories into install_root/
         for (f, dest) in [("/sys", None), ("/proc", None), ("/dev", None),
-                          ("/dev/pts", None), ("/selinux", None),
-                          (self.build_dir + "/yum-cache", "/var/cache/yum")]:
+                          ("/dev/pts", None), ("/selinux", None)]:
             self.bindmounts.append(BindChrootMount(f, self.build_dir + "/install_root", dest))
 
+        if not yum_cachedir:
+            self.bindmounts.append(BindChrootMount(self.build_dir + "/yum-cache", self.build_dir + "/install_root", "/var/cache/yum"))
+            cachedir = "/var/cache/yum"
+        else:
+            cachedir = yum_cachedir
+
         for b in self.bindmounts:
             b.mount()
 
@@ -453,9 +482,11 @@
 
         self.ayum = LiveCDYum()
         self.ayum.setup(self.build_dir + "/data",
-                        self.build_dir + "/install_root")
+                        self.build_dir + "/install_root",
+                        cachedir
+                        )
 
-    def unmount(self):
+    def unmount(self, kill = True):
         """detaches system bind mounts and install_root for the file system and tears down loop devices used"""
         self.ayum = None
 
@@ -463,11 +494,12 @@
         # in the install root; this is only needed because
         # there's no way to ask yum to close its sqlite dbs,
         # though. See https://bugzilla.redhat.com/236409
-        for i in range(3, os.sysconf("SC_OPEN_MAX")):
-            try:
-                os.close(i)
-            except:
-                pass
+        if kill:
+            for i in range(3, os.sysconf("SC_OPEN_MAX")):
+                try:
+                    os.close(i)
+                except:
+                    pass
 
         try:
             os.unlink(self.build_dir + "/install_root/etc/mtab")
@@ -482,7 +514,7 @@
             (xxbsize, xxfrsize, xxblocks, xxbfree,
              xxbavail, xxfiles, xxffree, xxfavail,
              xxflag, xxnamemax) = os.statvfs(self.build_dir + "/install_root")
-            print >> sys.stderr, "Installation target uncompressed data size is %d MB" % ( ( xxfrsize * xxblocks - xxbsize * xxbfree ) / ( 1024L * 1024L ) )
+            print >> sys.stderr, _("Installation target uncompressed data size is %d MB") % ( ( xxfrsize * xxblocks - xxbsize * xxbfree ) / ( 1024L * 1024L ) )
             self.instloop.cleanup()
             self.instloop = None
 
@@ -508,7 +540,7 @@
 
             self.ayum.runInstall()
         except yum.Errors.RepoError, e:
-            raise InstallationError("Unable to download from repo : %s" %(e,))
+            raise InstallationError(_("Unable to download from repo : %s") %(e,))
         finally:
             self.ayum.closeRpmDB()
 
@@ -630,12 +662,12 @@
 
         for network in self.ksparser.handler.network.network:
             if not network.device:
-                raise InstallationError("No --device specified with network kickstart command")
+                raise InstallationError(_("No --device specified with network kickstart command"))
 
             if network.onboot and network.bootProto.lower() != "dhcp" and \
                not (network.ip and network.netmask):
-                raise InstallationError("No IP address and/or netmask specified with static " +
-                                        "configuration for '%s'" % network.device)
+                raise InstallationError(_("No IP address and/or netmask specified with static " +
+                                        "configuration for '%s'") % network.device)
 
             self.writeNetworkIfCfg(instroot, network)
             self.writeNetworkKey(instroot, network)
@@ -744,7 +776,7 @@
                         self.ksparser.handler.scripts):
             # we can only safely run scripts in the chroot
             if not s.inChroot:
-                print >> sys.stderr, "Not running script outside of chroot"
+                print >> sys.stderr, _("Not running script outside of chroot")
                 continue
 
             (fd, path) = tempfile.mkstemp("", "ks-script-", "%s/tmp" %(instroot,))
@@ -757,7 +789,7 @@
                                 preexec_fn = self.run_in_root)
             except OSError, (err, msg):
                 os.unlink(path)
-                raise InstallationError("Failed to execute %%post script with '%s' : %s" % (s.interp, msg))
+                raise InstallationError(_("Failed to execute %%post script with '%s' : %s") % (s.interp, msg))
             os.unlink(path)
 
     def get_kernel_version(self):
@@ -765,22 +797,71 @@
         # FIXME: this doesn't handle multiple kernels - we should list
         #        them all in the isolinux menu
         #
+        self.kernel_types = [
+                                         {
+                                           "regexp": ".*PAE-debug$",
+                                           "initrd": "initpaed.img",
+                                           "vmlinuz": "vmlpaed",
+                                           "type": "PAE-debug"
+                                         },
+
+                                         {
+                                           "regexp": ".*PAE$",
+                                           "initrd": "initpae.img",
+                                           "vmlinuz": "vmlpae",
+                                           "type": "PAE"
+                                         },
+
+                                         {
+                                            "regexp": ".*xen$",
+                                            "initrd": "initxen.img",
+                                            "vmlinuz": "vmlxen",
+                                            "type": "xen"
+                                         },
+
+                                         {
+                                            "regexp": ".*debug$",
+                                            "initrd": "initdbg.img",
+                                            "vmlinuz": "vmldebug",
+                                            "type": "debug"
+                                         },
+
+                                         {
+                                            "regexp": "^.*$",
+                                            "initrd": "initrd.img",
+                                            "vmlinuz": "vmlinuz",
+                                            "type": "normal"
+                                         }
+                            ]
+
+        kernel_dirs = []
         kernels = []
         modules_dir = "%s/install_root/lib/modules" % self.build_dir
 
         if os.path.isdir(modules_dir):
-            kernels = os.listdir(modules_dir)
+            kernel_dirs = os.listdir(modules_dir)
+
+        kernel_dirs.sort()
 
-        if not kernels:
-            raise InstallationError("No kernels installed: /lib/modules is empty")
+        if not kernel_dirs:
+            raise InstallationError(_("No kernels installed: /lib/modules is empty"))
 
-        return kernels[0]
+        for kernel_dir in kernel_dirs:
+            found = False
+            for kernel_type in self.kernel_types:
+                if not found:
+                    if re.match(kernel_type["regexp"], kernel_dir):
+                        kernels.append({"name": kernel_dir, "initrd": kernel_type["initrd"], "vmlinuz": kernel_type["vmlinuz"], "type": kernel_type["type"] })
+                        found = True
+
+        self.log.debug("Kernels: %s" % str(kernels))
+        return kernels
 
     def createInitramfs(self):
         # Create initramfs
         if not os.path.isfile("/usr/lib/livecd-creator/mayflower"):
-            raise InstallationError("livecd-creator not correctly installed : "+
-                                    "/usr/lib/livecd-creator/mayflower not found")
+            raise InstallationError(_("livecd-creator not correctly installed : " +
+                                    "/usr/lib/livecd-creator/mayflower not found"))
         shutil.copy("/usr/lib/livecd-creator/mayflower",
                         "%s/install_root/sbin/mayflower" %(self.build_dir,))
         # modules needed for booting (this is butt ugly and we need to retrieve this from elsewhere, e.g. the kernel)
@@ -793,9 +874,11 @@
         mayflowerconf.write('MODULES+="sym53c8xx aic7xxx "\n')
         mayflowerconf.close()
 
-        subprocess.call(["/sbin/mayflower", "-f", "/boot/livecd-initramfs.img",
-                        self.get_kernel_version()],
-                        preexec_fn=self.run_in_root)
+        for kernel in self.get_kernel_version():
+            subprocess.call(["/sbin/mayflower", "-f", "/boot/livecd-initramfs-%s.img" % kernel["name"],
+                            kernel["name"]],
+                            preexec_fn=self.run_in_root)
+
         for f in ("/sbin/mayflower", "/etc/mayflower.conf"):
             os.unlink("%s/install_root/%s" %(self.build_dir, f))
 
@@ -828,6 +911,120 @@
         #  - fix for non-i386
         #  - error handling
         #
+
+        # Handle multiple kernels
+        for kernel in self.get_kernel_version():
+            # Copy appr. vmlinuz in place
+            shutil.copyfile("%s/install_root/boot/vmlinuz-%s"
+                            %(self.build_dir, kernel["name"]),
+                            "%s/out/isolinux/%s" %(self.build_dir, kernel["vmlinuz"]))
+
+            # Copy appr. initrd in place
+            shutil.copyfile("%s/install_root/boot/livecd-initramfs-%s.img"
+                            %(self.build_dir,kernel["name"]),
+                            "%s/out/isolinux/%s" %(self.build_dir,kernel["initrd"]))
+
+            # Lose whatever was there
+            os.unlink("%s/install_root/boot/livecd-initramfs-%s.img"
+                    %(self.build_dir,kernel["name"]))
+
+        syslinuxfiles = ["isolinux.bin"]
+        menus = ["vesamenu.c32", "menu.c32"]
+        syslinuxMenu = None
+
+        for m in menus:
+            path = "%s/install_root/usr/lib/syslinux/%s" % (self.build_dir, m)
+            if os.path.isfile(path):
+                syslinuxfiles.append(m)
+                syslinuxMenu=m
+                break
+        if syslinuxMenu is None:
+            raise InstallationError(_("syslinux not installed : no suitable *menu.c32 found"))
+
+        for p in syslinuxfiles:
+            path = "%s/install_root/usr/lib/syslinux/%s" % (self.build_dir, p)
+            if not os.path.isfile(path):
+                raise InstallationError(_("syslinux not installed : %s not found") % path)
+
+            shutil.copy(path, "%s/out/isolinux/%s" % (self.build_dir, p))
+
+        if os.path.exists("%s/install_root/usr/lib/anaconda-runtime/syslinux-vesa-splash.jpg" %(self.build_dir,)):
+            shutil.copy("%s/install_root/usr/lib/anaconda-runtime/syslinux-vesa-splash.jpg" %(self.build_dir,),
+                        "%s/out/isolinux/splash.jpg" %(self.build_dir,))
+            have_background = "menu background splash.jpg"
+        else:
+            have_background = ""
+
+        cfg_template = """
+default %(menu)s
+timeout %(bootloader_timeout)s
+%(bootloader_isolinux_extras)s
+
+%(background)s
+menu title """ + _("Welcome to %(label)s!") + """
+menu color border 0 #ffffffff #00000000
+menu color sel 7 #ffffffff #ff000000
+menu color title 0 #ffffffff #00000000
+menu color tabmsg 0 #ffffffff #00000000
+menu color unsel 0 #ffffffff #00000000
+menu color hotsel 0 #ff000000 #ffffffff
+menu color hotkey 7 #ffffffff #ff000000
+"""
+
+        cfg = cfg_template % {"menu" : syslinuxMenu, "background" : have_background, "label" : self.fs_label,
+                              "bootloader_timeout" : self.bootloader_timeout,
+                              "bootloader_isolinux_extras" : self.bootloader_isolinux_extras }
+
+# FIXME
+# Change initrd.img to the "default" kernel, which at this moment we don't have
+
+        for kernel in self.get_kernel_version():
+            # Match against self.preferred_kernel_type
+            if kernel["type"] == self.preferred_kernel_type:
+                preferred_kernel = kernel
+
+        # short, long, extra, kernel_initrd, kernel_vmlinuz
+        stanzas = [("linux", _("Run from image"), self.bootloader_options, "%s" % preferred_kernel["initrd"], "%s" % preferred_kernel["vmlinuz"]),
+                   ("runfromram", _("Run from RAM - requires 1 GB+"), self.bootloader_options+" live_ram", "%s" % preferred_kernel["initrd"], "%s" % preferred_kernel["vmlinuz"])]
+
+        # List all kernels
+        for kernel in self.get_kernel_version():
+            if not kernel["type"] == self.cfg.lm_preferred_kernel_type:
+                stanzas.append( ("linux-%s" % kernel["name"], _("Run kernel %s") % kernel["name"], self.bootloader_options, "%s" % kernel["initrd"], "%s" % kernel["vmlinuz"]) )
+
+        if os.path.exists("%s/install_root/usr/lib/anaconda-runtime/checkisomd5" %(self.build_dir,)):
+            stanzas.append( ("check", _("Verify and run from image"), "check", "", "") )
+
+        bootcfg = ""
+
+        for (short, long, extra, kernel_initrd, kernel_vmlinuz) in stanzas:
+            bootcfg += """label %(short)s
+  menu label %(long)s
+  kernel %(kernel_vmlinuz)s
+  append initrd=%(kernel_initrd)s ro quiet root=CDLABEL=%(label)s rootfstype=iso9660 liveimg %(extra)s
+"""
+
+        bootcfg = bootcfg % {"label": self.fs_label, "background" : have_background, "short": short, "long": long, "extra": extra, "kernel_vmlinuz": kernel_vmlinuz, "kernel_initrd": kernel_initrd }
+
+        memtest = glob.glob("%s/install_root/boot/memtest86*" %(self.build_dir,))
+        if len(memtest) > 0:
+            shutil.copy(memtest[0], "%s/out/isolinux/memtest" %(self.build_dir,))
+            bootcfg += """label memtest
+  menu label """ + _("Memory Test") + """
+  kernel memtest"""
+
+        finalcfg = cfg + bootcfg
+
+        cfgf = open("%s/out/isolinux/isolinux.cfg" %(self.build_dir,), "w")
+        cfgf.write(finalcfg)
+        cfgf.close()
+
+
+        ##### ORIGINAL CODE
+        #####
+        #####
+        #####
+        #####
         shutil.copyfile("%s/install_root/boot/vmlinuz-%s"
                         %(self.build_dir, self.get_kernel_version()),
                         "%s/out/isolinux/vmlinuz" %(self.build_dir,))
@@ -849,7 +1046,7 @@
                 syslinuxMenu=m
                 break
         if syslinuxMenu is None:
-            raise InstallationError("syslinux not installed : no suitable *menu.c32 found")
+            raise InstallationError(_("syslinux not installed : no suitable *menu.c32 found"))
 
         isXen = False
         xen = glob.glob("%s/install_root/boot/xen.gz-*" %(self.build_dir,))
@@ -861,7 +1058,7 @@
         for p in syslinuxfiles:
             path = "%s/install_root/usr/lib/syslinux/%s" % (self.build_dir, p)
             if not os.path.isfile(path):
-                raise InstallationError("syslinux not installed : %s not found" % path)
+                raise InstallationError(_("syslinux not installed : %s not found") % path)
 
             shutil.copy(path, "%s/out/isolinux/%s" % (self.build_dir, p))
 
@@ -930,7 +1127,7 @@
         try:
             self.configureSystem()
         except Exception, e: #FIXME: we should be a little bit more fine-grained
-            raise InstallationError("Error configuring live image: %s" %(e,))
+            raise InstallationError(_("Error configuring live image: %s") %(e,))
         self.configureNetwork()
         self.relabelSystem()
         if not self.skip_prelink:
@@ -952,7 +1149,7 @@
             subprocess.call(["/usr/lib/anaconda-runtime/implantisomd5",
                              "%s.iso" %(self.fs_label,)])
         else:
-            print >> sys.stderr, "anaconda-runtime not installed; not setting up mediacheck"
+            print >> sys.stderr, _("anaconda-runtime not installed; not setting up mediacheck")
 
     def createSquashFS(self):
         """create compressed squashfs file system"""
@@ -1005,7 +1202,7 @@
 
         os.close(FNULL)
 
-        print >> sys.stderr, "Installation target minimized to %dK" % (size_top * 4)
+        print >> sys.stderr, _("Installation target minimized to %dK") % (size_top * 4)
 
         # truncate the unused excess portion of the sparse file
         fd = os.open("%s/data/os.img" %(self.build_dir,), os.O_WRONLY )
@@ -1035,28 +1232,40 @@
                       [--uncompressed-size=<size-in-MB>]
                       [--ignore-deleted]
                       [--shell]
+                      [--builddir]
+                      [--installroot]
+                      [--yumcache]
+                      [--bootloader_timeout]
+                      [--bootloader_options]
+                      [--preferred_kernel]
                       [--tmpdir=<tmpdir>]
 
- --help              : Print usage and exit
- --config            : Path to kickstart config file
- --repo              : Add / override yum repository
- --package           : Include this package
- --exclude-package   : Exclude this package
- --base-on           : Add packages to an existing live CD iso9660 image
- --fslabel           : File system label (default: livecd-YYYYMMDD-HHMI)
- --skip-compression  : Don't compress the image
- --prelink           : Prelink the image
- --uncompressed-size : Size of uncompressed fs in MB (default: 4096)
- --ignore-deleted    : Don't run resize2fs to clean up wasted blocks
- --shell             : Start a shell in the chroot for post-configuration
- --tmpdir            : Temporary directory to use (default: /var/tmp)
+ --help              : """ + _("Print usage and exit") + """
+ --config            : """ + _("Path to kickstart config file") + """
+ --repo              : """ + _("Add / override yum repository") + """
+ --package           : """ + _("Include this package") + """
+ --exclude-package   : """ + _("Exclude this package") + """
+ --base-on           : """ + _("Add packages to an existing live CD iso9660 image") + """
+ --fslabel           : """ + _("File system label (default: livecd-YYYYMMDD-HHMI)") + """
+ --skip-compression  : """ + _("Don't compress the image") + """
+ --prelink           : """ + _("Prelink the image") + """
+ --uncompressed-size : """ + _("Size of uncompressed fs in MB (default: 4096)") + """
+ --ignore-deleted    : """ + _("Don't run resize2fs to clean up wasted blocks") + """
+ --builddir          : """ + _("Use this build directory") + """
+ --installroot       : """ + _("Use this directory as installroot") + """
+ --yumcache          : """ + _("Use this yum cache directory") + """
+ --bootloader_timeout: """ + _("Set the bootloader timeout (default: 3)") + """
+ --bootloader_options: """ + _("Set additional bootloader options") + """
+ --preferred_kernel  : """ + _("Set the preffered kernel (default: normal)") + """
+ --shell             : """ + _("Start a shell in the chroot for post-configuration") + """
+ --tmpdir            : """ + _("Temporary directory to use (default: /var/tmp)") + """
 
- Examples:
+ """ + _("Examples:") + """
 
-  Create minimal live cd:
+  """ + _("Create minimal live cd:") + """
   # livecd-creator --config=/usr/share/livecd-tools/livecd-fedora-minimal.ks
 
-  Create minimal live cd and use local package repositories:
+  """ + _("Create minimal live cd and use local package repositories:") + """
   # livecd-creator --config=/usr/share/livecd-tools/livecd-fedora-minimal.ks \\
                    --repo=a-dev,file:///home/user/core/RPMS             \\
                    --repo=a-extras-dev,file:///home/user/extras/RPMS
@@ -1080,15 +1289,25 @@
         self.uncompressed_size = 4096
         self.ignore_deleted = False
         self.give_shell = False
+        self.build_dir = None
+        self.install_root = None
+        self.yum_cache = None
+        self.bootloader_timeout = "3"
+        self.bootloader_options = ""
+        self.preferred_kernel = "normal"
+        self.bootloader_isolinux_extras = ""
         self.tmpdir = "/var/tmp"
 
 def parse_options(args):
     try:
-        opts, args = getopt.getopt(args, "hr:b:p:e:f:c:su:lt:",
+        opts, args = getopt.getopt(args, "hr:b:p:e:f:c:su:lt:bd:i:y:",
                                    ["help", "repo=", "base-on=", "package=",
                                     "exclude-package=", "fslabel=", "config=",
                                     "skip-compression", "uncompressed-size=",
                                     "ignore-deleted", "shell", "no-prelink",
+                                    "build_dir=", "install_root=", "yum_cache",
+                                    "bootloader_timeout", "bootloader_options",
+                                    "preferred_kernel",
                                     "prelink", "tmpdir="])
 
     except getopt.GetoptError, msg:
@@ -1120,13 +1339,13 @@
         if o in ("-c", "--config"):
             options.kscfg = a
             if not os.path.isfile(options.kscfg):
-                raise Usage("Kickstart config '%s' does not exist" % options.kscfg)
+                raise Usage(_("Kickstart config '%s' does not exist") % options.kscfg)
             continue
         if o in ("-r", "--repo"):
             (name, url) = a.split(",")
             for (n, u) in options.repos:
                 if n == name:
-                    raise Usage("Repo name '%s' is already in use" % n)
+                    raise Usage(_("Repo name '%s' is already in use") % n)
             options.repos.append((name, url))
             continue
         if o in ("-p", "--package"):
@@ -1141,23 +1360,41 @@
         if o in ("-f", "--fslabel"):
             options.fs_label = a
             if len(options.fs_label) > 32:
-                raise Usage("CD labels are limited to 32 characters")
+                raise Usage(_("CD labels are limited to 32 characters"))
             continue
         if o in ("-b", "--base-on"):
             options.base_on = a
             if not os.path.isfile(options.base_on):
-                raise Usage("Live CD ISO '%s' does not exist" % options.base_on)
+                raise Usage(_("Live CD ISO '%s' does not exist") % options.base_on)
             continue
         if o in ("-t", "--tmpdir"):
             options.tmpdir = a
             continue
-        raise Usage("Unknown option %s" % o)
+        if o in ("-bd", "--builddir"):
+            options.build_dir = a
+            continue
+        if o in ("-i", "--installroot"):
+            options.install_root = a
+            continue
+        if o in ("-y", "--yumcache"):
+            options.yum_cache = a
+            continue
+        if o in ("--bootloader_timeout"):
+            options.bootloader_timeout = str(int(a))
+            continue
+        if o in ("--bootloader_options"):
+            options.bootloader_options = a
+            continue
+        if o in ("--preferred_kernel"):
+            options.preferred_kernel = a
+            continue
+        raise Usage(_("Unknown option %s") % o)
 
     if not options.kscfg and not (options.packages or options.groups):
-        raise Usage("No packages or groups specified")
+        raise Usage(_("No packages or groups specified"))
 
     if not options.kscfg and not options.repos:
-        raise Usage("No repositories specified")
+        raise Usage(_("No repositories specified"))
 
     return options
 
@@ -1177,7 +1414,7 @@
         return ret
 
     if os.geteuid () != 0:
-        print >> sys.stderr, "You must run livecd-creator as root"
+        print >> sys.stderr, _("You must run livecd-creator as root")
         return 1
 
     target = InstallationTarget(options.repos,
@@ -1187,17 +1424,21 @@
                                 options.fs_label,
                                 options.skip_compression,
                                 options.skip_prelink,
-                                options.tmpdir)
+                                options.tmpdir,
+                                options.bootloader_timeout,
+                                options.bootloader_options,
+                                options.preferred_kernel,
+                                options.bootloader_isolinux_extras)
 
     try:
         target.parse(options.kscfg)
 
-        target.setup(options.uncompressed_size, options.base_on)
+        target.setup(options.uncompressed_size, options.base_on, build_dir=options.build_dir, yum_installroot=options.install_root, yum_cachedir=options.yum_cache)
 
         target.install()
 
         if options.give_shell:
-            print "Launching shell. Exit to continue."
+            print _("Launching shell. Exit to continue.")
             print "----------------------------------"
             target.launchShell()
 
@@ -1208,7 +1449,7 @@
 
         target.package()
     except InstallationError, e:
-        print >> sys.stderr, "Error creating Live CD : %s" % e
+        print >> sys.stderr, _("Error creating Live CD : %s") % e
         target.teardown()
         return 1
     target.teardown()
