Eric Sandeen wrote:
> 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
> upstream, and it's in rawhide now.
>
> 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....
>
> Updated to address Radek's review, as well as adding the requisite
> witty (commandline-space-eating) boot option...
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> 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-12 15:17:08.444575320 -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")
For this line to work, libparted needs to grow a macro identifying the
btrfs type.
> + 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("icantbelieveitsnotbtr"):
> + 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-12 15:09:48.938995015 -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-12 15:09:50.187913261 -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:r aid10: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:r aid10: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-12 15:09:54.798574912 -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-12 15:12:19.850575024 -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
> @@ -341,6 +341,8 @@ lib/udev
> sbin/*gfs*
> sbin/arping
> sbin/badblocks
> +sbin/btrfsctl
> +sbin/btrfsck
> sbin/busybox.anaconda
> sbin/clock
> sbin/consoletype
> @@ -375,6 +377,7 @@ sbin/lvm*
> sbin/mdadm
> sbin/mkdosfs
> sbin/mke2fs
> +sbin/mkfs.btrfs
> sbin/mkfs.ext2
> sbin/mkfs.ext3
> sbin/mkfs.gfs2
The rest of it looks fine to me.
--
David Cantrell <dcantrell@redhat.com>
Red Hat / Honolulu, HI
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list