svn commit: r245701 - head/usr.sbin/bsdinstall/partedit
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Sun Jan 20 23:04:22 UTC 2013
Author: nwhitehorn
Date: Sun Jan 20 23:04:21 2013
New Revision: 245701
URL: http://svnweb.freebsd.org/changeset/base/245701
Log:
If no partition configuration is specified in {}, use the automatic setup
the interactive installer uses.
Example: bsdinstall scriptedpart ada0
Result: Use entire disk for a FreeBSD system with default partition layout
Modified:
head/usr.sbin/bsdinstall/partedit/part_wizard.c
head/usr.sbin/bsdinstall/partedit/partedit.h
head/usr.sbin/bsdinstall/partedit/scripted.c
Modified: head/usr.sbin/bsdinstall/partedit/part_wizard.c
==============================================================================
--- head/usr.sbin/bsdinstall/partedit/part_wizard.c Sun Jan 20 22:25:58 2013 (r245700)
+++ head/usr.sbin/bsdinstall/partedit/part_wizard.c Sun Jan 20 23:04:21 2013 (r245701)
@@ -42,7 +42,6 @@
static char *boot_disk(struct gmesh *mesh);
static char *wizard_partition(struct gmesh *mesh, const char *disk);
-static int wizard_makeparts(struct gmesh *mesh, const char *disk);
int
part_wizard(void) {
@@ -71,7 +70,7 @@ startwizard:
dlg_put_backtitle();
error = geom_gettree(&mesh);
- error = wizard_makeparts(&mesh, schemeroot);
+ error = wizard_makeparts(&mesh, schemeroot, 1);
if (error)
goto startwizard;
free(schemeroot);
@@ -288,8 +287,8 @@ query:
return (retval);
}
-static int
-wizard_makeparts(struct gmesh *mesh, const char *disk)
+int
+wizard_makeparts(struct gmesh *mesh, const char *disk, int interactive)
{
struct gmesh submesh;
struct gclass *classp;
@@ -310,7 +309,7 @@ wizard_makeparts(struct gmesh *mesh, con
pp = provider_for_name(mesh, disk);
available = gpart_max_free(gp, NULL)*pp->lg_sectorsize;
- if (available < MIN_FREE_SPACE) {
+ if (interactive && available < MIN_FREE_SPACE) {
char availablestr[10], neededstr[10], message[512];
humanize_number(availablestr, 7, available, "B", HN_AUTOSCALE,
HN_DECIMAL);
Modified: head/usr.sbin/bsdinstall/partedit/partedit.h
==============================================================================
--- head/usr.sbin/bsdinstall/partedit/partedit.h Sun Jan 20 22:25:58 2013 (r245700)
+++ head/usr.sbin/bsdinstall/partedit/partedit.h Sun Jan 20 23:04:21 2013 (r245701)
@@ -56,6 +56,7 @@ void delete_part_metadata(const char *na
int part_wizard(void);
int scripted_editor(int argc, const char **argv);
+int wizard_makeparts(struct gmesh *mesh, const char *disk, int interactive);
/* gpart operations */
void gpart_delete(struct gprovider *pp);
Modified: head/usr.sbin/bsdinstall/partedit/scripted.c
==============================================================================
--- head/usr.sbin/bsdinstall/partedit/scripted.c Sun Jan 20 22:25:58 2013 (r245700)
+++ head/usr.sbin/bsdinstall/partedit/scripted.c Sun Jan 20 23:04:21 2013 (r245701)
@@ -109,6 +109,11 @@ part_config(char *disk, const char *sche
error = geom_gettree(&mesh);
/* Create partitions */
+ if (config == NULL) {
+ wizard_makeparts(&mesh, disk, 0);
+ goto finished;
+ }
+
while ((partition = strsep(&config, ",")) != NULL) {
while ((ap = strsep(&partition, " \t\n")) != NULL) {
if (*ap == '\0')
@@ -131,6 +136,7 @@ part_config(char *disk, const char *sche
size = type = mount = NULL;
}
+finished:
geom_deletetree(&mesh);
free(disk);
More information about the svn-src-head
mailing list