From owner-FreeBSD-users-jp@jp.freebsd.org  Fri Oct  4 13:04:46 1996
Received: by mail.jp.freebsd.org (8.7.3+2.6Wbeta5/8.7.3) id NAA07500
	Fri, 4 Oct 1996 13:04:46 +0900 (JST)
Received: by mail.jp.freebsd.org (8.7.3+2.6Wbeta5/8.7.3) with ESMTP id NAA07495
	for <FreeBSD-users-jp@jp.freebsd.org>; Fri, 4 Oct 1996 13:04:41 +0900 (JST)
Received: from adam.dsp.cl.nec.co.jp by research.gate.nec.co.jp (8.7.6+2.6Wbeta7/950912) with ESMTP id NAA12932; Fri, 4 Oct 1996 13:04:35 +0900 (JST)
Received: from mercury.dsp.cl.nec.co.jp by adam.dsp.cl.nec.co.jp (8.7.6+2.6Wbeta7/CL-960412) with SMTP id NAA05692; Fri, 4 Oct 1996 13:04:34 +0900 (JST)
Message-Id: <199610040404.NAA05692@adam.dsp.cl.nec.co.jp>
To: FreeBSD-users-jp@jp.freebsd.org
In-reply-to: Your message of Fri, 04 Oct 96 12:43:03 JST.
             <199610040343.MAA01914@spls63.ccs.mt.nec.co.jp> 
Date: Fri, 04 Oct 1996 13:04:29 +0900
From: Akihiro Hirano <hirano@dsp.cl.nec.co.jp>
Reply-To: FreeBSD-users-jp@jp.freebsd.org
X-Distribute: distribute [version 2.1 (Alpha) patchlevel=19]
X-Sequence: FreeBSD-users-jp 5004
Subject: [FreeBSD-users-jp 5004] Re: another FDISK Slice mount 
Errors-To: owner-FreeBSD-users-jp@jp.freebsd.org
Sender: owner-FreeBSD-users-jp@jp.freebsd.org

> $B7kO@$+$i$$$C$F!"(B/stand/sysinstall $B$G$G$-$^$7$?!#(B
> 
> $B%+%9%?%`(B -> $B%Q!<%F%#%7%g%s(B $B$G%9%i%$%9$N:n@.!"%i%Y%k$G%9%i%$%9$rA*(B
> $B$s$G@_Dj8e=q$-9~$a$P(B disklabel $B$r=q$-9~$`$3$H$,$G$-$^$7$?!#(B
> 
> $B$=$N8e!"(Bnewfs $B$7$F(B mount $B$G$-$^$7$?!#(B

$B!!(Bsysinstall$B$G(Bnewfs$B$^$G$d$C$F$7$^$&$H$$$&%Q%C%A$O$$$+$,!)(Bcustom$B"*(B
formatdisks$B$G!"%9%i%$%9:n@.!"%i%Y%k=q$-9~$_!"(Bnewfs$B$r<B9T$7$^$9!#(B

$B!t(B2.1.5R$BMQ$M!D(B
----
$BF|K\EE5$(B($B3t(B)$B>pJs%a%G%#%"8&5f=j!!J?Ln989((B
E-mail : hirano@dsp.CL.nec.co.jp
========================================================================
--- Makefile.dist	Fri Jul 12 05:06:49 1996
+++ Makefile	Tue Aug 20 19:39:22 1996
@@ -9,7 +9,7 @@
 	ftp_strat.c globals.c index.c install.c installUpgrade.c \
 	label.c lndir.c main.c makedevs.c media.c menus.c misc.c \
 	msg.c network.c nfs.c options.c package.c samba.c system.c \
-	tape.c tcpip.c termcap.c ufs.c variable.c wizard.c
+	tape.c tcpip.c termcap.c ufs.c variable.c wizard.c format.c
 
 CFLAGS+= -Wall -I${.CURDIR}/../../gnu/lib/libdialog
 
--- devices.c.dist	Sat Jul 13 14:10:22 1996
+++ devices.c	Tue Aug 20 12:06:38 1996
@@ -67,6 +67,7 @@
     { DEVICE_TYPE_TAPE, 	"rft0",		"Floppy tape drive (QIC-02)"				},
     { DEVICE_TYPE_TAPE, 	"rwt0",		"Wangtek tape drive"					},
     { DEVICE_TYPE_DISK, 	"sd",		"SCSI disk device"					},
+    { DEVICE_TYPE_DISK, 	"od",		"Optical disk device"					},
     { DEVICE_TYPE_DISK, 	"wd",		"IDE/ESDI/MFM/ST506 disk device"			},
     { DEVICE_TYPE_FLOPPY,	"fd0",		"floppy drive unit A"					},
     { DEVICE_TYPE_FLOPPY,	"fd1",		"floppy drive unit B"					},
--- /dev/null	Wed Aug 21 09:51:21 1996
+++ format.c	Wed Aug 21 01:02:20 1996
@@ -0,0 +1,115 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last program in the `sysinstall' line - the next
+ * generation being essentially a complete rewrite.
+ *
+ * $Id: install.c,v 1.71.2.104 1996/07/16 17:34:28 jkh Exp $
+ *
+ * Copyright (c) 1995
+ *	Jordan Hubbard.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer,
+ *    verbatim and that no modifications are made prior to this
+ *    point in the file.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+/*
+ * Disk Format Program by Akihiro HIRANO
+ * hirano@DSP.CL.nec.co.jp
+ */
+
+#include "sysinstall.h"
+#include <ctype.h>
+#include <sys/disklabel.h>
+#include <sys/errno.h>
+#include <sys/ioctl.h>
+#include <sys/fcntl.h>
+#include <sys/wait.h>
+#include <sys/param.h>
+#define MSDOSFS
+#include <sys/mount.h>
+#undef MSDOSFS
+#include <sys/stat.h>
+#include <unistd.h>
+#include <sys/mount.h>
+
+/* Format new disks */
+int
+formatDisks(dialogMenuItem *self)
+{
+    int i;
+    char *str;
+    Device **devs;
+    Disk *disk;
+    Chunk *c1, *c2;
+
+    str = variable_get(SYSTEM_STATE);
+
+    if (diskPartitionEditor(self) == DITEM_FAILURE)
+	return DITEM_FAILURE;
+
+    if (diskLabelEditor(self) != DITEM_SUCCESS)
+	return DITEM_FAILURE;
+
+    /* If we refuse to proceed, bail. */
+    dialog_clear();
+    if (msgYesNo("Proceed to format?\n\n"
+		 "We can take no responsibility for lost disk contents!"))
+	return DITEM_FAILURE | DITEM_RESTORE;
+
+    /* Write disk partitions */
+    if (diskPartitionWrite(self) != DITEM_SUCCESS)
+	return DITEM_FAILURE;
+
+    /* Now buzz through the rest of the partitions and mount them too */
+    devs = deviceFind(NULL, DEVICE_TYPE_DISK);
+    for (i = 0; devs[i]; i++) {
+	if (!devs[i]->enabled)
+	    continue;
+
+	disk = (Disk *)devs[i]->private;
+	if (!disk->chunks) {
+	    msgConfirm("No chunk list found for %s!", disk->name);
+	    return DITEM_FAILURE;
+	}
+
+	for (c1 = disk->chunks->part; c1; c1 = c1->next) {
+	    if (c1->type == freebsd) {
+		for (c2 = c1->part; c2; c2 = c2->next) {
+		    if (c2->type == part && c2->subtype != FS_SWAP && c2->private_data) {
+			PartInfo *tmp = (PartInfo *)c2->private_data;
+
+			if (tmp->newfs)
+			    command_shell_add(tmp->mountpoint, "%s /dev/r%s", tmp->newfs_cmd, c2->name);
+			else
+			    command_shell_add(tmp->mountpoint, "fsck -y /dev/r%s", c2->name);
+		    }
+		}
+	    }
+	}
+    }
+
+    command_sort();
+    command_execute();
+    return DITEM_SUCCESS;
+}
--- menus.c.dist	Wed Jul 17 02:34:29 1996
+++ menus.c	Tue Aug 20 19:46:01 1996
@@ -953,6 +953,7 @@
   { "5 Media",		"Choose the installation media type",	NULL, dmenuSubmenu, NULL, &MenuMedia },
   { "6 Commit",		"Perform any pending Partition/Label/Extract actions", NULL, installCustomCommit },
   { "7 Extract",	"Just do distribution extract step",	NULL, distExtractAll },
+  { "8 Format",		"Format new disks",			NULL, formatDisks },
   { "0 Exit",		"Exit this menu (returning to previous)", NULL, dmenuExit },
   { NULL } },
 };
--- sysinstall.h.dist	Wed Jul 17 02:34:32 1996
+++ sysinstall.h	Tue Aug 20 19:46:13 1996
@@ -622,5 +622,7 @@
 /* wizard.c */
 extern void	slice_wizard(Disk *d);
 
+/* format.c */
+extern int formatDisks(dialogMenuItem *self);
 #endif
 /* _SYSINSTALL_H_INCLUDE */
