[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Fedora-livecd-list] [Patch] specify custom directories



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Attached is a patch to customize the build_dir, yum cachedir and yum
installroot.

Hope you find it usefull.

Kind regards,

Jeroen van Meeuwen
- -kanarip
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGI5biKN6f2pNCvwgRAs0fAJ9yOMmYVobrSejxMG+KbwVDKzC6OgCgkqTw
HpfvOja4CKtUfA1psUWfM+s=
=ibd4
-----END PGP SIGNATURE-----
--- livecd/creator/livecd-creator.orig	2007-04-16 17:27:53.000000000 +0200
+++ livecd/creator/livecd-creator	2007-04-16 17:21:53.000000000 +0200
@@ -361,20 +361,33 @@
         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="/var/tmp", prefix="livecd-creator-")
-        except OSError, (err, msg):
-            raise InstallationError("Failed create build directory in /var/tmp: %s" % 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")
+
+        if not yum_installroot:
+            os.makedirs(self.build_dir + "/install_root")
+        else:
+            os.symlink(yum_installroot,self.build_dir + "/install_root")
+
+        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
@@ -405,10 +418,12 @@
 
         # 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"))
+
         for b in self.bindmounts:
             b.mount()
 
@@ -745,6 +760,9 @@
                       [--skip-compression]
                       [--uncompressed-size=<size-in-MB>]
                       [--shell]
+                      [--builddir]
+                      [--yumcache]
+                      [--installroot]
 
  --help              : Print usage and exit
  --config            : Path to kickstart config file
@@ -756,6 +774,9 @@
  --skip-compression  : Don't compress the image
  --uncompressed-size : Size of uncompressed fs in MB (default: 3072)
  --shell             : Start a shell in the chroot for post-configuration
+ --builddir          : Use this build directory
+ --yumcache          : Use this yum cache directory
+ --installroot       : Use this directory as installroot
 
  Examples:
 
@@ -785,14 +806,17 @@
         self.skip_prelink = False
         self.uncompressed_size = 3072
         self.give_shell = False
+        self.build_dir = None
+        self.yum_cache = None
+        self.install_root = None
 
 def parse_options(args):
     try:
-        opts, args = getopt.getopt(args, "hr:b:p:e:f:c:su:l",
+        opts, args = getopt.getopt(args, "hr:b:p:e:f:c:su:l:bd:y:i",
                                    ["help", "repo=", "base-on=", "package=",
                                     "exclude-package=", "fslabel=", "config=",
                                     "skip-compression", "uncompressed-size=",
-                                    "shell", "no-prelink"])
+                                    "shell", "no-prelink", "build_dir","yum_cache","install_root"])
     except getopt.GetoptError, msg:
         raise Usage(msg)
 
@@ -844,6 +868,15 @@
             if not os.path.isfile(options.base_on):
                 raise Usage("Live CD ISO '%s' does not exist" % options.base_on)
             continue
+        if o in ("-bd", "--builddir"):
+            options.build_dir = a
+            continue
+        if o in ("-y", "--yumcache"):
+            options.yum_cache = a
+            continue
+        if o in ("-i", "--installroot"):
+            options.install_root = a
+            continue
         raise Usage("Unknown option %s" % o)
 
     if not options.kscfg and not (options.packages or options.groups):
@@ -884,7 +917,7 @@
     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_cachedir=options.yum_cache, yum_installroot=options.install_root)
 
         target.install()
 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]