summaryrefslogtreecommitdiff
path: root/usr/src/cmd/zoneadm
diff options
context:
space:
mode:
authorgjelinek <none@none>2007-07-03 14:37:33 -0700
committergjelinek <none@none>2007-07-03 14:37:33 -0700
commit1100f00d5652de2808b73c61bcfdb3fc87ef1fc8 (patch)
treea8e97a380e1dab754047037b7dff6858abdd794e /usr/src/cmd/zoneadm
parent72a7a5ed3ff56d74e2f6a3507e5034fd476d544a (diff)
downloadillumos-joyent-1100f00d5652de2808b73c61bcfdb3fc87ef1fc8.tar.gz
6575612 some brands need a post-install hook to be installed
6574267 zlogin error msgs for non-native zones could be under .SUNWnative
Diffstat (limited to 'usr/src/cmd/zoneadm')
-rw-r--r--usr/src/cmd/zoneadm/zoneadm.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/usr/src/cmd/zoneadm/zoneadm.c b/usr/src/cmd/zoneadm/zoneadm.c
index db7ef054cb..5f2ee9c606 100644
--- a/usr/src/cmd/zoneadm/zoneadm.c
+++ b/usr/src/cmd/zoneadm/zoneadm.c
@@ -3124,12 +3124,14 @@ static int
install_func(int argc, char *argv[])
{
char cmdbuf[MAXPATHLEN];
+ char postcmdbuf[MAXPATHLEN];
int lockfd;
int arg, err, subproc_err;
char zonepath[MAXPATHLEN];
brand_handle_t bh = NULL;
int status;
boolean_t nodataset = B_FALSE;
+ boolean_t do_postinstall = B_FALSE;
char opts[128];
if (target_zone == NULL) {
@@ -3163,6 +3165,18 @@ install_func(int argc, char *argv[])
return (Z_ERR);
}
+ (void) strcpy(postcmdbuf, EXEC_PREFIX);
+ if (brand_get_postinstall(bh, target_zone, zonepath,
+ postcmdbuf + EXEC_LEN, sizeof (postcmdbuf) - EXEC_LEN, 0, NULL)
+ != 0) {
+ zerror("invalid brand configuration: missing postinstall "
+ "resource");
+ brand_close(bh);
+ return (Z_ERR);
+ } else if (strlen(postcmdbuf) > EXEC_LEN) {
+ do_postinstall = B_TRUE;
+ }
+
(void) strcpy(opts, "?x:");
if (!is_native_zone) {
/*
@@ -3201,13 +3215,18 @@ install_func(int argc, char *argv[])
/*
* This option isn't for zoneadm, so append it to
* the command line passed to the brand-specific
- * install routine.
+ * install and postinstall routines.
*/
if (addopt(cmdbuf, optopt, optarg,
sizeof (cmdbuf)) != Z_OK) {
zerror("Install command line too long");
return (Z_ERR);
}
+ if (addopt(postcmdbuf, optopt, optarg,
+ sizeof (postcmdbuf)) != Z_OK) {
+ zerror("Post-Install command line too long");
+ return (Z_ERR);
+ }
break;
}
}
@@ -3219,6 +3238,11 @@ install_func(int argc, char *argv[])
zerror("Install command line too long");
return (Z_ERR);
}
+ if (addopt(postcmdbuf, 0, argv[optind],
+ sizeof (postcmdbuf)) != Z_OK) {
+ zerror("Post-Install command line too long");
+ return (Z_ERR);
+ }
}
}
@@ -3282,6 +3306,18 @@ install_func(int argc, char *argv[])
goto done;
}
+ if (do_postinstall) {
+ status = do_subproc(postcmdbuf);
+
+ if ((subproc_err =
+ subproc_status(gettext("brand-specific post-install"),
+ status, B_FALSE)) != ZONE_SUBPROC_OK) {
+ err = Z_ERR;
+ (void) zone_set_state(target_zone,
+ ZONE_STATE_INCOMPLETE);
+ }
+ }
+
done:
/*
* If the install script exited with ZONE_SUBPROC_USAGE or