Hi,

Here is a patch to setup_harddisk that enable the use of ext3 easily :
If you don't specify the type of partition, you'll have auto in the fstab.

In the disk_config, just add the -j option after the semi-colon to format
with ext3. Add ext3 if you want the keyword ext3 be in fstab in place of
auto.

If you don't put the -j flag, you'll have ext2 partitions, but you'll need
to give the ext2 option to have the ext2 keyword in fstab in place of
auto.


-- 
Philippe Biondi <biondi@ cartel-securite.fr> Cartel S�curit�
Security Consultant/R&D                      http://www.cartel-securite.fr
Phone: +33 1 44 06 97 94                     Fax: +33 1 44 06 97 99
PGP KeyID:3D9A43E2  FingerPrint:C40A772533730E39330DC0985EE8FF5F3D9A43E2

--- ../../sbin/setup_harddisks  Fri Jan 11 17:27:41 2002
+++ setup_harddisks     Wed Jan 23 21:30:06 2002
@@ -436,7 +436,7 @@
                      && die "ERROR: unable to preserve partitions of size 0.\n$line\n 
";
                  } else {
                    # If not preserve we must know the filesystemtype
-                   ($options !~ /\b(ext2|swap|dosfat16|winfat32|reiser)\b/i ) && 
($options .= " ext2");
+                   ($options !~ /\b(ext2|ext3|auto|swap|dosfat16|winfat32|reiser)\b/i 
+) && ($options .= " auto");
                  }
                if($size =~ /^(\d*)(\-?)(\d*)$/){
                    $Min = $1;
@@ -463,7 +463,7 @@
                # fstaboptions
                $MPfstaboptions{$mountpoint} = $fstaboptions;
                # extra options
-               ($options =~ /\bext2\b/i) && ($MPID{$mountpoint} = 83); # Linux native
+               ($options =~ /\b(ext[23]|auto)\b/i) && ($MPID{$mountpoint} = 83); # 
+Linux native
                ($options =~ /\bswap\b/i) && ($MPID{$mountpoint} = 82); # Linux swap
                ($options =~ /\bdosfat16\b/i) && ($MPID{$mountpoint} = 6); # DOS FAT 
16bit (>=32MB, will be changed later)
                ($options =~ /\bwinfat32\b/i) && ($MPID{$mountpoint} = "b"); # Win 95 
FAT 32
@@ -770,8 +770,8 @@
                next;
            }
            # Linux Extended 2 file system
-           if ($MPOptions{$mountpoint} =~ /\bext2\b/i) {
-               print "Make Extended 2 Filesystem:\n";
+           if ($MPOptions{$mountpoint} =~ /\b(ext[23]|auto)\b/i) {
+               print "Make Extended 2/3 Filesystem:\n";
                $command = "mke2fs $mke2fs_options";
                ($MPOptions{$mountpoint} =~ /(\-c)\b/i) && ($command .= " $1");
                ($MPOptions{$mountpoint} =~ /(\-i\s*\d+)\b/) && ($command .= " $1");
@@ -811,8 +811,10 @@
 #<file sys>          <mount point>     <type>   <options>   <dump>   <pass>
 EOM
     # 1. /
-    $type = "ext2";
+    $type = "auto";
     ($MPOptions{'/'} =~ /\b(reiser)\b/i) && ($type = "reiserfs");
+    ($MPOptions{'/'} =~ /\b(ext3)\b/i) && ($type = "ext3");
+    ($MPOptions{'/'} =~ /\b(ext2)\b/i) && ($type = "ext2");
     $FileSystemTab .= 
BuildfstabLine("/dev/$MountpointPart{'/'}","/",$type,$MPfstaboptions{'/'},0,1);
     # 2. swap partitions
     foreach $mountpoint (%PartMountpoint){
@@ -826,9 +828,11 @@
     foreach $mountpoint (sort %PartMountpoint){
        next if ( ($mountpoint !~ /^\//) || ($mountpoint eq "/"));
        $device = $MountpointPart{$mountpoint};
-       $type = "ext2";
+       $type = "auto";
        ($MPOptions{$mountpoint} =~ /\b(dosfat16|winfat32)\b/i) && ($type = "vfat");
        ($MPOptions{$mountpoint} =~ /\b(reiser)\b/i) && ($type = "reiserfs");
+       ($MPOptions{$mountpoint} =~ /\b(ext3)\b/i) && ($type = "ext3");
+       ($MPOptions{$mountpoint} =~ /\b(ext2)\b/i) && ($type = "ext2");
        $FileSystemTab .= 
BuildfstabLine("/dev/$device",$mountpoint,$type,$MPfstaboptions{$mountpoint},0,2);
     }
     # write it

Reply via email to