← Back to team overview

usb-creator-hackers team mailing list archive

[Merge] lp:~mathieu-tl/usb-creator/squashfs-places into lp:usb-creator

 

Mathieu Trudel-Lapierre has proposed merging lp:~mathieu-tl/usb-creator/squashfs-places into lp:usb-creator.

Requested reviews:
  usb-creator hackers (usb-creator-hackers)
Related bugs:
  Bug #1117292 in debian-installer (Ubuntu): "'Unable to install busybox-initramfs' during a server installation"
  https://bugs.launchpad.net/ubuntu/+source/debian-installer/+bug/1117292

For more details, see:
https://code.launchpad.net/~mathieu-tl/usb-creator/squashfs-places/+merge/257829

Handle the squashfs locations: erase any "old" locations which would interfere with the image we're trying to copy to disk.
-- 
Your team usb-creator hackers is requested to review the proposed merge of lp:~mathieu-tl/usb-creator/squashfs-places into lp:usb-creator.
=== modified file 'debian/changelog'
--- debian/changelog	2015-04-23 15:19:07 +0000
+++ debian/changelog	2015-04-29 21:36:09 +0000
@@ -11,6 +11,12 @@
       proper polkit integration for KVM use.
     - CVE number pending
 
+  [ Mathieu Trudel-Lapierre ]
+  * usbcreator/install.py: remove the directories known to normally contain
+    a squashfs; since it could be confusing the installer if, for example, a
+    squashfs from desktop is still under casper/ after copying server files
+    to a USB key. (LP: #1117292)
+
  -- Marc Deslauriers <marc.deslauriers@xxxxxxxxxx>  Thu, 23 Apr 2015 11:18:01 -0400
 
 usb-creator (0.2.67) vivid; urgency=medium

=== modified file 'usbcreator/install.py'
--- usbcreator/install.py	2015-03-10 15:24:32 +0000
+++ usbcreator/install.py	2015-04-29 21:36:09 +0000
@@ -185,6 +185,15 @@
         self.progress_thread.start()
         self.check()
     
+    def remove_squashfs(self):
+        logging.debug('remove_squashfs')
+        '''Remove squashfs files which may conflict.'''
+        squashfs_places = [ "install", "casper", "live" ]
+        for place in squashfs_places:
+            squashfs_place = os.path.join(self.target, place)
+            if os.path.exists(squashfs_place):
+                shutil.rmtree(squashfs_place)
+
     def remove_extras(self):
         logging.debug('remove_extras')
         '''Remove files created by usb-creator.'''
@@ -499,6 +508,7 @@
                     logging.debug('Removing %s' % t)
                     shutil.rmtree(t)
         self.check()
+        self.remove_squashfs()
         self.remove_extras()
         
         self.initialize_progress_thread()
@@ -617,6 +627,7 @@
                 elif os.path.isdir(f):
                     logging.debug('Removing %s' % f)
                     shutil.rmtree(f)
+        self.remove_squashfs()
         self.remove_extras()
         self.check()