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

XFS and Anaconda



Hello 
I have been hacking away ata anaconda ever since FC1 got released and I have 
come up with theses patches to get XFS support going in the installer. Please 
take a look at hem and let me know if this is the right way to go.

I have broken down the patches into 3, one adds and enables XFS 
(anaconda-xfs.patch), another extends the existing support in anaconda for 
other FS's (anaconda-xfs-label.patch), The last one (booty-grub-slow.patch) 
modifies booty so that it waits for XFS to finish the sync before doing 
anything more, without this tall previous XFS installers would hang at the 
"installing bootloader" stage,

Please look over this and see if it can be added to the FC anaconda for FC2.

Thanks
Ajay
diff -Naur booty-0.31.1/bootloaderInfo.py booty-0.31.1-patched/bootloaderInfo.py
--- booty-0.31.1/bootloaderInfo.py	2003-08-16 02:20:35.000000000 +0530
+++ booty-0.31.1-patched/bootloaderInfo.py	2003-11-08 13:38:40.000000000 +0530
@@ -796,9 +796,11 @@
             
 
         # FIXME: hack to try to make sure everything is written to the disk
-        import isys
+        import isys, time
         isys.sync()
+	time.sleep(30)
         isys.sync()
+	time.sleep(30)
         isys.sync()
 
 	part = self.grubbyPartitionName(bootDev)
@@ -819,9 +821,11 @@
 
 
             # FIXME: hack to try to make sure everything is written to the disk
-            import isys
+            import isys, time
             isys.sync()
+	    time.sleep(30)
             isys.sync()
+	    time.sleep(30)
             isys.sync()
 
             # really install the bootloader
@@ -1023,9 +1027,11 @@
                                     root = instRoot)
 
             # get the stage files synced to disk
-            import isys
+            import isys, time
             isys.sync()
+	    time.sleep(30)
             isys.sync()
+	    time.sleep(30)
             isys.sync()            
             
             # really install the bootloader
diff -Naur anaconda-9.2/fsset.py anaconda-9.2-patched/fsset.py
--- anaconda-9.2/fsset.py	2003-10-21 04:38:12.000000000 +0530
+++ anaconda-9.2-patched/fsset.py	2003-11-06 17:46:00.000000000 +0530
@@ -1335,7 +1335,7 @@
             if not entry.mountpoint or entry.mountpoint == "swap":
                 continue
             try:
-                label = isys.readExt2Label(dev)
+                label = isys.readFSLabel(dev)
             except:
                 continue
             if label:
@@ -1644,7 +1644,7 @@
 
     def getLabel(self):
         try:
-            return isys.readExt2Label(self.setupDevice(), makeDevNode = 0)
+            return isys.readFSLabel(self.setupDevice(), makeDevNode = 0)
         except:
             return ""
 
@@ -2213,6 +2213,23 @@
     os.close(fd)
     return 0    
 
+def isValidJFS(device):
+    fd = getDevFD(device)
+    if fd == -1:
+        return 0
+
+    try:
+        os.lseek(fd, 32768, 0)
+        buf = os.read(fd, 128)
+    except:
+        buf = ""
+
+    if (buf[0:4] == "JFS1"):
+        os.close(fd)
+	return 1
+
+    os.close(fd)
+    return 0    
 
 # this will return a list of types of filesystems which device
 # looks like it could be to try mounting as
@@ -2225,6 +2242,9 @@
     if isValidReiserFS(device):
         rc.append("reiserfs")
 
+    if isValidJFS(device):
+        rc.append("jfs")
+
     if isValidExt2(device):
         if os.access(device, os.O_RDONLY):
             create = 0
diff -Naur anaconda-9.2/isys/isys.py anaconda-9.2-patched/isys/isys.py
--- anaconda-9.2/isys/isys.py	2003-10-17 05:08:19.000000000 +0530
+++ anaconda-9.2-patched/isys/isys.py	2003-11-07 07:11:35.000000000 +0530
@@ -473,6 +473,32 @@
     # otherwise
     return _isys.pumpnetdevice(device)
 
+def readXFSLabel_int(device):
+    try:
+        fd = os.open(device, os.O_RDONLY)
+    except:
+        return None
+
+    buf = os.read(fd, 128)
+    os.close(fd)
+
+    if len(buf) != 128:
+        xfslabel = None
+
+    if buf[0:4] == "XFSB":
+        xfslabel = string.rstrip(buf[108:120],"\0x00")
+
+    return xfslabel
+    
+def readXFSLabel(device, makeDevNode = 1):
+    if makeDevNode:
+        makeDevInode(device, "/tmp/disk")
+	label = readXFSLabel_int("/tmp/disk")
+	os.unlink("/tmp/disk")
+    else:
+        label = readXFSLabel_int(device)
+    return label
+
 def readExt2Label(device, makeDevNode = 1):
     if makeDevNode:
         makeDevInode(device, "/tmp/disk")
@@ -482,6 +508,21 @@
         label = _isys.e2fslabel(device)
     return label
 
+def readFSLabel(device, makeDevNode = 1):
+    label = readXFSLabel(device, makeDevNode)
+    if (label == None):
+        label = readExt2Label(device, makeDevNode)
+    return label
+	
+#def readFSLabel(device, makeDevNode = 1):
+#    fstype = partedUtils.sniffFilesystemType(device)
+#    if (fstype == "ext2" or fstype == "ext3")
+#        return readExt2Label(device, makeDevNode)
+#    elif (fstype == "xfs"):
+#        return readXFSLabel(device, makeDevNode)
+#    else:
+#        return ""
+
 def ext2IsDirty(device):
     makeDevInode(device, "/tmp/disk")
     label = _isys.e2dirty("/tmp/disk");
diff -Naur anaconda-9.2/partedUtils.py anaconda-9.2-patched/partedUtils.py
--- anaconda-9.2/partedUtils.py	2003-10-14 04:20:10.000000000 +0530
+++ anaconda-9.2-patched/partedUtils.py	2003-11-06 17:50:56.000000000 +0530
@@ -421,6 +421,9 @@
     if fsset.isValidReiserFS(dev):
         return "reiserfs"
 
+    if fsset.isValidJFS(dev):
+        return "jfs"
+
     # FIXME:  we don't look for jfs, or vfat
 
     return None
@@ -530,16 +533,17 @@
                                       or part.get_flag(parted.PARTITION_LVM))
                                  and part.fs_type
                                  and (part.fs_type.name == "ext2"
-                                      or part.fs_type.name == "ext3"))
+                                      or part.fs_type.name == "ext3"
+                                      or part.fs_type.name == "xfs"))
             parts = filter_partitions(disk, func)
             for part in parts:
                 node = get_partition_name(part)
-                label = isys.readExt2Label(node)
+                label = isys.readFSLabel(node)
                 if label:
                     labels[node] = label
 
         for dev, devices, level, numActive in DiskSet.mdList:
-            label = isys.readExt2Label(dev)
+            label = isys.readFSLabel(dev)
             if label:
                 labels[dev] = label
 
diff -Naur anaconda-9.2/loader2/hdinstall.c anaconda-9.2-patched/loader2/hdinstall.c
--- anaconda-9.2/loader2/hdinstall.c	2003-10-15 01:06:32.000000000 +0530
+++ anaconda-9.2-patched/loader2/hdinstall.c	2003-11-07 18:01:19.000000000 +0530
@@ -315,7 +315,7 @@
     char * url;
     char filespec[1024];
     char * path;
-    char *typetry[] = {"ext2", "vfat", NULL};
+    char *typetry[] = {"ext2", "xfs", "jfs", "reiserfs", "vfat", NULL};
     char **type;
 
     logMessage("mounting device %s for hard drive install", device);
--- anaconda-9.0.96/scripts/upd-instroot.orig	2003-10-08 01:33:15.000000000 +0530
+++ anaconda-9.0.96/scripts/upd-instroot	2003-10-23 20:23:25.000000000 +0530
@@ -110,7 +110,8 @@
 	 bzip2-libs dosfstools pciutils reiserfs-utils parted sed
 	 busybox-anaconda rpm-python booty hdparm lvm beecrypt
 	 rhpl pyxf86config libxml2 libxml2-python glib2
-	 elfutils-libelf bogl-bterm bogl krb5-libs convertdb1 jfsutils"
+	 elfutils-libelf bogl-bterm bogl krb5-libs convertdb1 jfsutils
+ 	 xfsprogs xfsdump dmapi libacl libattr attr acl"
 
 if [ $ARCH = i386 -o $ARCH = x86_64 ]; then
     PACKAGES="$PACKAGES kernel-pcmcia-cs kernel-utils"
@@ -156,7 +157,8 @@
            redhat-config-keyboard Xft fontconfig redhat-artwork
            ttfonts-ja ttfonts-zh_TW bitmap-fonts-cjk urw-fonts 
            comps-extras XFree86-libs-data convertdb1
-           vnc-server libjpeg tcp_wrappers redhat-config-date"
+           vnc-server libjpeg tcp_wrappers redhat-config-date
+           xfsprogs xfsdump dmapi libacl libattr attr acl"
 
 #
 # stuff ONLY included for rescue mode
@@ -239,6 +241,9 @@
 $LIBDIR/librt[-.]*
 $LIBDIR/libss*
 $LIBDIR/libtermcap*
+$LIBDIR/libhandle*
+$LIBDIR/libattr*
+$LIBDIR/libdm*
 $LIBDIR/libutil*
 $LIBDIR/libuuid*
 sbin/badblocks
@@ -250,6 +255,8 @@
 sbin/e2label
 sbin/fsck.ext2
 sbin/fsck.ext3
+sbin/fsck.jfs
+sbin/fsck.xfs
 sbin/fdisk
 sbin/hdparm
 sbin/hwclock
@@ -273,6 +280,7 @@
 sbin/mkfs.ext2
 sbin/mkfs.ext3
 sbin/mkfs.jfs
+sbin/mkfs.xfs
 sbin/mkfs.msdos
 sbin/mkfs.vfat
 sbin/mkreiserfs
@@ -290,6 +298,12 @@
 sbin/resize2fs
 sbin/sfdisk
 sbin/tune2fs
+sbin/xfsdump
+sbin/xfsrestore
+sbin/xfs_repair
+usr/sbin/xfs_db
+usr/sbin/xfs_check
+usr/sbin/xfs_copy
 sbin/vgcfgbackup
 sbin/vgcfgrestore
 sbin/vgchange
--- anaconda-9.0.96/scripts/mk-images.i386.orig	2003-10-15 00:28:28.000000000 +0530
+++ anaconda-9.0.96/scripts/mk-images.i386	2003-10-23 20:15:27.000000000 +0530
@@ -92,7 +92,7 @@
 IDEMODS="ide-cd"
 SCSIMODS="sd_mod sg sr_mod st"
 
-FSMODS="msdos vfat ext3 reiserfs jfs"
+FSMODS="msdos vfat ext3 reiserfs jfs xfs"
 SECSTAGE="agpgart md raid0 raid1 raid5 lvm-mod $FSMODS $IDEMODS $SCSIMODS $LATEUSBMODS st parport_pc parport"
 
 BTERMMODULES="vga16fb"
--- anaconda-9.0.96/fsset.py.orig	2003-10-21 04:38:12.000000000 +0530
+++ anaconda-9.0.96/fsset.py	2003-10-23 20:13:19.000000000 +0530
@@ -51,12 +51,14 @@
 availRaidLevels = ['RAID0', 'RAID1', 'RAID5']
 
 def fileSystemTypeGetDefault():
-    if fileSystemTypeGet('ext3').isSupported():
+    if fileSystemTypeGet('xfs').isSupported():
+        return fileSystemTypeGet('xfs')
+    elif fileSystemTypeGet('ext3').isSupported():
         return fileSystemTypeGet('ext3')
     elif fileSystemTypeGet('ext2').isSupported():
         return fileSystemTypeGet('ext2')
     else:
-        raise ValueError, "You have neither ext3 or ext2 support in your kernel!"
+        raise ValueError, "You have neither xfs, ext3 or ext2 support in your kernel!"
 
 
 def fileSystemTypeGet(key):
@@ -397,9 +399,7 @@
         self.name = "xfs"
         self.maxSizeMB = 1024 * 1024
         self.maxLabelChars = 12
-        # we don't even have the module, so it won't be mountable... but
-        # just in case
-        self.supported = 0
+        self.supported = 1
         
     def formatDevice(self, entry, progress, chroot='/'):
         devicePath = entry.device.setupDevice(chroot)
--- anaconda-9.2/scripts/buildinstall.orig	2003-10-15 01:06:32.000000000 +0530
+++ anaconda-9.2/scripts/buildinstall	2003-11-07 16:10:43.000000000 +0530
@@ -122,7 +122,7 @@
 if [ -x /usr/bin/runroot ]; then
     runroot $COMPNAME --onlyone --arch $BUILDARCH "$BUILDINSTALL --buildinstdir $BUILDINSTDIR --second $PKGORDERSTR --comp $COMPNAME --version $VERSION --release '\"$RELEASESTR\"' --product '\"$PRODUCTSTR\"' --prodpath $PRODUCTPATH $DIR" 
 else
-    $BUILDINSTALL --buildinstdir $BUILDINSTDIR --second $PKGORDERSTR --comp $COMPNAME --version $VERSION --release \"$RELEASESTR\" --product \"$PRODUCTSTR\" --prodpath $PRODUCTPATH $DIR
+    $BUILDINSTALL --buildinstdir $BUILDINSTDIR --second $PKGORDERSTR --comp $COMPNAME --version $VERSION --release "$RELEASESTR" --product "$PRODUCTSTR" --prodpath $PRODUCTPATH $DIR
 fi
 
 rm -rf $BUILDINSTDIR

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