Date: Tue, 16 Jul 2002 16:12:38 +0200 (CEST) From: Thomas Zenker <thz@Lennartz-electronic.de> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/40656: patch: sysinstall: scripted deletion of slices Message-ID: <200207161412.g6GECcss072883@mezcal.tue.le>
next in thread | raw e-mail | index | archive | help
>Number: 40656
>Category: bin
>Synopsis: patch: sysinstall: scripted deletion of slices
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Tue Jul 16 07:20:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Thomas Zenker
>Release: FreeBSD 4.6-RELEASE i386
>Organization:
>Environment:
System: FreeBSD mezcal.tue.le 4.6-RELEASE FreeBSD 4.6-RELEASE #8: Mon Jun 10 11:22:51 CEST 2002 thz@mezcal.tue.le:/usr/obj/usr/src/sys/MEZCAL i386
all versions of sysinstall
>Description:
for automated installations it is often necessary to delete
the previously existing fdisk partitions (slices) from the
script, otherwise the results are not as expected.
>How-To-Repeat:
a previously fdisk partitioned disk prevents successfull
re-partitioning of a disk.
>Fix:
introduce a new variable for sysinstall "deletePartition".
For the moment it is only possible to give a argument of "all",
which means to delete all slices. For deleting of a specific
slice, it would be necessary to figure out how to a access it.
The patch applies to current and stable. Man page update included.
Index: usr.sbin/sysinstall/disks.c
===================================================================
RCS file: /usr/cvs/FreeBSD/src/usr.sbin/sysinstall/disks.c,v
retrieving revision 1.132
diff -u -r1.132 disks.c
--- usr.sbin/sysinstall/disks.c 31 May 2002 17:03:01 -0000 1.132
+++ usr.sbin/sysinstall/disks.c 16 Jul 2002 13:12:09 -0000
@@ -869,6 +869,16 @@
d->bios_sect = strtol(cp + 1, 0, 0);
}
+ cp = variable_get(VAR_DELPARTITION);
+ if (cp) {
+ if (strcmp(cp, "all") == 0) {
+ for (i = 0; chunk_info[i]; i++)
+ Delete_Chunk(d, chunk_info[i]);
+ variable_unset(VAR_DELPARTITION);
+ record_chunks(d);
+ }
+ }
+
cp = variable_get(VAR_PARTITION);
if (cp) {
if (!strcmp(cp, "free")) {
Index: usr.sbin/sysinstall/sysinstall.h
===================================================================
RCS file: /usr/cvs/FreeBSD/src/usr.sbin/sysinstall/sysinstall.h,v
retrieving revision 1.228
diff -u -r1.228 sysinstall.h
--- usr.sbin/sysinstall/sysinstall.h 1 Jun 2002 14:50:14 -0000 1.228
+++ usr.sbin/sysinstall/sysinstall.h 16 Jul 2002 13:12:09 -0000
@@ -91,6 +91,7 @@
#define VAR_BROWSER_PACKAGE "browserPackage"
#define VAR_CPIO_VERBOSITY "cpioVerbose"
#define VAR_DEBUG "debug"
+#define VAR_DELPARTITION "deletePartition"
#define VAR_DESKSTYLE "_deskStyle"
#define VAR_DISK "disk"
#define VAR_DISKINTERACTIVE "diskInteractive"
Index: usr.sbin/sysinstall/sysinstall.8
===================================================================
RCS file: /usr/cvs/FreeBSD/src/usr.sbin/sysinstall/sysinstall.8,v
retrieving revision 1.53
diff -u -r1.53 sysinstall.8
--- usr.sbin/sysinstall/sysinstall.8 14 Jul 2002 14:46:26 -0000 1.53
+++ usr.sbin/sysinstall/sysinstall.8 16 Jul 2002 13:12:09 -0000
@@ -287,6 +287,11 @@
Default: none.
.It diskInteractive
If set, bring up the interactive disk partition editor.
+.It deletePartition
+can be set to
+.Ar all
+to delete all previously existing partitions.
+Default: nothing deleted.
.El
.Pp
Note: Nothing is actually written to disk by this function, a explicit call to
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207161412.g6GECcss072883>
