Commits

Rodrigo Bistolfi committed 4a96fb0

Advanced/Live: install kernel image

Comments (0)

Files changed (1)

vinstall/controller/packages.py

         install_media = self.config["install_media"]
         if install_media.is_iso():
             if not os.path.exists(install_media.path):
-                print "mount container here"
-		mntpoint = install_media.path.rsplit("/", 1)[0]
-		dev = mntpoint.replace("/mnt", "/dev")
-            	utils.mount(dev, mntpoint)
+                mntpoint = install_media.path.rsplit("/", 1)[0]
+                dev = mntpoint.replace("/mnt", "/dev")
+                utils.mount(dev, mntpoint)
             utils.mountiso(install_media.path, mountpoint)
         else:
             utils.mount(install_media.path, mountpoint, filesystem="auto")
         """Install Linux image from a Live install media
         
         """
-        return NotImplemented
+        #XXX do not chdir without switching back to original working dir!
+        install_media = self.config["install_media"]
+        kernel_version = install_media.config.get("kernels", "sata")
+        kernel_version = kernel_version.replace("\"", "")
+        source = os.path.join('/mnt', 'SOURCE', 'boot', 'vmlinuz')
+        target = os.path.join('/mnt', 'TARGET', 'boot', 'vmlinuz-%s' % 
+                kernel_version)
+        shutil.copyfile(source, target)
+        for rc in ("rc.S", "rc.M", "rc.K", "rc.local"):
+            rcdir = os.path.join('/mnt', 'TARGET', 'etc', 'rc.d')
+            source = os.path.join('%s.real' % rc)
+            os.chdir(rcdir)
+            os.remove(rc)
+            os.symlink(source, rc)
 
+ 
     def preinstall(self):
         """Run before installing packages, used for creating needed dirs
 
         install_media = self.config["install_media"]
         if install_media.is_iso():
             if not os.path.exists(install_media.path):
-                print "mount container here"
-		mntpoint = install_media.path.rsplit("/", 1)[0]
-		dev = mntpoint.replace("/mnt", "/dev")
-            	utils.mount(dev, mntpoint)
+                mntpoint = install_media.path.rsplit("/", 1)[0]
+                dev = mntpoint.replace("/mnt", "/dev")
+                utils.mount(dev, mntpoint)
             utils.mountiso(install_media.path, mountpoint)
         else:
             utils.mount(install_media.path, mountpoint, filesystem="auto")