diff options
author | Toomas Soome <tsoome@me.com> | 2015-07-07 17:58:51 +0300 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2015-08-23 09:04:35 -0700 |
commit | a63c99a2145c99a38d5ff19422b132400428ed9d (patch) | |
tree | 589aec0039eba59c107a36ab9250975ed118a45c /usr/src/lib/libbe/common/be_utils.c | |
parent | 359db861fd14071f8a25831efe3bf3790980d071 (diff) | |
download | illumos-gate-a63c99a2145c99a38d5ff19422b132400428ed9d.tar.gz |
6080 libbe should support installboot
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Alexander Pyhalov <apyhalov@gmail.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src/lib/libbe/common/be_utils.c')
-rw-r--r-- | usr/src/lib/libbe/common/be_utils.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/usr/src/lib/libbe/common/be_utils.c b/usr/src/lib/libbe/common/be_utils.c index 681e72366d..4841302db3 100644 --- a/usr/src/lib/libbe/common/be_utils.c +++ b/usr/src/lib/libbe/common/be_utils.c @@ -25,6 +25,7 @@ /* * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2015 Toomas Soome <tsoome@me.com> */ @@ -57,6 +58,7 @@ #include <libbe.h> #include <libbe_priv.h> +#include <boot_utils.h> /* Private function prototypes */ static int update_dataset(char *, int, char *, char *, char *); @@ -2976,6 +2978,33 @@ be_get_default_isa(void) } /* + * Function: be_get_platform + * Description: + * Returns the platfom name + * Parameters: + * none + * Returns: + * NULL - the platform name returned by sysinfo() was too + * long for local variables + * char * - pointer to a string containing the platform name + * Scope: + * Semi-private (library wide use only) + */ +char * +be_get_platform(void) +{ + int i; + static char default_inst[ARCH_LENGTH] = ""; + + if (default_inst[0] == '\0') { + i = sysinfo(SI_PLATFORM, default_inst, ARCH_LENGTH); + if (i < 0 || i > ARCH_LENGTH) + return (NULL); + } + return (default_inst); +} + +/* * Function: be_run_cmd * Description: * Runs a command in a separate subprocess. Splits out stdout from stderr @@ -3087,7 +3116,11 @@ be_run_cmd(char *command, char *stderr_buf, int stderr_bufsize, rval = BE_ERR_EXTCMD; } else if (WIFEXITED(exit_status)) { exit_status = (int)((char)WEXITSTATUS(exit_status)); - if (exit_status != 0) { + /* + * error code BC_NOUPDT means more recent version + * is installed + */ + if (exit_status != BC_SUCCESS && exit_status != BC_NOUPDT) { (void) snprintf(oneline, BUFSIZ, gettext("be_run_cmd: " "command terminated with error status: %d\n"), exit_status); |