From a63c99a2145c99a38d5ff19422b132400428ed9d Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Tue, 7 Jul 2015 17:58:51 +0300 Subject: 6080 libbe should support installboot Reviewed by: Igor Kozhukhov Reviewed by: Alexander Pyhalov Reviewed by: Richard Lowe Approved by: Robert Mustacchi --- usr/src/lib/libbe/common/be_utils.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'usr/src/lib/libbe/common/be_utils.c') 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 */ @@ -57,6 +58,7 @@ #include #include +#include /* Private function prototypes */ static int update_dataset(char *, int, char *, char *, char *); @@ -2975,6 +2977,33 @@ be_get_default_isa(void) return (default_inst); } +/* + * 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: @@ -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); -- cgit v1.2.3