summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr/src/cmd/zlogin/zlogin.c5
-rw-r--r--usr/src/cmd/zoneadm/zoneadm.c38
-rw-r--r--usr/src/lib/brand/lx/zone/config.xml1
-rw-r--r--usr/src/lib/brand/native/zone/config.xml1
-rw-r--r--usr/src/lib/brand/sn1/zone/config.xml1
-rw-r--r--usr/src/lib/libbrand/common/libbrand.c10
-rw-r--r--usr/src/lib/libbrand/common/libbrand.h2
-rw-r--r--usr/src/lib/libbrand/common/mapfile-vers1
-rw-r--r--usr/src/lib/libbrand/dtd/brand.dtd.121
9 files changed, 77 insertions, 3 deletions
diff --git a/usr/src/cmd/zlogin/zlogin.c b/usr/src/cmd/zlogin/zlogin.c
index c0886a3b0f..493d117616 100644
--- a/usr/src/cmd/zlogin/zlogin.c
+++ b/usr/src/cmd/zlogin/zlogin.c
@@ -1553,7 +1553,10 @@ noninteractive_login(char *zonename, const char *user_cmd, zoneid_t zoneid,
* For non-native zones, tell libc where it can find locale
* specific getttext() messages.
*/
- if (access("/native/usr/lib/locale", R_OK) == 0)
+ if (access("/.SUNWnative/usr/lib/locale", R_OK) == 0)
+ (void) bindtextdomain(TEXT_DOMAIN,
+ "/.SUNWnative/usr/lib/locale");
+ else if (access("/native/usr/lib/locale", R_OK) == 0)
(void) bindtextdomain(TEXT_DOMAIN,
"/native/usr/lib/locale");
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
diff --git a/usr/src/lib/brand/lx/zone/config.xml b/usr/src/lib/brand/lx/zone/config.xml
index 5829cd153a..6d50033bbe 100644
--- a/usr/src/lib/brand/lx/zone/config.xml
+++ b/usr/src/lib/brand/lx/zone/config.xml
@@ -45,6 +45,7 @@
<verify_cfg>/usr/lib/brand/lx/lx_support verify</verify_cfg>
<verify_adm></verify_adm>
<postclone></postclone>
+ <postinstall></postinstall>
<privilege set="default" name="contract_event" />
<privilege set="default" name="contract_observer" />
diff --git a/usr/src/lib/brand/native/zone/config.xml b/usr/src/lib/brand/native/zone/config.xml
index 9e0b6244a0..6bd5c8e709 100644
--- a/usr/src/lib/brand/native/zone/config.xml
+++ b/usr/src/lib/brand/native/zone/config.xml
@@ -45,6 +45,7 @@
<verify_cfg></verify_cfg>
<verify_adm></verify_adm>
<postclone>/usr/lib/brand/native/postclone %z %R</postclone>
+ <postinstall></postinstall>
<privilege set="default" name="contract_event" />
<privilege set="default" name="contract_observer" />
diff --git a/usr/src/lib/brand/sn1/zone/config.xml b/usr/src/lib/brand/sn1/zone/config.xml
index 56488744d7..a1f4a0fbdb 100644
--- a/usr/src/lib/brand/sn1/zone/config.xml
+++ b/usr/src/lib/brand/sn1/zone/config.xml
@@ -45,6 +45,7 @@
<verify_cfg></verify_cfg>
<verify_adm></verify_adm>
<postclone></postclone>
+ <postinstall></postinstall>
<privilege set="default" name="contract_event" />
<privilege set="default" name="contract_observer" />
diff --git a/usr/src/lib/libbrand/common/libbrand.c b/usr/src/lib/libbrand/common/libbrand.c
index 696f956915..be49d9de50 100644
--- a/usr/src/lib/libbrand/common/libbrand.c
+++ b/usr/src/lib/libbrand/common/libbrand.c
@@ -60,6 +60,7 @@
#define DTD_ELEM_MODNAME ((const xmlChar *) "modname")
#define DTD_ELEM_MOUNT ((const xmlChar *) "mount")
#define DTD_ELEM_POSTCLONE ((const xmlChar *) "postclone")
+#define DTD_ELEM_POSTINSTALL ((const xmlChar *) "postinstall")
#define DTD_ELEM_PRIVILEGE ((const xmlChar *) "privilege")
#define DTD_ELEM_SYMLINK ((const xmlChar *) "symlink")
#define DTD_ELEM_USER_CMD ((const xmlChar *) "user_cmd")
@@ -530,6 +531,15 @@ brand_get_postclone(brand_handle_t bh, const char *zonename,
}
int
+brand_get_postinstall(brand_handle_t bh, const char *zonename,
+ const char *zoneroot, char *buf, size_t len, int argc, char **argv)
+{
+ struct brand_handle *bhp = (struct brand_handle *)bh;
+ return (brand_get_value(bhp, zonename, zoneroot, NULL, NULL,
+ buf, len, argc, argv, DTD_ELEM_POSTINSTALL, B_TRUE, B_TRUE));
+}
+
+int
brand_get_verify_cfg(brand_handle_t bh, char *buf, size_t len)
{
struct brand_handle *bhp = (struct brand_handle *)bh;
diff --git a/usr/src/lib/libbrand/common/libbrand.h b/usr/src/lib/libbrand/common/libbrand.h
index 5a4620fff5..90dc583b3b 100644
--- a/usr/src/lib/libbrand/common/libbrand.h
+++ b/usr/src/lib/libbrand/common/libbrand.h
@@ -58,6 +58,8 @@ extern int brand_get_halt(brand_handle_t, const char *, const char *,
extern int brand_get_initname(brand_handle_t, char *, size_t);
extern int brand_get_install(brand_handle_t, const char *, const char *,
char *, size_t, int, char **);
+extern int brand_get_postinstall(brand_handle_t, const char *, const char *,
+ char *, size_t, int, char **);
extern int brand_get_installopts(brand_handle_t, char *, size_t);
extern int brand_get_login_cmd(brand_handle_t, const char *, char *, size_t);
extern int brand_get_modname(brand_handle_t, char *, size_t);
diff --git a/usr/src/lib/libbrand/common/mapfile-vers b/usr/src/lib/libbrand/common/mapfile-vers
index 15d4fa1c62..a63ac59e1f 100644
--- a/usr/src/lib/libbrand/common/mapfile-vers
+++ b/usr/src/lib/libbrand/common/mapfile-vers
@@ -39,6 +39,7 @@ SUNWprivate {
brand_get_login_cmd;
brand_get_modname;
brand_get_postclone;
+ brand_get_postinstall;
brand_get_user_cmd;
brand_get_verify_adm;
brand_get_verify_cfg;
diff --git a/usr/src/lib/libbrand/dtd/brand.dtd.1 b/usr/src/lib/libbrand/dtd/brand.dtd.1
index 8120b7ba5c..56f29fe0b8 100644
--- a/usr/src/lib/libbrand/dtd/brand.dtd.1
+++ b/usr/src/lib/libbrand/dtd/brand.dtd.1
@@ -218,6 +218,25 @@
<!ATTLIST postclone>
<!--
+ postinstall
+
+ Path to a script that will perform any necessary post-processing on
+ a zone after it has been freshly installed. This hook will run after the
+ install hook completes and the zone is in the installed state. The
+ additional arguments are the same as what is passed to the install hook.
+
+ The following replacements are performed:
+
+ %z Name of zone
+ %R Root of zone
+ %* Additional arguments, if any
+
+ It has no attributes.
+-->
+<!ELEMENT postinstall (#PCDATA) >
+<!ATTLIST postinstall>
+
+<!--
privilege
Add a privilege to the default, prohibited, or required set for all
@@ -259,6 +278,6 @@
<!ELEMENT brand (modname, initname, login_cmd, user_cmd, install,
installopts, boot, halt, verify_cfg, verify_adm,
- postclone, privilege+)>
+ postclone, postinstall, privilege+)>
<!ATTLIST brand name CDATA #REQUIRED>