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

add -f -f to mkreiserfs



Package: reiserfsprogs
Version: 3.x.0d-2
Severity: wishlist

this is for the woody bootfloppies to be able to install a reiserfs
partition. this patch will allow mkreiserfs to be called with multiple
-f flags to prevent asking any questions. great for non-interactive use

diff -Naur reiserfsprogs-3.0.20001019-old/mkreiserfs/mkreiserfs.c reiserfsprogs-3.0.20001019/mkreiserfs/mkreiserfs.c
--- reiserfsprogs-3.0.20001019-old/mkreiserfs/mkreiserfs.c	Sat Oct 14 01:33:52 2000
+++ reiserfsprogs-3.0.20001019/mkreiserfs/mkreiserfs.c	Sun Mar 18 18:54:29 2001
@@ -371,7 +371,9 @@
 	{
 	case 'f' : /* force if file is not a block device or fs is
                       mounted. Confirm still required */
-	    force = 1;
+			/* force >1 is an unconditional force; no
+			   confirmation required */
+	    force += 1;
 	    break;
 
 	case 'h':
@@ -414,9 +416,16 @@
 	printf ("mkreiserfs: '%s' contains a mounted file system\n", device_name);
 	if (!force)
 	    exit (1);
-	printf ("Forced to continue, but please confirm (y/n)");
-	if (getchar () != 'y')
-	    exit (1);
+	switch (force) {
+		case 1:
+			printf ("Forced to continue, but please confirm (y/n)");
+			if (getchar () != 'y')
+			    exit (1);
+			break;
+		default:
+			printf ("Forced to continue.\n");
+			break;
+	}
     }
 
     dev = open (device_name, O_RDWR);
@@ -453,10 +462,13 @@
   
     report (device_name);
 
-    printf ("ATTENTION: YOU SHOULD REBOOT AFTER FDISK!\n\t    ALL DATA WILL BE LOST ON '%s'! (y/n)", device_name);
-    c = getchar ();
-    if (c != 'y' && c != 'Y')
-	die ("mkreiserfs: Disk was not formatted");
+    if (force < 2)
+    {
+        printf ("ATTENTION: YOU SHOULD REBOOT AFTER FDISK!\n\t    ALL DATA WILL BE LOST ON '%s'! (y/n)", device_name);
+        c = getchar ();
+        if (c != 'y' && c != 'Y')
+	    die ("mkreiserfs: Disk was not formatted");
+    }
 
     invalidate_other_formats (dev);
     write_super_and_root_blocks ();

-- System Information
Debian Release: testing/unstable
Kernel Version: Linux osiris 2.2.18 [classified] Sat Jan 6 11:19:04 PST 2001 i586 unknown

Versions of the packages reiserfsprogs depends on:
ii  libc6          2.2.2-1        GNU C Library: Shared libraries and Timezone



Reply to: