[PATCH] btrfs install support

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

 



Now that btrfs is in mainline, let's let anaconda play with
it too ;)  We still need btrfs.ko in the kernel, and btrfs
support in e2fsprogs.  I've got the latter patch submitted and
will just pull it into rawhide if upstream doesn't merge it soon.

Note that the below is 100% totally untested and may even have
typos, my track record with python is not too good, sorry.  :)
So review would be appreciated....

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---

Index: anaconda-11.5.0.5/fsset.py
===================================================================
--- anaconda-11.5.0.5.orig/fsset.py	2009-01-08 16:09:53.029637743 -0600
+++ anaconda-11.5.0.5/fsset.py	2009-01-08 16:26:16.128575694 -0600
@@ -731,6 +731,72 @@ class ext4FileSystem(extFileSystem):
 
 fileSystemTypeRegister(ext4FileSystem())
 
+class btrfsFileSystem(FileSystemType):
+    def __init__(self):
+        FileSystemType.__init__(self)
+        self.partedFileSystemType = parted.file_system_type_get("btrfs")
+        self.formattable = 1
+        self.checked = 1
+        self.linuxnativefs = 1
+        self.bootable = False
+        self.maxLabelChars = 256
+        # Wow, you must be brave!
+        # this is totally, 100% unsupported.  Boot with "linux btrfs"
+        # at the boot: prompt will let you make new btrfs filesystems
+        # in the installer.
+        if flags.cmdline.has_key("btrfs"):
+            self.supported = -1
+        else:
+            self.supported = 0
+
+        self.name = "btrfs"
+        self.packages = [ "btrfs-progs" ]
+        self.needProgram = [ "mkfs.btrfs", "btrfsctl" ]
+
+	# Bigger, really, depending on machine
+        self.maxSizeMB = 16 * 1024 * 1024
+
+    # We'll sneakily label it here, too.
+    def formatDevice(self, entry, progress, chroot='/'):
+        devicePath = entry.device.setupDevice(chroot)
+        label = self.createLabel(entry.mountpoint, self.maxLabelChars,
+                                 kslabel = entry.label)
+
+        rc = iutil.execWithRedirect("mkfs.btrfs",
+				    ["-L", label, devicePath,
+                                    stdout = "/dev/tty5",
+                                    stderr = "/dev/tty5", searchPath = 1)
+
+        if rc:
+            raise SystemError
+        entry.setLabel(label)
+    def labelDevice(self, entry, chroot):
+        # We did this on the initial format; no standalone labeler yet
+        pass
+
+    def resize(self, entry, size, progress, chroot='/'):
+        devicePath = entry.device.setupDevice(chroot)
+        log.info("resizing %s" %(devicePath,))
+
+        w = None
+        if progress:
+            w = progress(_("Resizing"),
+                         _("Resizing filesystem on %s...") %(devicePath),
+                         100, pulse = True)
+
+        rc = iutil.execWithPulseProgress("btrfsctl",
+                                         ["-r", "%sM" %(size,), devicePath],
+                                         stdout="/tmp/resize.out",
+                                         stderr="/tmp/resize.out",
+                                         progress = w)
+        if progress:
+            w.pop()
+        if rc:
+            raise ResizeError, ("Resize of %s failed: %s" %(devicePath, rc), devicePath)
+
+
+fileSystemTypeRegister(btrfsFileSystem())
+
 class raidMemberDummyFileSystem(FileSystemType):
     def __init__(self):
         FileSystemType.__init__(self)
Index: anaconda-11.5.0.5/liveinst/liveinst.sh
===================================================================
--- anaconda-11.5.0.5.orig/liveinst/liveinst.sh	2009-01-08 12:47:59.000000000 -0600
+++ anaconda-11.5.0.5/liveinst/liveinst.sh	2009-01-08 16:13:02.253574832 -0600
@@ -32,7 +32,7 @@ if [ ! -b $LIVE_BLOCK ]; then
 fi
 
 # load modules that would get loaded by the loader... (#230945)
-for i in raid0 raid1 raid5 raid6 raid456 raid10 fat msdos gfs2 reiserfs ext2 ext3 jfs xfs dm-mod dm-zero dm-mirror dm-snapshot dm-multipath dm-round-robin vfat ; do /sbin/modprobe $i ; done
+for i in raid0 raid1 raid5 raid6 raid456 raid10 fat msdos gfs2 reiserfs ext2 ext3 jfs xfs btrfs dm-mod dm-zero dm-mirror dm-snapshot dm-multipath dm-round-robin vfat ; do /sbin/modprobe $i ; done
 
 export ANACONDA_PRODUCTNAME=$( cat /etc/system-release | cut -d ' ' -f 1 )
 export ANACONDA_PRODUCTVERSION=$( cat /etc/system-release | sed -r -e 's/^.*([0-9]+) *\(.*$/\1/' )
Index: anaconda-11.5.0.5/loader/loader.c
===================================================================
--- anaconda-11.5.0.5.orig/loader/loader.c	2009-01-08 12:47:59.000000000 -0600
+++ anaconda-11.5.0.5/loader/loader.c	2009-01-08 16:13:45.730575402 -0600
@@ -2044,7 +2044,7 @@ int main(int argc, char ** argv) {
     stop_fw_loader(&loaderData);
     start_fw_loader(&loaderData);
 
-    mlLoadModuleSet("raid0:raid1:raid5:raid6:raid456:raid10:linear:fat:msdos:gfs2:reiserfs:jfs:xfs:dm-mod:dm-zero:dm-mirror:dm-snapshot:dm-multipath:dm-round-robin:dm-crypt:cbc:sha256:lrw:xts");
+    mlLoadModuleSet("raid0:raid1:raid5:raid6:raid456:raid10:linear:fat:msdos:gfs2:reiserfs:jfs:xfs:btrfs:dm-mod:dm-zero:dm-mirror:dm-snapshot:dm-multipath:dm-round-robin:dm-crypt:cbc:sha256:lrw:xts");
 
     if (!access("/mnt/runtime/usr/lib/libunicode-lite.so.1", R_OK))
         setenv("LD_PRELOAD", "/mnt/runtime/usr/lib/libunicode-lite.so.1", 1);
Index: anaconda-11.5.0.5/scripts/mk-images
===================================================================
--- anaconda-11.5.0.5.orig/scripts/mk-images	2009-01-08 12:47:59.000000000 -0600
+++ anaconda-11.5.0.5/scripts/mk-images	2009-01-08 16:13:56.141820641 -0600
@@ -112,7 +112,7 @@ FIREWIREMODS="ohci1394 sbp2 fw-ohci fw-s
 SDMODS="mmc-block sdhci sdhci-pci"
 IDEMODS="ide-cd ide-cd_mod"
 SCSIMODS="sr_mod sg st sd_mod scsi_mod iscsi_tcp iscsi_ibft"
-FSMODS="fat msdos vfat ext2 ext3 ext4 reiserfs jfs xfs gfs2 cifs"
+FSMODS="fat msdos vfat ext2 ext3 ext4 reiserfs jfs xfs gfs2 cifs btrfs"
 LVMMODS="dm-mod dm-zero dm-snapshot dm-mirror dm-multipath dm-round-robin dm-crypt"
 RAIDMODS="raid0 raid1 raid5 raid6 raid456 raid10 linear"
 CRYPTOMODS="sha256_generic cbc xts lrw aes_generic crypto_blkcipher crc32c ecb arc4"
Index: anaconda-11.5.0.5/scripts/upd-instroot
===================================================================
--- anaconda-11.5.0.5.orig/scripts/upd-instroot	2009-01-08 12:47:59.000000000 -0600
+++ anaconda-11.5.0.5/scripts/upd-instroot	2009-01-08 16:15:17.316576435 -0600
@@ -150,7 +150,7 @@ die () {
 
 PACKAGES="GConf2 NetworkManager ORBit2 PolicyKit VLGothic-fonts acl anaconda
 	anaconda-yum-plugins at-spi atk attr audit-libs bash bitmap-fonts-cjk
-	booty busybox-anaconda bzip2 bzip2-libs cairo cjkunifonts-uming
+	booty btrfs-progs busybox-anaconda bzip2 bzip2-libs cairo cjkunifonts-uming
 	comps-extras coreutils cpio cracklib cracklib-dicts cracklib-python
 	cryptsetup-luks db4 dbus dbus-python dejavu-fonts device-mapper
 	device-mapper-libs dhclient dhcpv6-client dmapi dmraid dmraid-libs

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux