JOIN,
MOUNT,
MOUNTRW,
+ SPLIT,
UNMOUNT,
};
" [NEW_DESC] [--boot] [--check] [--header] [--lookup-table]\n"
" [--xml] [--extract-xml FILE] [--metadata]\n",
[JOIN] =
-" imagex join [--check] --output WIMFILE SPLIT_WIM...\n",
+" imagex join [--check] WIMFILE SPLIT_WIM...\n",
[MOUNT] =
" imagex mount WIMFILE (IMAGE_NUM | IMAGE_NAME) DIRECTORY\n"
" [--check] [--debug]\n",
[MOUNTRW] =
" imagex mountrw WIMFILE [IMAGE_NUM | IMAGE_NAME] DIRECTORY\n"
" [--check] [--debug]\n",
+[SPLIT] =
+" imagex split WIMFILE SPLIT_WIMFILE PART_SIZE [--check]\n",
[UNMOUNT] =
" imagex unmount DIRECTORY [--commit] [--check]\n",
};
static const struct option join_options[] = {
{"check", no_argument, NULL, 'c'},
- {"output", required_argument, NULL, 'o'},
{NULL, 0, NULL, 0},
};
{NULL, 0, NULL, 0},
};
+static const struct option split_options[] = {
+ {"check", no_argument, NULL, 'c'},
+ {NULL, 0, NULL, 0},
+};
+
static const struct option unmount_options[] = {
{"commit", no_argument, NULL, 'c'},
{"check", no_argument, NULL, 'C'},
int flags = WIMLIB_OPEN_FLAG_SPLIT_OK | WIMLIB_OPEN_FLAG_SHOW_PROGRESS;
int image;
int ret;
- const char *output_path = NULL;
+ const char *output_path;
for_opt(c, join_options) {
switch (c) {
case 'c':
flags |= WIMLIB_OPEN_FLAG_CHECK_INTEGRITY;
break;
- case 'o':
- output_path = optarg;
- break;
default:
goto err;
}
argv += optind;
if (argc < 2) {
- imagex_error("Must specify at least two split WIM "
+ imagex_error("Must specify at least one split WIM "
"(.swm) parts to join!\n");
goto err;
}
- if (!output_path) {
- imagex_error("Must specify output_path!\n");
- goto err;
- }
- return wimlib_join(argv, argc, output_path, flags);
+ output_path = argv[0];
+ return wimlib_join(++argv, --argc, output_path, flags);
err:
usage(JOIN);
return -1;
return ret;
}
+/* Split a WIM into a spanned set */
+static int imagex_split(int argc, const char **argv)
+{
+ int c;
+ int flags = WIMLIB_OPEN_FLAG_SHOW_PROGRESS;
+ unsigned long part_size;
+
+ for_opt(c, split_options) {
+ switch (c) {
+ case 'c':
+ flags |= WIMLIB_OPEN_FLAG_CHECK_INTEGRITY;
+ break;
+ default:
+ usage(SPLIT);
+ return -1;
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 3) {
+ usage(SPLIT);
+ return -1;
+ }
+ part_size = strtoul(argv[2], NULL, 10) * (1 << 20);
+ return wimlib_split(argv[0], argv[1], part_size, flags);
+}
+
/* Unmounts an image. */
static int imagex_unmount(int argc, const char **argv)
{
{"join", imagex_join, JOIN},
{"mount", imagex_mount_rw_or_ro, MOUNT},
{"mountrw", imagex_mount_rw_or_ro, MOUNTRW},
+ {"split", imagex_split, SPLIT},
{"unmount", imagex_unmount, UNMOUNT},
};