Rodrigo Bistolfi avatar 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")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.