diff options
author | marcel <marcel@FreeBSD.org> | 2004-11-13 05:44:02 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2004-11-13 05:44:02 +0000 |
commit | 044a6050c4e974edc09bb29f7d0387b8ec67d3e1 (patch) | |
tree | 506069708b46b0f35a7b3d3313415fe047697d45 /sbin/gpt/migrate.c | |
parent | 571405ddd692d7a10ed1b454ad3905dec737db60 (diff) | |
download | FreeBSD-src-044a6050c4e974edc09bb29f7d0387b8ec67d3e1.zip FreeBSD-src-044a6050c4e974edc09bb29f7d0387b8ec67d3e1.tar.gz |
Add an -f option (for force) to the migrate command. Normally an MBR
with unknown partitions is not migrated. By specifying the -f option
migration will happen and unknown partitions will be lost.
Diffstat (limited to 'sbin/gpt/migrate.c')
-rw-r--r-- | sbin/gpt/migrate.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sbin/gpt/migrate.c b/sbin/gpt/migrate.c index d0f1485..eb89941 100644 --- a/sbin/gpt/migrate.c +++ b/sbin/gpt/migrate.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #define LABELSECTOR 1 #endif +static int force; static int slice; static void @@ -58,7 +59,7 @@ usage_migrate(void) { fprintf(stderr, - "usage: %s [-s] device\n", getprogname()); + "usage: %s [-fs] device\n", getprogname()); exit(1); } @@ -271,9 +272,11 @@ migrate(int fd) break; } default: - warnx("%s: error: unknown partition type (%d)", - device_name, mbr->mbr_part[i].part_typ); - return; + if (!force) { + warnx("%s: error: unknown partition type (%d)", + device_name, mbr->mbr_part[i].part_typ); + return; + } } } ent = tbl->map_data; @@ -329,8 +332,11 @@ cmd_migrate(int argc, char *argv[]) int ch, fd; /* Get the migrate options */ - while ((ch = getopt(argc, argv, "s")) != -1) { + while ((ch = getopt(argc, argv, "fs")) != -1) { switch(ch) { + case 'f': + force = 1; + break; case 's': slice = 1; break; |