patch for live serssion booted from an .ext2 filesystem instead of a .squashfs filesystem

Henri MICHEL henri.j.michel at gmail.com
Wed Jul 9 20:28:59 BST 2008


Sorry I a new joiner, I am not sure how development team for ubiquity is 
organized csv ? svn ...
this time I send a patch file I will do my best to stick closely to your 
guidelines next time, promise.

    < henri

I was builting a customized live USB for gutsy with all the latest
patch installed in order to save me the annoyance of doing an apt-get
update every time I install a new machine with ubiquity

As I found recreating a .squashfs from an .ext2 was quite a long
process on my machine (750 MHZ thinkpad laptop) I tried to boot casper
from an .ext2 instead of a .squashfs. The disk space saving is not
worth the time It takes to build the .squashfs, and my USB stick is 4G
so an .ext2 fits in)

Meanwhile I found a few bugs in ubiquity which prevent using this
approach, hence a few corrections I am proposing in my patch to
ubiquity 1.8.7 (the one in Hardy live CD): file 
/usr/share/ubiquity/install.py

Note: Though this patch was absolutely necessary in gutsy. I found that
in hardy, casper now makes /rofs visible and ubiquity does not need to setup
/var/lib/ubiquity/source itself. I'm happy that ubiquity does not depend
on those hairy heuristics anymore.
let's leave the dirty hacks, hard-wired policy to casper not ubiquity !!!

Comments on my corrections
========================================================================
1) at the beginning of method mount_one_image() in class InstallStepError
   original said:

<         if os.path.splitext(fsfile)[1] == '.cloop':
<             blockdev_prefix = 'cloop'
<         elif os.path.splitext(fsfile)[1] == '.squashfs':
<             blockdev_prefix = 'loop'
--- replacement ----
 >         if os.path.splitext(fsfile)[1] == '.cloop':
 >             blockdev_prefix = 'cloop'
 >         else:
 >             blockdev_prefix = 'loop'

I think the dev should always be a loop with the *only* exception
of a cloop
what do you think about this assertion?
========================================================================
2) after opening process udevadm info, (or udevinfo if udevadm not 
available):
                    devbase = udevinfo.communicate()[0]
   lacks :
 >                     devbase = devbase.rstrip("\n");

   I still don't understand how it could possibly work without chopping
   <newline> at the end of the string!!
========================================================================
3) obvious addition:
<             # Manual detection on non-unionfs systems
<             fsfiles = ['/cdrom/casper/filesystem.cloop',
<                        '/cdrom/casper/filesystem.squashfs',
<                        '/cdrom/META/META.squashfs']
--- replacement ----
 >             # Manual detection on non-unionfs systems
 >             fsfiles = ['/cdrom/casper/filesystem.cloop',
 >                        '/cdrom/casper/filesystem.squashfs',
 >                        '/cdrom/casper/filesystem.ext3',
 >                        '/cdrom/casper/filesystem.ext2',
 >                        '/cdrom/META/META.squashfs']
   The only non trivial thing to say about this is: why is this 
hardwired list
   different from the hardwired list in casper:
< get_backing_device() {
<     case "$1" in
<         *.squashfs|*.ext2)
<             echo $(setup_loop "$1" "loop" "/sys/block/loop*")
<             ;;
<         *.dir)
<             echo "directory"
<             ;;
<         *)
<             panic "Unrecognized casper filesystem: $1"
<             ;;
<     esac
< }

How could /cdrom/casper/filesystem.cloop and /cdrom/META/META.squashfs
possibly happen ??
Anyway I found those hardwired, impossible to modify, paths
particularly disgusting
========================================================================
4) case of several candidates as a Read-only filesystem:
<             for fsfile in fsfiles:
<                 if fsfile != '' and os.path.isfile(fsfile):
<                     dev, mountpoint = self.mount_one_image(fsfile, 
self.source)
<                     self.devs.append(dev)
<                     self.mountpoints.append(mountpoint)
--- replacement ----
 >             for fsfile in fsfiles:
 >                 if os.path.isfile(fsfile):
 >                     dev, mountpoint = self.mount_one_image(fsfile, 
self.source)
 >                     self.devs.append(dev)
 >                     self.mountpoints.append(mountpoint)
 >                     break

Because:
  1) fsfile can never be an empty string so the test is useless and
  2) I guess it's a better behaviour to use filesystem.squashfs when both
     filesystem.squashfs and filesystem.ext2 exist, it avoids mounting
     several filesystems on the same mount point anyway.

5) Obvious bad bugs (missing else:) and typos (fsfile instead of fs_preseed)
<         elif len(fs_preseed.split()) == 1:
<             # Just one preseeded image.
<             if not os.path.isfile(fs_preseed):
<                 raise InstallStepError(
<                     "Preseeded filesystem image %s not found" % 
fs_preseed)
<
<                 dev, mountpoint = self.mount_one_image(fsfile, 
self.source)
<                 self.devs.append(dev)
<                 self.mountpoints.append(mountpoint)
<         else:
<             # OK, so we need to mount multiple images and unionfs them
<             # together.
<             for fsfile in fs_preseed.split():
<                 if not os.path.isfile(fsfile):
<                     raise InstallStepError(
<                         "Preseeded filesystem image %s not found" % 
fsfile)
<
<                 dev, mountpoint = self.mount_one_image(fsfile)
<                 self.devs.append(dev)
<                 self.mountpoints.append(mountpoint)
--- replacement ----
 >         elif len(fs_preseed.split()) == 1:
 >             # Just one preseeded image.
 >             if not os.path.isfile(fs_preseed):
 >                 raise InstallStepError(
 >                     "Preseeded filesystem image %s not found" % 
fs_preseed)
 >             else:
 >                 dev, mountpoint = self.mount_one_image(fs_preseed, 
self.source)
 >                 self.devs.append(dev)
 >                 self.mountpoints.append(mountpoint)
 >         else:
 >             # OK, so we need to mount multiple images and unionfs them
 >             # together.
 >             for fsfile in fs_preseed.split():
 >                 if not os.path.isfile(fsfile):
 >                     raise InstallStepError(
 >                         "Preseeded filesystem image %s not found" % 
fsfile)
 >                 else:
 >                     dev, mountpoint = self.mount_one_image(fsfile)
 >                     self.devs.append(dev)
 >                     self.mountpoints.append(mountpoint)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: filesystem_ext2.patch
Type: text/x-patch
Size: 4529 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/ubuntu-installer/attachments/20080709/1f12ce25/attachment.bin 


More information about the Ubuntu-installer mailing list