diff options
| author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2011-09-15 18:18:16 +0000 |
|---|---|---|
| committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2011-09-15 18:18:16 +0000 |
| commit | b20d8a86fe350baff549e5bb47a25be252c94c3c (patch) | |
| tree | 907c558a54b404182eff0518825c0292d241d341 /usr/src/cmd/zoneadm | |
| parent | e5edabf8af4430653c2189b3d23c6b9b47f2f5b7 (diff) | |
| download | illumos-joyent-b20d8a86fe350baff549e5bb47a25be252c94c3c.tar.gz | |
OS-609 post-install hook for adding UUID could race
Diffstat (limited to 'usr/src/cmd/zoneadm')
| -rw-r--r-- | usr/src/cmd/zoneadm/zoneadm.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/usr/src/cmd/zoneadm/zoneadm.c b/usr/src/cmd/zoneadm/zoneadm.c index b63c448d9c..9d9d782d0a 100644 --- a/usr/src/cmd/zoneadm/zoneadm.c +++ b/usr/src/cmd/zoneadm/zoneadm.c @@ -2913,6 +2913,7 @@ install_func(int argc, char *argv[]) boolean_t brand_help = B_FALSE; boolean_t do_dataset = B_TRUE; char opts[128]; + char *new_uuid = NULL; if (target_zone == NULL) { sub_usage(SHELP_INSTALL, CMD_INSTALL); @@ -2955,7 +2956,7 @@ install_func(int argc, char *argv[]) if (postcmdbuf[0] != '\0') do_postinstall = B_TRUE; - (void) strcpy(opts, "?x:"); + (void) strcpy(opts, "?U:x:"); /* * Fetch the list of recognized command-line options from * the brand configuration file. @@ -2987,6 +2988,10 @@ install_func(int argc, char *argv[]) } /* Ignore unknown options - may be brand specific. */ break; + case 'U': + new_uuid = optarg; + continue; /* internal arg, don't pass thru */ + break; case 'x': if (strcmp(optarg, "nodataset") == 0) { do_dataset = B_FALSE; @@ -3072,6 +3077,13 @@ install_func(int argc, char *argv[]) goto done; } + if (new_uuid != NULL && + (err = zonecfg_set_uuid(target_zone, zonepath, new_uuid) != Z_OK)) { + errno = err; + zperror2(target_zone, gettext("could not set UUID")); + goto done; + } + if (do_postinstall) { status = do_subproc(postcmdbuf); |
