char *shortopt = short_options;
int dosyslog = 0;
int rebuild_map = 0;
- int auto_update_home = 0;
char *subarray = NULL;
char *remove_path = NULL;
char *udev_filename = NULL;
exit(2);
} else if (!mode && newmode) {
mode = newmode;
+ if (mode == MISC && devs_found) {
+ fprintf(stderr, Name ": No action given for %s in --misc mode\n",
+ devlist->devname);
+ fprintf(stderr," Action options must come before device names\n");
+ exit(2);
+ }
} else {
/* special case of -c --help */
if ((opt == 'c' || opt == ConfigFile) &&
exit(2);
}
chunk = parse_size(optarg);
- if (chunk < 8 || ((chunk-1)&chunk)) {
+ if (chunk < 8 || (chunk&1)) {
fprintf(stderr, Name ": invalid chunk/rounding value: %s\n",
optarg);
exit(2);
}
- /* Covert sectors to K */
+ /* Convert sectors to K */
chunk /= 2;
continue;
-#if 0
- case O(ASSEMBLE,AutoHomeHost):
- auto_update_home = 1;
- continue;
-#endif
case O(INCREMENTAL, 'e'):
case O(CREATE,'e'):
case O(ASSEMBLE,'e'):
case O(CREATE,AssumeClean):
case O(BUILD,AssumeClean): /* assume clean */
+ case O(GROW,AssumeClean):
assume_clean = 1;
continue;
case O(ASSEMBLE,Force): /* force assembly */
case O(MISC,'f'): /* force zero */
case O(MISC,Force): /* force zero */
+ case O(MANAGE,Force): /* add device which is too large */
force=1;
continue;
if (homehost == NULL)
homehost = conf_get_homehost(&require_homehost);
- if (homehost == NULL || strcmp(homehost, "<system>")==0) {
+ if (homehost == NULL || strcasecmp(homehost, "<system>")==0) {
if (gethostname(sys_hostname, sizeof(sys_hostname)) == 0) {
sys_hostname[sizeof(sys_hostname)-1] = 0;
homehost = sys_hostname;
}
}
+ if (homehost && (!homehost[0] || strcasecmp(homehost, "<none>") == 0)) {
+ homehost = NULL;
+ require_homehost = 0;
+ }
if ((mode != MISC || devmode != 'E') &&
geteuid() != 0) {
if (!rv && devs_found>1)
rv = Manage_subdevs(devlist->devname, mdfd,
devlist->next, verbose-quiet, test,
- update);
+ update, force);
if (!rv && readonly < 0)
rv = Manage_ro(devlist->devname, mdfd, readonly);
if (!rv && runstop)
cnt++;
acnt++;
}
- if (rv2 == 1)
- /* found something so even though assembly failed we
- * want to avoid auto-updates
- */
- auto_update_home = 0;
} while (rv2!=2);
/* Incase there are stacked devices, we need to go around again */
} while (acnt);
-#if 0
- if (cnt == 0 && auto_update_home && homehost) {
- /* Nothing found, maybe we need to bootstrap homehost info */
- do {
- acnt = 0;
- do {
- rv2 = Assemble(
- ss, NULL,
- &ident,
- NULL, NULL, 0,
- readonly, runstop,
- "homehost",
- homehost,
- require_homehost,
- verbose-quiet, force);
- if (rv2==0) {
- cnt++;
- acnt++;
- }
- } while (rv2!=2);
- /* Incase there are stacked devices, we need to go around again */
- } while (acnt);
- }
-#endif
if (cnt == 0 && rv == 0) {
fprintf(stderr, Name ": No arrays found in config file or automatically\n");
rv = 1;
}
} else if (bitmap_file) {
if (size >= 0 || raiddisks || chunk ||
- layout_str != NULL || devs_found) {
+ layout_str != NULL || devs_found > 1) {
fprintf(stderr, Name ": --bitmap changes cannot be "
"used with other geometry changes "
"in --grow mode\n");
rv = Grow_reshape(devlist->devname, mdfd, quiet, backup_file,
size, level, layout_str, chunk, raiddisks,
devlist->next,
- force);
+ assume_clean, force);
} else if (array_size < 0)
fprintf(stderr, Name ": no changes to --grow\n");
break;