usr/src/cmd/auto-install/auto_parse.c
author Sue Sohn <Susan.Sohn@Oracle.COM>
Fri, 20 Aug 2010 11:31:18 -0600
changeset 862 e9f31f2f2f2d
parent 846 70dd9e819f25
child 1075 df96871c232d
permissions -rw-r--r--
16423 Updates to AI schema should be made 15449 installadm add validates combined manifest against image-specific schema as well as schema in /usr/share/auto_install/ 6975043 separate criteria and ai manifest 6975686 installadm list shows value rather than range if lower bound is 0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
     1
/*
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
     2
 * CDDL HEADER START
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
     3
 *
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
     7
 *
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    11
 * and limitations under the License.
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    12
 *
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    18
 *
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    19
 * CDDL HEADER END
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    20
 */
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    21
/*
822
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
    22
 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    23
 */
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    24
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    25
#include <fcntl.h>
679
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    26
#include <libintl.h>
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    27
#include <stdio.h>
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    28
#include <errno.h>
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    29
#include <stdlib.h>
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    30
#include <strings.h>
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    31
#include <unistd.h>
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    32
#include <locale.h>
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    33
#include <sys/param.h>
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    34
#include <sys/types.h>
679
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    35
#include <sys/wait.h>
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    36
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    37
#include "auto_install.h"
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    38
822
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
    39
static PyObject *manifest_serv_obj;
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
    40
static char *manifest_filename;
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    41
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
    42
/*
846
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    43
 * Function to execute shell commands in a thread-safe manner. Output from
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    44
 * stdout is captured in install log file.
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    45
 *
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    46
 * Parameters:
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    47
 *	cmd - the command to execute
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    48
 *
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    49
 * Return:
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    50
 *	-1 if popen() failed, otherwise exit code returned by command
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    51
 *
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    52
 * Status:
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    53
 *	private
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    54
 */
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    55
static int
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    56
ai_exec_cmd(char *cmd)
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    57
{
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    58
	FILE	*p;
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    59
	char	buf[MAX_SHELLCMD_LEN];
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    60
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    61
	auto_debug_print(AUTO_DBGLVL_INFO, "exec cmd: %s\n", cmd);
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    62
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    63
	if ((p = popen(cmd, "r")) == NULL) {
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    64
		auto_debug_print(AUTO_DBGLVL_ERR,
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    65
		    "Could not execute following command: %s.\n", cmd);
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    66
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    67
		return (-1);
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    68
	}
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    69
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    70
	/*
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    71
	 * capture stdout for debugging purposes
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    72
	 */
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    73
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    74
	while (fgets(buf, sizeof (buf), p) != NULL)
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    75
		auto_debug_print(AUTO_DBGLVL_ERR, " %s", buf);
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    76
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    77
	return (WEXITSTATUS(pclose(p)));
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    78
}
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    79
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
    80
/*
679
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    81
 * Dump errors found during syntactic validation of AI manifest -
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
    82
 * repeat the xmllint(1) call made on the Python side to capture the
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
    83
 * stdout and stderr.  xmllint will be called with following parameters:
679
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    84
 *
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
    85
 * /usr/bin/xmllint --noout --dtdvalid <schema> --dtdattr <manifest> 2>&1
679
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    86
 *
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    87
 * Returns
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    88
 * 	-1  - failed to dump syntactic errors
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    89
 *	>=0 - exit code from xmllint(1M)
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    90
 */
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    91
static int
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    92
dump_ai_manifest_errors(char *manifest, char *schema)
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    93
{
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    94
	char	*cmd;
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    95
	size_t	cmd_ln;
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    96
	int	ret;
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
    97
	char *dtd_xmllint =
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
    98
	    "/usr/bin/xmllint --noout --dtdvalid %s --dtdattr %s 2>&1";
679
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
    99
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   100
	/* calculate size of command string */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   101
	cmd_ln = snprintf(NULL, 0, dtd_xmllint, schema, manifest);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   102
	cmd = (char *)malloc(cmd_ln + 1);
679
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   103
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   104
	if (cmd == NULL) {
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   105
		auto_debug_print(AUTO_DBGLVL_ERR, "malloc() failed\n");
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   106
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   107
		return (-1);
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   108
	}
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   109
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   110
	(void) snprintf(cmd, cmd_ln + 1, dtd_xmllint, schema, manifest);
679
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   111
846
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
   112
	ret = ai_exec_cmd(cmd);
679
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   113
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   114
	/*
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   115
	 * The validation is expected to fail - command returns
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   116
	 * with non-zero exit code - log the exit code.
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   117
	 *
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   118
	 */
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   119
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   120
	auto_debug_print(AUTO_DBGLVL_ERR,
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   121
	    "xmllint(1M) returned with exit code %d\n", ret);
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   122
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   123
	free(cmd);
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   124
	return (ret);
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   125
}
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   126
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   127
/*
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   128
 * Translate size units from manifest into auto_size_units_t values.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   129
 *
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   130
 * Defaults to AI_SIZE_UNITS_MEGABYTES if no value given or value
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   131
 * not recognized.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   132
 *
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   133
 * Returns
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   134
 *  auto_size_units_t
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   135
 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   136
static auto_size_units_t
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   137
get_size_units(char *p_str)
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   138
{
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   139
	if ((p_str == NULL) || (! strlen(p_str))) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   140
		return (AI_SIZE_UNITS_MEGABYTES);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   141
	}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   142
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   143
	switch (p_str[0]) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   144
		case 's':
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   145
		case 'S':
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   146
			return (AI_SIZE_UNITS_SECTORS);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   147
		case 'g':
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   148
		case 'G':
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   149
			return (AI_SIZE_UNITS_GIGABYTES);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   150
		case 't':
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   151
		case 'T':
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   152
			return (AI_SIZE_UNITS_TERABYTES);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   153
		case 'm':
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   154
		case 'M':
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   155
		default:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   156
			return (AI_SIZE_UNITS_MEGABYTES);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   157
	}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   158
}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   159
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   160
/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   161
 * Convert size from one unit of measurement to another.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   162
 *
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   163
 * Supported units are the auto_size_units_t enumeration:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   164
 *  AI_SIZE_UNITS_SECTORS
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   165
 *  AI_SIZE_UNITS_MEGABYTES
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   166
 *  AI_SIZE_UNITS_GIGABYTES
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   167
 *  AI_SIZE_UNITS_TERABYTES
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   168
 * If either from_units or to_units params are not recognized, disk_size is
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   169
 * returned unaltered.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   170
 *
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   171
 * Returns
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   172
 *  uint64_t
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   173
 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   174
static uint64_t
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   175
convert_disk_size(uint64_t disk_size, auto_size_units_t from_units,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   176
    auto_size_units_t to_units)
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   177
{
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   178
	uint64_t retval = disk_size;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   179
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   180
	switch (to_units) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   181
		case AI_SIZE_UNITS_SECTORS:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   182
			switch (from_units) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   183
				case AI_SIZE_UNITS_SECTORS:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   184
					retval = disk_size;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   185
				case AI_SIZE_UNITS_MEGABYTES:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   186
					retval = disk_size * MB_TO_SECTORS;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   187
				case AI_SIZE_UNITS_GIGABYTES:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   188
					retval = disk_size * GB_TO_MB *
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   189
					    MB_TO_SECTORS;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   190
				case AI_SIZE_UNITS_TERABYTES:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   191
					retval = disk_size * TB_TO_GB *
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   192
					    GB_TO_MB * MB_TO_SECTORS;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   193
			}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   194
		case AI_SIZE_UNITS_MEGABYTES:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   195
			switch (from_units) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   196
				case AI_SIZE_UNITS_SECTORS:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   197
					retval = disk_size / MB_TO_SECTORS;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   198
				case AI_SIZE_UNITS_MEGABYTES:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   199
					retval = disk_size;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   200
				case AI_SIZE_UNITS_GIGABYTES:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   201
					retval = disk_size * GB_TO_MB;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   202
				case AI_SIZE_UNITS_TERABYTES:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   203
					retval = disk_size * TB_TO_GB *
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   204
					    GB_TO_MB;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   205
			}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   206
		case AI_SIZE_UNITS_GIGABYTES:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   207
			switch (from_units) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   208
				case AI_SIZE_UNITS_SECTORS:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   209
					retval = disk_size / GB_TO_MB /
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   210
					    MB_TO_SECTORS;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   211
				case AI_SIZE_UNITS_MEGABYTES:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   212
					retval = disk_size / GB_TO_MB;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   213
				case AI_SIZE_UNITS_GIGABYTES:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   214
					retval = disk_size;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   215
				case AI_SIZE_UNITS_TERABYTES:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   216
					retval = disk_size * TB_TO_GB;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   217
			}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   218
		case AI_SIZE_UNITS_TERABYTES:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   219
			switch (from_units) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   220
				case AI_SIZE_UNITS_SECTORS:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   221
					retval = disk_size / MB_TO_SECTORS /
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   222
					    GB_TO_MB / TB_TO_GB;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   223
				case AI_SIZE_UNITS_MEGABYTES:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   224
					retval = disk_size / GB_TO_MB /
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   225
					    TB_TO_GB;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   226
				case AI_SIZE_UNITS_GIGABYTES:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   227
					retval = disk_size / TB_TO_GB;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   228
				case AI_SIZE_UNITS_TERABYTES:
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   229
					retval = disk_size;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   230
			}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   231
	}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   232
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   233
	return (retval);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   234
}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   235
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   236
/*
822
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   237
 * Create the manifest data image in memory.  (Does not validate it.)
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   238
 *
822
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   239
 * Import the manifest into an in-memory tree
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   240
 * that can subsequently be queried for the various
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   241
 * attributes. A handle to the in-memory tree is stored
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   242
 * as a ManifestServ object pointed to by manifest_serv_obj.
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   243
 *
822
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   244
 * The manifest filename is saved for later use, in manifest_filename.
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   245
 *
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   246
 * Note that this function must be called before anything else which
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   247
 * references manifest_serv_obj or manifest_filename in this module.
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   248
 *
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   249
 * Returns
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   250
 * 	AUTO_VALID_MANIFEST if it's a valid manifest
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   251
 * 	AUTO_INVALID_MANIFEST if it's an invalid manifest
294
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
   252
 */
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   253
int
822
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   254
ai_create_manifest_image(char *filename)
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   255
{
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   256
	/*
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   257
	 * If the manifest_serv_obj is set it means that
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   258
	 * the manifest has already been validated and
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   259
	 * a server object created for it
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   260
	 */
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   261
	if (manifest_serv_obj != NULL)
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   262
		return (AUTO_VALID_MANIFEST);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   263
822
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   264
	manifest_filename = NULL;
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   265
	manifest_serv_obj = ai_create_manifestserv(filename);
822
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   266
	if (manifest_serv_obj != NULL) {
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   267
		manifest_filename = strdup(filename);
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   268
		return (AUTO_VALID_MANIFEST);
822
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   269
	}
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   270
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   271
	auto_log_print(gettext("Failure to create manifest data in memory.\n"));
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   272
	return (AUTO_INVALID_MANIFEST);
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   273
}
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   274
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   275
/*
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   276
 * Validate the manifest syntactically as well as
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   277
 * semantically.
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   278
 *
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   279
 * As part of the validation process, fill in the
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   280
 * defaults for the attributes that aren't specified.
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   281
 *
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   282
 * Returns
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   283
 * 	AUTO_VALID_MANIFEST if it's a valid manifest
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   284
 * 	AUTO_INVALID_MANIFEST if it's an invalid manifest
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   285
 */
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   286
int
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   287
ai_setup_manifest_image()
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   288
{
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   289
	if (ai_setup_manifestserv(manifest_serv_obj) == AUTO_INSTALL_SUCCESS) {
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   290
		return (AUTO_VALID_MANIFEST);
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   291
	}
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   292
679
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   293
	/*
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   294
	 * if the validation process failed, capture output of syntactic
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   295
	 * validation in log file
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   296
	 */
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   297
	auto_log_print(gettext("Syntactic validation of the manifest failed "
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   298
	    "with following errors\n"));
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   299
822
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   300
	if (dump_ai_manifest_errors(
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   301
	    manifest_filename, AI_MANIFEST_SCHEMA) == -1) {
679
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   302
		auto_log_print(gettext("Failed to obtain result of syntactic "
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   303
		    "validation\n"));
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   304
	}
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   305
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   306
	return (AUTO_INVALID_MANIFEST);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   307
}
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   308
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   309
void
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   310
ai_teardown_manifest_state()
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   311
{
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   312
	if (manifest_serv_obj != NULL)
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   313
		(void) ai_destroy_manifestserv(manifest_serv_obj);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   314
}
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   315
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   316
char **
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   317
ai_get_manifest_values(char *path, int *len)
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   318
{
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   319
	if (manifest_serv_obj == NULL) {
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   320
		auto_debug_print(AUTO_DBGLVL_INFO, "manifestserv must be "
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   321
		    "initialized before values can be retrieved\n");
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   322
		return (NULL);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   323
	}
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   324
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   325
	return (ai_lookup_manifest_values(manifest_serv_obj, path, len));
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   326
}
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   327
822
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   328
/*
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   329
 * Free memory allocated by ai_get_manifest_values().
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   330
 */
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   331
void
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   332
ai_free_manifest_values(char **value_list)
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   333
{
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   334
	ai_free_manifest_value_list(value_list);
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   335
}
2ba2b98f055e 10129 Blocker bug for Driver Update project
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents: 810
diff changeset
   336
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   337
/*
471
5a23ff9e7f8c 7219 Automated Installer reports slice customization in manifest where none exist
William Schumann <william.schumann@sun.com>
parents: 461
diff changeset
   338
 * ai_get_manifest_element_value() - return value given xml element
405
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   339
 */
461
c51e3b699738 6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents: 460
diff changeset
   340
char *
471
5a23ff9e7f8c 7219 Automated Installer reports slice customization in manifest where none exist
William Schumann <william.schumann@sun.com>
parents: 461
diff changeset
   341
ai_get_manifest_element_value(char *element)
405
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   342
{
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   343
	int len = 0;
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   344
	char **value;
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
   345
	char *evalue;
405
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   346
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   347
	value = ai_get_manifest_values(element, &len);
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   348
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
   349
	/*
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
   350
	 * Return the value and free the pointer
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
   351
	 */
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
   352
	if (len > 0) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
   353
		evalue = *value;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
   354
		free(value);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
   355
		return (evalue);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
   356
	}
405
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   357
	return (NULL);
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   358
}
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   359
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   360
/*
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   361
 * get_manifest_element_array() - return list of values given xml element
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   362
 */
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   363
static char **
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   364
get_manifest_element_array(char *element)
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   365
{
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   366
	int len = 0;
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   367
	char **value;
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   368
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   369
	value = ai_get_manifest_values(element, &len);
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   370
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   371
	if (len > 0)
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   372
		return (value);
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   373
	return (NULL);
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   374
}
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   375
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   376
/*
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   377
 * Retrieve the target disk information
658
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   378
 *
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   379
 * If illegal values, return AUTO_INSTALL_FAILURE
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   380
 * else return AUTO_INSTALL_SUCCESS
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   381
 */
658
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   382
int
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   383
ai_get_manifest_disk_info(auto_disk_info *adi)
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   384
{
294
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
   385
	char *p;
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
   386
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   387
	p = ai_get_manifest_element_value(AIM_TARGET_DISK_KEYWORD);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   388
	if (p != NULL)
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   389
		(void) strncpy(adi->diskkeyword, p, sizeof (adi->diskkeyword));
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   390
471
5a23ff9e7f8c 7219 Automated Installer reports slice customization in manifest where none exist
William Schumann <william.schumann@sun.com>
parents: 461
diff changeset
   391
	p = ai_get_manifest_element_value(AIM_TARGET_DEVICE_NAME);
294
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
   392
	if (p != NULL)
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
   393
		(void) strncpy(adi->diskname, p, sizeof (adi->diskname));
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
   394
471
5a23ff9e7f8c 7219 Automated Installer reports slice customization in manifest where none exist
William Schumann <william.schumann@sun.com>
parents: 461
diff changeset
   395
	p = ai_get_manifest_element_value(AIM_TARGET_DEVICE_TYPE);
294
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
   396
	if (p != NULL)
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
   397
		(void) strncpy(adi->disktype, p, sizeof (adi->disktype));
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   398
471
5a23ff9e7f8c 7219 Automated Installer reports slice customization in manifest where none exist
William Schumann <william.schumann@sun.com>
parents: 461
diff changeset
   399
	p = ai_get_manifest_element_value(AIM_TARGET_DEVICE_VENDOR);
294
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
   400
	if (p != NULL)
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
   401
		(void) strncpy(adi->diskvendor, p, sizeof (adi->diskvendor));
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
   402
679
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   403
	p = ai_get_manifest_element_value(AIM_TARGET_DEVICE_SELECT_VOLUME_NAME);
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   404
	if (p != NULL)
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   405
		(void) strlcpy(adi->diskvolname, p, sizeof (adi->diskvolname));
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   406
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   407
	p = ai_get_manifest_element_value(AIM_TARGET_DEVICE_SELECT_DEVICE_ID);
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   408
	if (p != NULL)
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   409
		(void) strlcpy(adi->diskdevid, p, sizeof (adi->diskdevid));
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   410
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   411
	p = ai_get_manifest_element_value(AIM_TARGET_DEVICE_SELECT_DEVICE_PATH);
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   412
	if (p != NULL)
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   413
		(void) strlcpy(adi->diskdevicepath, p,
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   414
		    sizeof (adi->diskdevicepath));
2f04e6d1a235 5451 No way to permanently target specific disk in AI engine manifest
Jan Damborsky <jan.damborsky@sun.com>
parents: 667
diff changeset
   415
471
5a23ff9e7f8c 7219 Automated Installer reports slice customization in manifest where none exist
William Schumann <william.schumann@sun.com>
parents: 461
diff changeset
   416
	p = ai_get_manifest_element_value(AIM_TARGET_DEVICE_SIZE);
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   417
	if (p != NULL) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   418
		char *endptr;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   419
		uint64_t disk_size;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   420
		auto_size_units_t size_units;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   421
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   422
		errno = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   423
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   424
		/* Get the numerical portion of the size value */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   425
		disk_size = (uint64_t)strtoull(p, &endptr, 0);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   426
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   427
		if (errno == 0 && endptr != p) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   428
			/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   429
			 * Get the units portion of the size val and then
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   430
			 * convert the size from given units into number
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   431
			 * of disk sectors.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   432
			 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   433
			size_units = get_size_units(endptr);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   434
			adi->disksize = convert_disk_size(disk_size, size_units,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   435
			    AI_SIZE_UNITS_SECTORS);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   436
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   437
			auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   438
			    "Requested target size [%s] converted "
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   439
			    "to [%lld] sectors\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   440
			    p, adi->disksize);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   441
		} else {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   442
			auto_log_print(
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   443
			    "Invalid target device size specified: [%s]",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   444
			    p);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   445
			return (AUTO_INSTALL_FAILURE);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   446
		}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   447
	}
294
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
   448
471
5a23ff9e7f8c 7219 Automated Installer reports slice customization in manifest where none exist
William Schumann <william.schumann@sun.com>
parents: 461
diff changeset
   449
	p = ai_get_manifest_element_value(
5a23ff9e7f8c 7219 Automated Installer reports slice customization in manifest where none exist
William Schumann <william.schumann@sun.com>
parents: 461
diff changeset
   450
	    AIM_TARGET_DEVICE_USE_SOLARIS_PARTITION);
414
ad63b7c430bb 5739 AutomatedInstaller cannot find disks when default manifest is used
William Schumann <william.schumann@sun.com>
parents: 409
diff changeset
   451
	if (p != NULL) {
ad63b7c430bb 5739 AutomatedInstaller cannot find disks when default manifest is used
William Schumann <william.schumann@sun.com>
parents: 409
diff changeset
   452
#ifdef	__sparc
ad63b7c430bb 5739 AutomatedInstaller cannot find disks when default manifest is used
William Schumann <william.schumann@sun.com>
parents: 409
diff changeset
   453
		auto_log_print("Warning: ignoring manifest element "
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   454
		    "partition action='use_existing' on SPARC\n");
414
ad63b7c430bb 5739 AutomatedInstaller cannot find disks when default manifest is used
William Schumann <william.schumann@sun.com>
parents: 409
diff changeset
   455
#else
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   456
		/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   457
		 * In this Schema, a partition with attribute
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   458
		 * action="use_existing" corresponds to
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   459
		 * target_device_use_solaris_partition="true"
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   460
		 * in the previous schema.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   461
		 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   462
		(void) strncpy(adi->diskusepart, "true",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   463
		    sizeof (adi->diskusepart));
414
ad63b7c430bb 5739 AutomatedInstaller cannot find disks when default manifest is used
William Schumann <william.schumann@sun.com>
parents: 409
diff changeset
   464
#endif
ad63b7c430bb 5739 AutomatedInstaller cannot find disks when default manifest is used
William Schumann <william.schumann@sun.com>
parents: 409
diff changeset
   465
	}
294
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
   466
471
5a23ff9e7f8c 7219 Automated Installer reports slice customization in manifest where none exist
William Schumann <william.schumann@sun.com>
parents: 461
diff changeset
   467
	p = ai_get_manifest_element_value(
5a23ff9e7f8c 7219 Automated Installer reports slice customization in manifest where none exist
William Schumann <william.schumann@sun.com>
parents: 461
diff changeset
   468
	    AIM_TARGET_DEVICE_INSTALL_SLICE_NUMBER);
405
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   469
	if (p != NULL) {
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   470
		int install_slice_number;
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   471
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   472
		if (sscanf(p, "%d", &install_slice_number) > 0)
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   473
			adi->install_slice_number =
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   474
			    (uint8_t)install_slice_number;
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
   475
	}
658
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   476
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   477
	/*
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   478
	 * iSCSI target information
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   479
	 */
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   480
	p = ai_get_manifest_element_value(AIM_TARGET_DEVICE_ISCSI_TARGET_NAME);
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   481
	if (p != NULL)
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   482
		(void) strncpy(adi->diskiscsi.name, p,
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   483
		    sizeof (adi->diskiscsi.name));
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   484
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   485
	p = ai_get_manifest_element_value(AIM_TARGET_DEVICE_ISCSI_TARGET_IP);
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   486
	if (p != NULL)
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   487
		(void) strncpy(adi->diskiscsi.ip, p,
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   488
		    sizeof (adi->diskiscsi.ip));
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   489
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   490
	p = ai_get_manifest_element_value(AIM_TARGET_DEVICE_ISCSI_TARGET_LUN);
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   491
	if (p != NULL)
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   492
		(void) strncpy(adi->diskiscsi.lun, p,
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   493
		    sizeof (adi->diskiscsi.lun));
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   494
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   495
	p = ai_get_manifest_element_value(AIM_TARGET_DEVICE_ISCSI_TARGET_PORT);
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   496
	if (p != NULL)
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   497
		adi->diskiscsi.port = strtoll(p, NULL, 0);
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   498
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   499
	p = ai_get_manifest_element_value(
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   500
	    AIM_TARGET_DEVICE_ISCSI_PARAMETER_SOURCE);
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   501
	if (p == NULL)
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   502
		adi->diskiscsi.parm_src = AI_ISCSI_PARM_SRC_MANIFEST;
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   503
	else {
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   504
		if (strcasecmp(p, "manifest") == 0)
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   505
			adi->diskiscsi.parm_src = AI_ISCSI_PARM_SRC_MANIFEST;
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   506
		else if (strcasecmp(p, "dhcp") == 0)
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   507
			adi->diskiscsi.parm_src = AI_ISCSI_PARM_SRC_DHCP;
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   508
		else {
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   509
			auto_log_print("Invalid iSCSI parameter source "
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   510
			    "specified. Tag="
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   511
			    AIM_TARGET_DEVICE_ISCSI_PARAMETER_SOURCE "\n");
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   512
			auto_log_print("Value=%s\n", p);
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   513
			auto_log_print("Possible values: DHCP, MANIFEST "
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   514
			    "(default)\n");
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   515
			return (AUTO_INSTALL_FAILURE);
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   516
		}
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   517
	}
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   518
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   519
	/* Debug - print disk info out to log */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   520
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   521
	    "Disk info from Manifest:\n");
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   522
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   523
	    "\tdiskkeyword\t\t\t: [%s]\n", adi->diskkeyword);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   524
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   525
	    "\tdiskname\t\t\t: [%s]\n", adi->diskname);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   526
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   527
	    "\tdisktype\t\t\t: [%s]\n", adi->disktype);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   528
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   529
	    "\tdiskvendor\t\t\t: [%s]\n", adi->diskvendor);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   530
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   531
	    "\tdiskvolname\t\t\t: [%s]\n", adi->diskvolname);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   532
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   533
	    "\tdiskdevid\t\t\t: [%s]\n", adi->diskdevid);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   534
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   535
	    "\tdiskdevicepath\t\t: [%s]\n", adi->diskdevicepath);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   536
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   537
	    "\tdisksize\t\t\t: [%d]\n", adi->disksize);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   538
#ifndef	__sparc
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   539
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   540
	    "\tdiskusepart\t\t\t: [%s]\n", adi->diskusepart);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   541
#endif
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   542
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   543
	    "\tdiskiscsi.name\t\t: [%s]\n", adi->diskiscsi.name);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   544
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   545
	    "\tdiskiscsi.ip\t\t: [%s]\n", adi->diskiscsi.ip);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   546
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   547
	    "\tdiskiscsi.port\t\t: [%d]\n", adi->diskiscsi.port);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   548
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   549
	    "\tdiskiscsi.lun\t\t: [%s]\n", adi->diskiscsi.lun);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   550
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   551
	    "\tdiskiscsi.parm_src\t: [%d] (= %s)\n", adi->diskiscsi.parm_src,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   552
	    adi->diskiscsi.parm_src ? "DHCP" : "MANIFEST");
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   553
	auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   554
	    "\tinstall_slice_num.\t: [%d]\n", adi->install_slice_number);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   555
658
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   556
	return (AUTO_INSTALL_SUCCESS);
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   557
}
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   558
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   559
/*
789
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   560
 * Retrieve the device swap request information
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   561
 *
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   562
 * If illegal values, return AUTO_INSTALL_FAILURE
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   563
 * else return AUTO_INSTALL_SUCCESS.
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   564
 * Existence of these manifest items is optional.
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   565
 */
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   566
int
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   567
ai_get_manifest_swap_device_info(auto_swap_device_info *adsi)
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   568
{
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   569
	char *p;
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   570
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   571
	adsi->swap_size = -1;
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   572
	p = ai_get_manifest_element_value(AIM_SWAP_SIZE);
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   573
	if (p != NULL) {
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   574
		char *endptr;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   575
		int32_t swap_size;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   576
		auto_size_units_t size_units;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   577
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   578
		errno = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   579
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   580
		/* Get the numerical portion of the size value */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   581
		swap_size = (int32_t)strtol(p, &endptr, 0);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   582
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   583
		if (errno == 0 && endptr != p) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   584
			/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   585
			 * Get the units portion of the size val and
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   586
			 * then convert the size from given units into MB.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   587
			 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   588
			size_units = get_size_units(endptr);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   589
			adsi->swap_size = (int32_t)convert_disk_size(swap_size,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   590
			    size_units,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   591
			    AI_SIZE_UNITS_MEGABYTES);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   592
789
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   593
			auto_debug_print(AUTO_DBGLVL_INFO,
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   594
			    "Requested swap size [%s] converted to [%d] MB\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   595
			    p, adsi->swap_size);
789
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   596
		} else {
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   597
			adsi->swap_size = 0;
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   598
			auto_log_print("Invalid swap size "
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   599
			    "specified. Tag="
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   600
			    AIM_SWAP_SIZE "\n");
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   601
			auto_log_print("Value=%s\n", p);
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   602
			return (AUTO_INSTALL_FAILURE);
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   603
		}
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   604
	}
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   605
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   606
	return (AUTO_INSTALL_SUCCESS);
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   607
}
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   608
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   609
/*
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   610
 * Retrieve the device dump request information
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   611
 *
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   612
 * If illegal values, return AUTO_INSTALL_FAILURE
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   613
 * else return AUTO_INSTALL_SUCCESS.
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   614
 * Existence of these manifest items is optional.
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   615
 */
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   616
int
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   617
ai_get_manifest_dump_device_info(auto_dump_device_info *addi)
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   618
{
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   619
	char *p;
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   620
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   621
	addi->dump_size = -1;
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   622
	p = ai_get_manifest_element_value(AIM_DUMP_SIZE);
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   623
	if (p != NULL) {
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   624
		char *endptr;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   625
		int32_t dump_size;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   626
		auto_size_units_t size_units;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   627
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   628
		errno = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   629
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   630
		/* Get the numerical portion of the size value */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   631
		dump_size = (int32_t)strtol(p, &endptr, 0);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   632
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   633
		if (errno == 0 && endptr != p) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   634
			/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   635
			 * Get the units portion of the size val and
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   636
			 * then convert the size from given units into MB.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   637
			 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   638
			size_units = get_size_units(endptr);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   639
			addi->dump_size = (int32_t)convert_disk_size(dump_size,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   640
			    size_units,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   641
			    AI_SIZE_UNITS_MEGABYTES);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   642
789
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   643
			auto_debug_print(AUTO_DBGLVL_INFO,
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   644
			    "Requested dump size [%s] converted to [%d] MB\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   645
			    p, addi->dump_size);
789
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   646
		} else {
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   647
			addi->dump_size = 0;
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   648
			auto_log_print("Invalid dump device size "
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   649
			    "specified. Tag="
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   650
			    AIM_DUMP_SIZE "\n");
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   651
			auto_log_print("Value=%s\n", p);
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   652
			return (AUTO_INSTALL_FAILURE);
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   653
		}
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   654
	}
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   655
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   656
	return (AUTO_INSTALL_SUCCESS);
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   657
}
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   658
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
   659
/*
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   660
 * Create a partition info struct and populate it with details
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   661
 * from the manifest matching the specified tags (enhanced
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   662
 * nodepaths).
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   663
 *
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   664
 * pstatus - return status pointer, must point to valid storage
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   665
 *		If no problems in validating partition info,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   666
 *		set to zero, otherwise set to non-zero value
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   667
 *
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   668
 * This function allocates memory for an auto_partition_info
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   669
 * struct. The caller MUST free this memory.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   670
 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   671
static auto_partition_info *
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   672
get_partition_by_tags(char *number_tag, char *action_tag,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   673
    char *start_tag, char *size_tag, char *type_tag, int *pstatus)
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   674
{
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   675
	auto_partition_info *api;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   676
	char *p;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   677
	char *endptr;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   678
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   679
	api = calloc(sizeof (auto_partition_info), 1);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   680
	if (api == NULL)
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   681
		return (NULL);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   682
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   683
	/* Get the name (number) for this partition */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   684
	p = ai_get_manifest_element_value(number_tag);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   685
	if (p != NULL) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   686
		errno = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   687
		api->partition_number = (int) strtoul(p, &endptr, 10);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   688
		if (errno != 0 || endptr == p) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   689
			auto_debug_print(AUTO_DBGLVL_ERR,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   690
			    "Partition name in manifest (%s) is "
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   691
			    "not a valid value.\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   692
			    p);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   693
			*pstatus = 1;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   694
			free(api);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   695
			errno = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   696
			return (NULL);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   697
		}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   698
	}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   699
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   700
	/* Get the action for this partition */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   701
	p = ai_get_manifest_element_value(action_tag);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   702
	if (p != NULL)
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   703
		(void) strlcpy(api->partition_action, p,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   704
		    sizeof (api->partition_action));
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   705
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   706
	/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   707
	 * Get the start_sector for this partition
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   708
	 *
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   709
	 * set default for starting sector (unspecified)
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   710
	 * stored as unsigned in C, * but signed in XML
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   711
	 * so that -1 can be used in default value manifest
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   712
	 * to tell AI to find best location when starting sector not specified
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   713
	 * see om_create_partition()
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   714
	 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   715
	api->partition_start_sector = (uint64_t)-1LL;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   716
	p = ai_get_manifest_element_value(start_tag);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   717
	if (p != NULL) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   718
		api->partition_start_sector =
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   719
		    (uint64_t)strtoll(p, NULL, 0);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   720
	}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   721
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   722
	/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   723
	 * Get the size (value + units) for this partition.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   724
	 * This is only used for "create" action.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   725
	 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   726
	if (strcmp(api->partition_action, "create") == 0) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   727
		p = ai_get_manifest_element_value(size_tag);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   728
		if (p != NULL) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   729
			errno = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   730
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   731
			/* Get the numerical portion of the size value */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   732
			api->partition_size = strtoull(p, &endptr, 0);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   733
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   734
			if (errno == 0 && endptr != p) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   735
				/* Get the units portion of the size value */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   736
				api->partition_size_units =
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   737
				    get_size_units(endptr);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   738
			} else {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   739
				auto_debug_print(AUTO_DBGLVL_ERR,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   740
				    "Partition size in manifest (%s) is "
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   741
				    "not a valid value.\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   742
				    p);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   743
				*pstatus = 1;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   744
				free(api);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   745
				errno = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   746
				return (NULL);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   747
			}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   748
		} else {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   749
			/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   750
			 * Default to 0mb.  This is not strictly necessary,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   751
			 * as both these values correspond to 0, which was
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   752
			 * the value they were already set to when the struct
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   753
			 * was calloc()ed.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   754
			 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   755
			api->partition_size = (uint64_t) 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   756
			api->partition_size_units = AI_SIZE_UNITS_MEGABYTES;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   757
		}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   758
	}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   759
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   760
	/* Get the filesystem type for this partition */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   761
	p = ai_get_manifest_element_value(type_tag);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   762
	if (p != NULL) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   763
		/* allow some common partition type names */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   764
		if (strcasecmp(p, "SOLARIS") == 0) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   765
			api->partition_type = SUNIXOS2;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   766
			auto_log_print(
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   767
			    "New Solaris2 partition requested\n");
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   768
		} else if (strcasecmp(p, "DOS16") == 0) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   769
			api->partition_type = DOSOS16;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   770
			auto_log_print(
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   771
			    "New 16-bit DOS partition requested\n");
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   772
		} else if (strcasecmp(p, "FAT32") == 0) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   773
			api->partition_type = FDISK_WINDOWS;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   774
			auto_log_print(
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   775
			    "New FAT32 partition requested\n");
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   776
		} else if (strcasecmp(p, "DOSEXT") == 0) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   777
			api->partition_type = EXTDOS;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   778
			auto_log_print(
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   779
			    "New DOS extended partition requested\n");
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   780
		} else if (strcasecmp(p, "DOSEXTLBA") == 0) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   781
			api->partition_type = FDISK_EXTLBA;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   782
			auto_log_print(
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   783
			    "New DOS extended LBA partition requested"
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   784
			    "\n");
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   785
		} else {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   786
            /*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   787
             * Use partition type number, eg "191" to
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   788
             * represent a Solaris partition.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   789
             */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   790
			char *endptr;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   791
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   792
			errno = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   793
			api->partition_type =
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   794
			    strtoull(p, &endptr, 0);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   795
			if (errno != 0 || endptr == p) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   796
				auto_debug_print(AUTO_DBGLVL_ERR,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   797
				    "Partition type in manifest (%s) is "
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   798
				    "not a valid number or partition type.\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   799
				    p);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   800
				*pstatus = 1;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   801
				free(api);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   802
				errno = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   803
				return (NULL);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   804
			}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   805
		}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   806
	}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   807
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   808
	/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   809
	 * Determine if this is a logical partition
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   810
	 * This is inferred from the partition number.  Numbers of
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   811
	 * 5 or greater imply the partition must be logical.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   812
	 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   813
	if (api->partition_number >= 5) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   814
		api->partition_is_logical = B_TRUE;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   815
	}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   816
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   817
	return (api);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   818
}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   819
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   820
/*
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   821
 * Retrieve the information about the partitions
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   822
 * that need to be configured
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   823
 *
449
30ec6432d941 6584 Automated Installer should allow creating non-Solaris partitions
William Schumann <william.schumann@sun.com>
parents: 437
diff changeset
   824
 * pstatus - return status pointer, must point to valid storage
30ec6432d941 6584 Automated Installer should allow creating non-Solaris partitions
William Schumann <william.schumann@sun.com>
parents: 437
diff changeset
   825
 *	If no problems in validating partition info,
30ec6432d941 6584 Automated Installer should allow creating non-Solaris partitions
William Schumann <william.schumann@sun.com>
parents: 437
diff changeset
   826
 *		set to zero, otherwise set to non-zero value
30ec6432d941 6584 Automated Installer should allow creating non-Solaris partitions
William Schumann <william.schumann@sun.com>
parents: 437
diff changeset
   827
 *
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   828
 * This function allocates memory for an array
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   829
 * of auto_partition_info. The caller MUST free this memory
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   830
 */
311
7ec66097ab2e 4074 AI preserve slice will not work if install slice is not specified
William Schumann <william.schumann@sun.com>
parents: 294
diff changeset
   831
auto_partition_info *
449
30ec6432d941 6584 Automated Installer should allow creating non-Solaris partitions
William Schumann <william.schumann@sun.com>
parents: 437
diff changeset
   832
ai_get_manifest_partition_info(int *pstatus)
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   833
{
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   834
	auto_partition_info *ret_api;
311
7ec66097ab2e 4074 AI preserve slice will not work if install slice is not specified
William Schumann <william.schumann@sun.com>
parents: 294
diff changeset
   835
	auto_partition_info *api;
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   836
	int i, j;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   837
	int actions_len = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   838
	int numbered_len = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   839
	int unnumbered_len = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   840
	char **partition_actions;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   841
	char **numbered_partitions;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   842
	char **unnumbered_partitions;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   843
	char *p;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   844
	char number_tag[MAXPATHLEN];
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   845
	char action_tag[MAXPATHLEN];
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   846
	char start_tag[MAXPATHLEN];
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   847
	char size_tag[MAXPATHLEN];
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   848
	char type_tag[MAXPATHLEN];
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   849
449
30ec6432d941 6584 Automated Installer should allow creating non-Solaris partitions
William Schumann <william.schumann@sun.com>
parents: 437
diff changeset
   850
	*pstatus = 0;	/* assume no parsing errors */
30ec6432d941 6584 Automated Installer should allow creating non-Solaris partitions
William Schumann <william.schumann@sun.com>
parents: 437
diff changeset
   851
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   852
	/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   853
	 * The name (number) is not mandatory for partitions, but if a partition
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   854
	 * does not have a name then it must have the action 'use_existing'.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   855
	 * There can only be one 'use_existing' partition specified and it may
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   856
	 * or may not be named.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   857
	 * We will first see if there is an un-named 'use_existing' partition
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   858
	 * in the manifest and if so, fetch its details.  Then we will fetch
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   859
	 * details for all the named partitions, using name+action as a unique
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   860
	 * key.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   861
	 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   863
	unnumbered_partitions = ai_get_manifest_values(
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   864
	    AIM_USE_EXISTING_PARTITIONS, &unnumbered_len);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   865
	numbered_partitions = ai_get_manifest_values(
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   866
	    AIM_NUMBERED_PARTITIONS, &numbered_len);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   867
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   868
	if (unnumbered_partitions == NULL) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   869
		/* ai_get_manifest_values sets len to -1 if none found */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   870
		unnumbered_len = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   871
	} else {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   872
		if (unnumbered_len > 1) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   873
			auto_debug_print(AUTO_DBGLVL_ERR,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   874
			    "Only one 'use_existing' partition is permitted, "
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   875
			    "%d were specified.\n", unnumbered_len);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   876
			*pstatus = 1;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   877
			return (NULL);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   878
		}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   879
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   880
		p = ai_get_manifest_element_value(
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   881
		    AIM_UNNUMBERED_PARTITION_NUMBER);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   882
		if (p != NULL) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   883
			/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   884
			 * There is one 'use_existing' partition but a
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   885
			 * name (number) was specified with it, so it
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   886
			 * will be handled along with numbered
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   887
			 * partitions - no need for specical handling here.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   888
			 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   889
			unnumbered_len = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   890
		}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   891
	}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   892
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   893
	if (numbered_partitions == NULL) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   894
		/* ai_get_manifest_values sets len to -1 if none found */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   895
		numbered_len = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   896
	}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   897
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   898
	if ((unnumbered_len + numbered_len) == 0)
311
7ec66097ab2e 4074 AI preserve slice will not work if install slice is not specified
William Schumann <william.schumann@sun.com>
parents: 294
diff changeset
   899
		return (NULL);
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   900
459
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
   901
	/* len+1 -- '1' for the NULL entry */
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   902
	ret_api = calloc(sizeof (auto_partition_info),
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   903
	    numbered_len + unnumbered_len + 1);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   904
	if (ret_api == NULL)
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   905
		return (NULL);
459
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
   906
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   907
	if (unnumbered_len) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   908
		/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   909
		 * We have exactly one partition whose action is 'use_existing'
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   910
		 * which does not have a name (number) specified.  We need
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   911
		 * to fetch its details seperately from the numbered partitions.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   912
		 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   913
		(void) snprintf(number_tag, sizeof (number_tag),
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   914
		    AIM_UNNUMBERED_PARTITION_NUMBER);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   915
		(void) snprintf(action_tag, sizeof (action_tag),
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   916
		    AIM_UNNUMBERED_PARTITION_ACTION);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   917
		(void) snprintf(start_tag, sizeof (start_tag),
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   918
		    AIM_UNNUMBERED_PARTITION_START_SECTOR);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   919
		(void) snprintf(size_tag, sizeof (size_tag),
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   920
		    AIM_UNNUMBERED_PARTITION_SIZE);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   921
		(void) snprintf(type_tag, sizeof (type_tag),
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   922
		    AIM_UNNUMBERED_PARTITION_TYPE);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   923
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   924
		api = get_partition_by_tags(number_tag, action_tag,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   925
		    start_tag, size_tag, type_tag, pstatus);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   926
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   927
		if (api == NULL) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   928
			free(unnumbered_partitions);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   929
			free(ret_api);
658
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   930
			return (NULL);
831357e2155d 6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents: 635
diff changeset
   931
		}
459
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
   932
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   933
		(void) memcpy(ret_api, api, sizeof (auto_partition_info));
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   934
		free(api);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   935
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   936
		free(unnumbered_partitions);
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
   937
	}
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
   938
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   939
	if (numbered_len) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   940
		partition_actions = ai_get_manifest_values(
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   941
		    AIM_PARTITION_ACTIONS, &actions_len);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   942
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   943
		if (partition_actions == NULL) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   944
			auto_debug_print(AUTO_DBGLVL_ERR,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   945
			    "Error fetching partition actions.\n");
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   946
			*pstatus = 1;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   947
			free(numbered_partitions);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   948
			free(ret_api);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   949
			return (NULL);
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
   950
		}
459
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
   951
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   952
		if (unnumbered_len) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   953
			/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   954
			 * Remove the unnamed 'use_existing' partition from
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   955
			 * partition_actions.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   956
			 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   957
			for (i = 0; i < actions_len; i++) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   958
				if (strcmp(partition_actions[i],
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   959
				    "use_existing") == 0) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   960
					/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   961
					 * Shuffle the remaining items up
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   962
					 * one position.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   963
					 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   964
					for (j = i; j < (actions_len - 1);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   965
					    j++) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   966
						partition_actions[j] =
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   967
						    partition_actions[j+1];
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   968
					}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   969
					partition_actions[actions_len] = NULL;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   970
					actions_len--;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   971
				}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   972
			}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   973
		}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   974
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   975
		if (numbered_len != actions_len) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   976
			if (numbered_len < actions_len) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   977
				/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   978
				 * If this mismatch occurs, there must have
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   979
				 * been an unnamed partion whose action is
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   980
				 * not 'use_existing'.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   981
				 */
667
808a042e4938 1777 Installer doesn't recognize logical volumes defined within extended partition
William Schumann <william.schumann@sun.com>
parents: 664
diff changeset
   982
				auto_debug_print(AUTO_DBGLVL_ERR,
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   983
				    "Invalid unnamed partition specified in "
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   984
				    "manifest. Only one unnamed partition "
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   985
				    "allowed, whose action must be "
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   986
				    "'use_existing'.\n");
667
808a042e4938 1777 Installer doesn't recognize logical volumes defined within extended partition
William Schumann <william.schumann@sun.com>
parents: 664
diff changeset
   987
				*pstatus = 1;
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   988
				free(numbered_partitions);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   989
				free(partition_actions);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   990
				free(ret_api);
667
808a042e4938 1777 Installer doesn't recognize logical volumes defined within extended partition
William Schumann <william.schumann@sun.com>
parents: 664
diff changeset
   991
				return (NULL);
459
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
   992
			} else {
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
   993
				auto_debug_print(AUTO_DBGLVL_ERR,
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   994
				    "Error matching partition actions to "
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   995
				    "names.\n");
459
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
   996
				*pstatus = 1;
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   997
				free(numbered_partitions);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   998
				free(partition_actions);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
   999
				free(ret_api);
459
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1000
				return (NULL);
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1001
			}
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1002
		}
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1003
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1004
		/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1005
		 * One or more numbered partitions have been specified.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1006
		 * Fetch the necessary details for each.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1007
		 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1008
		for (i = 0; i < numbered_len; i++) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1009
			(void) snprintf(number_tag, sizeof (number_tag),
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1010
			    AIM_NUMBERED_PARTITION_NUMBER,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1011
			    numbered_partitions[i], partition_actions[i]);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1012
			(void) snprintf(action_tag, sizeof (action_tag),
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1013
			    AIM_NUMBERED_PARTITION_ACTION,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1014
			    numbered_partitions[i], partition_actions[i]);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1015
			(void) snprintf(start_tag, sizeof (start_tag),
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1016
			    AIM_NUMBERED_PARTITION_START_SECTOR,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1017
			    numbered_partitions[i], partition_actions[i]);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1018
			(void) snprintf(size_tag, sizeof (size_tag),
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1019
			    AIM_NUMBERED_PARTITION_SIZE,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1020
			    numbered_partitions[i], partition_actions[i]);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1021
			(void) snprintf(type_tag, sizeof (type_tag),
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1022
			    AIM_NUMBERED_PARTITION_TYPE,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1023
			    numbered_partitions[i], partition_actions[i]);
449
30ec6432d941 6584 Automated Installer should allow creating non-Solaris partitions
William Schumann <william.schumann@sun.com>
parents: 437
diff changeset
  1024
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1025
			api = get_partition_by_tags(number_tag, action_tag,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1026
			    start_tag, size_tag, type_tag, pstatus);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1027
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1028
			if (api == NULL) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1029
				free(numbered_partitions);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1030
				free(ret_api);
449
30ec6432d941 6584 Automated Installer should allow creating non-Solaris partitions
William Schumann <william.schumann@sun.com>
parents: 437
diff changeset
  1031
				return (NULL);
30ec6432d941 6584 Automated Installer should allow creating non-Solaris partitions
William Schumann <william.schumann@sun.com>
parents: 437
diff changeset
  1032
			}
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1033
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1034
			(void) memcpy((ret_api + unnumbered_len + i),
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1035
			    api, sizeof (auto_partition_info));
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1036
			free(api);
449
30ec6432d941 6584 Automated Installer should allow creating non-Solaris partitions
William Schumann <william.schumann@sun.com>
parents: 437
diff changeset
  1037
		}
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1038
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1039
		free(numbered_partitions);
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1040
	}
405
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
  1041
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1042
	/* Debug - print partition info out to log */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1043
	api = ret_api;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1044
	for (; api->partition_action[0] != '\0'; api++) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1045
		auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1046
		    "Partition details from Manifest:\n");
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1047
		auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1048
		    "\tpartition_action\t\t: [%s]\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1049
		    api->partition_action);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1050
		auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1051
		    "\tpartition_number\t\t: [%d]\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1052
		    api->partition_number);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1053
		auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1054
		    "\tpartition_start_sector\t: [%lld]\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1055
		    api->partition_start_sector);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1056
		auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1057
		    "\tpartition_size\t\t\t: [%lld]\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1058
		    api->partition_size);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1059
		auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1060
		    "\tpartition_type\t\t\t: [%d]\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1061
		    api->partition_type);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1062
		auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1063
		    "\tpartition_size_units\t: [%d] (= %s)\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1064
		    (int)api->partition_size_units,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1065
		    CONVERT_UNITS_TO_TEXT(api->partition_size_units));
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1066
		auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1067
		    "\tpartition_is_logical\t: [%d] (= %s)\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1068
		    (int)api->partition_is_logical,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1069
		    api->partition_is_logical ? "true" : "false");
409
141e3dc11d9f 4460 "partition_size" tag in ai_manifest.xml template should mention sectors
William Schumann <william.schumann@sun.com>
parents: 405
diff changeset
  1070
	}
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1071
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1072
	return (ret_api);
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1073
}
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1074
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1075
/*
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1076
 * Retrieve the vtoc slice information
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1077
 *
459
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1078
 * pstatus - return status pointer, must point to valid storage
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1079
 *	If no problems in validating slice info,
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1080
 *		set to zero, otherwise set to non-zero value
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1081
 *
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1082
 * This function allocates memory for an array
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1083
 * of auto_slice_info. The caller MUST free this memory
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1084
 */
311
7ec66097ab2e 4074 AI preserve slice will not work if install slice is not specified
William Schumann <william.schumann@sun.com>
parents: 294
diff changeset
  1085
auto_slice_info *
459
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1086
ai_get_manifest_slice_info(int *pstatus)
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1087
{
311
7ec66097ab2e 4074 AI preserve slice will not work if install slice is not specified
William Schumann <william.schumann@sun.com>
parents: 294
diff changeset
  1088
	auto_slice_info *asi;
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1089
	auto_slice_info *tmp_asi;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1090
	int i, names_len = 0, actions_len = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1091
	char *p;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1092
	char **slice_names;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1093
	char **slice_actions;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1094
	char tag[MAXPATHLEN];
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1095
	char *endptr;
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1096
459
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1097
	*pstatus = 0;	/* assume no parsing errors */
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1098
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1099
	/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1100
	 * The name (number) and action attributes are mandatory for slices, so
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1101
	 * we will use these two values as the unique key for slice elements.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1102
	 * First we fetch all the slice numbers and actions, then we query the
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1103
	 * manifest using these values to fetch the additional details for
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1104
	 * each slice.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1105
	 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1106
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1107
	slice_names = ai_get_manifest_values(AIM_SLICE_NUMBER, &names_len);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1108
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1109
	if (slice_names == NULL || names_len <= 0)
311
7ec66097ab2e 4074 AI preserve slice will not work if install slice is not specified
William Schumann <william.schumann@sun.com>
parents: 294
diff changeset
  1110
		return (NULL);
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1111
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1112
	slice_actions = ai_get_manifest_values(AIM_SLICE_ACTION, &actions_len);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1113
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1114
	if (actions_len != names_len) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1115
		auto_debug_print(AUTO_DBGLVL_ERR,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1116
		    "Error matching slice names to actions.\n");
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1117
		*pstatus = 1;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1118
		free(slice_names);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1119
		free(slice_actions);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1120
		return (NULL);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1121
	}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1122
311
7ec66097ab2e 4074 AI preserve slice will not work if install slice is not specified
William Schumann <william.schumann@sun.com>
parents: 294
diff changeset
  1123
	/* len+1 -- '1' for end of array marker */
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1124
	asi = calloc(sizeof (auto_slice_info), names_len + 1);
311
7ec66097ab2e 4074 AI preserve slice will not work if install slice is not specified
William Schumann <william.schumann@sun.com>
parents: 294
diff changeset
  1125
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1126
	if (asi == NULL) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1127
		free(slice_names);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1128
		free(slice_actions);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1129
		return (NULL);
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1130
	}
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1131
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1132
	for (i = 0; i < names_len; i++) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1133
		/* Get the number for this slice */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1134
		(asi + i)->slice_number = atoi(slice_names[i]);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1135
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1136
		/* Get the action for this slice */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1137
		if (strlcpy((asi + i)->slice_action, slice_actions[i],
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1138
		    AUTO_MAX_ACTION_LEN) >= AUTO_MAX_ACTION_LEN) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1139
			auto_debug_print(AUTO_DBGLVL_ERR,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1140
			    "Slice action in manifest is too long (%s)\n", p);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1141
			*pstatus = 1;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1142
			free(asi);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1143
			free(slice_names);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1144
			free(slice_actions);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1145
			return (NULL);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1146
		}
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1147
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1148
		/* Get the size (value + units) for this slice */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1149
		(void) snprintf(tag, sizeof (tag), AIM_SLICE_SIZE,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1150
		    slice_names[i], slice_actions[i]);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1151
		p = ai_get_manifest_element_value(tag);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1152
		if (p == NULL) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1153
			/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1154
			 * Default to 0mb.  This is not strictly necessary,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1155
			 * as both these values correspond to 0, which was
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1156
			 * the value they were already set to when the struct
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1157
			 * was calloc()ed.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1158
			 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1159
			(asi + i)->slice_size = (uint64_t) 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1160
			(asi + i)->slice_size_units = AI_SIZE_UNITS_MEGABYTES;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1161
		} else {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1162
			errno = 0;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1163
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1164
			/* Get the numerical portion of the size value */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1165
			(asi + i)->slice_size = strtoull(p, &endptr, 0);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1166
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1167
			if (errno == 0 && endptr != p) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1168
				/* Get the units portion of the size value */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1169
				(asi + i)->slice_size_units =
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1170
				    get_size_units(endptr);
459
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1171
			} else {
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1172
				auto_debug_print(AUTO_DBGLVL_ERR,
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1173
				    "Slice size in manifest (%s) is "
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1174
				    "not a valid number.\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1175
				    p);
459
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1176
				*pstatus = 1;
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1177
				free(asi);
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1178
				free(slice_names);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1179
				free(slice_actions);
789
282f473d34ee 10115 AI ignores desired swap listed in ai manifest
Matt Keenan <matt.keenan@sun.com>
parents: 785
diff changeset
  1180
				errno = 0;
459
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1181
				return (NULL);
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1182
			}
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1183
		}
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1184
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1185
		/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1186
		 * Determine behavior for create action on existing slices.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1187
		 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1188
		(void) snprintf(tag, sizeof (tag),
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1189
		    AIM_SLICE_ON_EXISTING, slice_names[i], slice_actions[i]);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1190
		p = ai_get_manifest_element_value(tag);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1191
		if (p != NULL) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1192
			/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1193
			 * Since the slice information array is initialized
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1194
			 * to zero, and the default enum value is also zero,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1195
			 * the "error" case will also be the default in the
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1196
			 * slice information array.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1197
			 *
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1198
			 * In the new schema, the slice attribute 'force'
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1199
			 * controls this.  If force="false" (the default)
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1200
			 * then we leave on_existing=0, which equates to
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1201
			 * OM_ON_EXISTING_ERROR. If force="true", then we
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1202
			 * set it to OM_ON_EXISTING_OVERWRITE.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1203
			 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1204
			if (strcasecmp(p, "true") == 0)
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1205
				(asi + i)->on_existing =
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1206
				    OM_ON_EXISTING_OVERWRITE;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1207
		}
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1208
	}
459
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1209
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1210
	free(slice_names);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1211
	free(slice_actions);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1212
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1213
	/* Debug - print slice info out to log */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1214
	tmp_asi = asi;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1215
	for (; tmp_asi->slice_action[0] != '\0'; tmp_asi++) {
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1216
		auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1217
		    "Slice details from Manifest:\n");
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1218
		auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1219
		    "\tslice_action\t\t: [%s]\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1220
		    tmp_asi->slice_action);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1221
		auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1222
		    "\tslice_number\t\t: [%d]\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1223
		    tmp_asi->slice_number);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1224
		auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1225
		    "\tslice_size\t\t\t: [%lld]\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1226
		    tmp_asi->slice_size);
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1227
		auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1228
		    "\tslice_size_units\t: [%d] (= %s)\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1229
		    (int)tmp_asi->slice_size_units,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1230
		    CONVERT_UNITS_TO_TEXT(tmp_asi->slice_size_units));
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1231
		auto_debug_print(AUTO_DBGLVL_INFO,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1232
		    "\ton_existing\t: [%d] (= %s)\n",
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1233
		    (int)tmp_asi->on_existing,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1234
		    tmp_asi->on_existing ? "OVERWRITE" : "ERROR");
409
141e3dc11d9f 4460 "partition_size" tag in ai_manifest.xml template should mention sectors
William Schumann <william.schumann@sun.com>
parents: 405
diff changeset
  1235
	}
810
8f09387744e3 8661 AI fails to continue installation if slices exist from previous configuration
William Schumann <william.schumann@sun.com>
parents: 789
diff changeset
  1236
311
7ec66097ab2e 4074 AI preserve slice will not work if install slice is not specified
William Schumann <william.schumann@sun.com>
parents: 294
diff changeset
  1237
	return (asi);
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1238
}
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1239
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1240
/*
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1241
 * Retrieve the URL for the default publisher
294
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
  1242
 */
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1243
char *
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1244
ai_get_manifest_default_url(int *len)
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1245
{
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1246
	char	**value;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1247
	char	*url;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1248
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1249
	value = ai_get_manifest_values(AIM_IPS_PUBLISHER_URL, len);
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1250
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1251
	if (*len > 0) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1252
		url = value[0];
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1253
		free(value);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1254
		return (url);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1255
	}
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1256
	return (NULL);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1257
}
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1258
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1259
/*
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1260
 * Retrieve the URL(s) for the additional publisher(s)
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1261
 *
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1262
 * Default and additional (or primary and secondary) publishers
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1263
 * now use the same nodepaths, so this function repeats the same
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1264
 * search as ai_get_manifest_default_url() but the results are
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1265
 * handled differently.
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1266
 */
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1267
char **
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1268
ai_get_manifest_addl_url(int *len)
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1269
{
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1270
	char	**value;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1271
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1272
	value = ai_get_manifest_values(AIM_IPS_PUBLISHER_URL, len);
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1273
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1274
	if (*len > 0) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1275
		return (value);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1276
	}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1277
	return (NULL);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1278
}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1279
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1280
/*
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1281
 * Retrieve an publisher name from the manifest using url value
294
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
  1282
 */
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1283
char *
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1284
ai_get_manifest_repo_publisher(char *url)
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1285
{
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1286
	char	**value;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1287
	char	*publisher;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1288
	int	len;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1289
	char	tag[MAXPATHLEN];
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1290
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1291
	(void) snprintf(tag, sizeof (tag),
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1292
	    AIM_ADD_URL_PUBLISHER_NAME, url);
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1293
	value = ai_get_manifest_values(tag, &len);
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1294
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1295
	if (len > 0) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1296
		publisher = value[0];
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1297
		free(value);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1298
		return (publisher);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1299
	}
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1300
	return (NULL);
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1301
}
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1302
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1303
/*
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1304
 * Retrieve the URL for an IPS repo mirrors
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1305
 */
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1306
auto_mirror_repo_t *
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1307
ai_get_manifest_repo_mirrors(char *url)
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1308
{
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1309
	int			i, len = 0;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1310
	char			**value;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1311
	char			buf[MAXPATHLEN];
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1312
	auto_mirror_repo_t	*ptr, *tmp_ptr;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1313
	auto_mirror_repo_t	*mirror = NULL;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1314
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1315
	(void) snprintf(buf, sizeof (buf),
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1316
	    AIM_ADD_URL_PUBLISHER_MIRROR, url);
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1317
	value = ai_get_manifest_values(buf, &len);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1318
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1319
	if (len <= 0) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1320
		return (NULL);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1321
	}
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1322
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1323
	for (i = 0; i < len; i++) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1324
		/*
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1325
		 * Ignore the empty string
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1326
		 */
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1327
		if (strcmp(value[i], "") == 0) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1328
			continue;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1329
		}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1330
		ptr = calloc(sizeof (auto_mirror_repo_t), 1);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1331
		if (ptr == NULL) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1332
			goto get_out;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1333
		}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1334
		ptr->mirror_url = strdup(value[i]);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1335
		ptr->next_mirror = NULL;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1336
		if (mirror == NULL) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1337
			mirror = ptr;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1338
			tmp_ptr = ptr;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1339
		} else {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1340
			tmp_ptr->next_mirror = ptr;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1341
			tmp_ptr = tmp_ptr->next_mirror;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1342
		}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1343
	}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1344
	free(value);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1345
	return (mirror);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1346
get_out:
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1347
	free(value);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1348
	free_repo_mirror_list(mirror);
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1349
	return (NULL);
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1350
}
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1351
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1352
/*
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1353
 * Collect the information about default publisher from
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1354
 * the manifest before processing them
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1355
 *
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1356
 * This function allocates memory for auto_repo_info_t and
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1357
 * the members publisher, url and mirror information.
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1358
 * The caller MUST free this memory
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1359
 */
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1360
auto_repo_info_t *
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1361
ai_get_default_repo_info()
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1362
{
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1363
	char			*p;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1364
	char			*current_url, *default_url;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1365
	int			num_url;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1366
	auto_repo_info_t 	*repo, *default_repo;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1367
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1368
	default_repo = NULL;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1369
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1370
	/*
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1371
	 * Get the url of the default publisher
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1372
	 */
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1373
	current_url = ai_get_manifest_default_url(&num_url);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1374
	if (current_url == NULL) {
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1375
		/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1376
		 * If the publisher wasn't specified in the manifest,
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1377
		 * provide a default value.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1378
		 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1379
		current_url = AIM_FALLBACK_PUBLISHER_URL;
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1380
	}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1381
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1382
	repo = calloc(sizeof (auto_repo_info_t), 1);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1383
	if (repo == NULL) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1384
		return (NULL);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1385
	}
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1386
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1387
	/*
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1388
	 * Save the value before calling another ai_get_manifest_*()
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1389
	 */
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1390
	default_url = strdup(current_url);
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1391
	p = ai_get_manifest_repo_publisher(default_url);
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1392
	if (p == NULL) {
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1393
		/*
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1394
		 * If the primary publisher URL is AIM_FALLBACK_PUBLISHER_URL
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1395
		 * and no name was specified, then provide a default value.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1396
		 * For all other URLs, if a name is not specified for the
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1397
		 * publisher, then it is an error.
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1398
		 */
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1399
		if (strcasecmp(current_url, AIM_FALLBACK_PUBLISHER_URL) == 0)
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1400
			p = AIM_FALLBACK_PUBLISHER_NAME;
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1401
		else
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1402
			goto get_out;
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1403
	}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1404
	repo->publisher = strdup(p);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1405
	repo->url = strdup(default_url);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1406
	if (repo->publisher == NULL || repo->url == NULL) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1407
		goto get_out;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1408
	}
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1409
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1410
	/*
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1411
	 * get the mirrors for this publishers
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1412
	 */
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1413
	repo->mirror_repo =
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1414
	    ai_get_manifest_repo_mirrors(default_url);
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1415
	repo->next_repo = NULL;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1416
	default_repo = repo;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1417
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1418
	free(default_url);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1419
	return (default_repo);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1420
get_out:
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1421
	free(default_url);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1422
	if (repo != NULL)  {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1423
		free(repo->publisher);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1424
		free(repo->url);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1425
		free(repo);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1426
	}
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1427
	return (NULL);
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1428
}
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1429
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1430
/*
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1431
 * Automated Installer allows specifying more than one additional
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1432
 * publishers. Collect all the additional publishers from
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1433
 * the manifest before processing them
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1434
 *
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1435
 * This function allocates memory for auto_repo_info_t and
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1436
 * the members publisher, url and mirror information.
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1437
 * The caller MUST free this memory
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1438
 */
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1439
auto_repo_info_t *
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1440
ai_get_additional_repo_info()
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1441
{
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1442
	char			*p;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1443
	char			**urls;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1444
	int			i,  num_url;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1445
	auto_repo_info_t 	*repo, *tmp_repo, *addl_repo;
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1446
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1447
	addl_repo = NULL;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1448
	tmp_repo = NULL;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1449
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1450
	/*
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1451
	 * This function will return one url per publisher
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1452
	 * num_url contains the number of publishers
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1453
	 */
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1454
	urls = ai_get_manifest_addl_url(&num_url);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1455
	if (urls == NULL)
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1456
		return (NULL);
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1457
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1458
	/*
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1459
	 * We start iterating through the urls at index 1
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1460
	 * instead of index 0, because the first url returned
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1461
	 * is the primary publisher.  All subsequent urls are
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1462
	 * secondary, or additional, publishers, which is what
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1463
	 * we want here.
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1464
	 * Allocate space and save the urls because the next
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1465
	 * call to ai_get_manifest_*() will overwrite them
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1466
	 */
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1467
	for (i = 1; i < num_url; i++) {
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1468
		/*
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1469
		 * Ignore the empty string
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1470
		 */
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1471
		if (strcmp(urls[i], "") == 0) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1472
			continue;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1473
		}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1474
		repo = calloc(sizeof (auto_repo_info_t), 1);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1475
		if (repo == NULL) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1476
			return (NULL);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1477
		}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1478
		repo->url = strdup(urls[i]);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1479
		if (repo->url == NULL) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1480
			free(repo);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1481
			goto get_out;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1482
		}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1483
		repo->next_repo = NULL;
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1484
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1485
		if (addl_repo == NULL) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1486
			addl_repo = repo;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1487
			tmp_repo = repo;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1488
		} else {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1489
			tmp_repo->next_repo = repo;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1490
			tmp_repo = tmp_repo->next_repo;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1491
		}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1492
	}
460
22e95ec02b00 6610 AI does not recognize additional IPS repository
William Schumann <william.schumann@sun.com>
parents: 459
diff changeset
  1493
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1494
	/*
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1495
	 * For each url (publisher), get the publisher name and
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1496
	 * mirrors (if any).
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1497
	 */
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1498
	for (repo = addl_repo; repo != NULL; repo = repo -> next_repo) {
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1499
		p = ai_get_manifest_repo_publisher(repo->url);
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1500
		if (p == NULL) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1501
			goto get_out;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1502
		}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1503
		repo->publisher = strdup(p);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1504
		if (repo->publisher == NULL) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1505
			goto get_out;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1506
		}
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1507
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1508
		/*
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1509
		 * get the mirrors for this publisher
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1510
		 */
862
e9f31f2f2f2d 16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents: 846
diff changeset
  1511
		repo->mirror_repo = ai_get_manifest_repo_mirrors(repo->url);
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1512
	}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1513
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1514
	free(urls);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1515
	return (addl_repo);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1516
get_out:
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1517
	free(urls);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1518
	free_repo_info_list(addl_repo);
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1519
	return (NULL);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1520
}
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1521
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1522
/*
369
e750468b2782 4487 Add http proxy suport
Jens Deppe <jens.deppe@sun.com>
parents: 311
diff changeset
  1523
 * Retrieve the proxy to use to access the IPS repo.
e750468b2782 4487 Add http proxy suport
Jens Deppe <jens.deppe@sun.com>
parents: 311
diff changeset
  1524
 */
e750468b2782 4487 Add http proxy suport
Jens Deppe <jens.deppe@sun.com>
parents: 311
diff changeset
  1525
char *
e750468b2782 4487 Add http proxy suport
Jens Deppe <jens.deppe@sun.com>
parents: 311
diff changeset
  1526
ai_get_manifest_http_proxy()
e750468b2782 4487 Add http proxy suport
Jens Deppe <jens.deppe@sun.com>
parents: 311
diff changeset
  1527
{
e750468b2782 4487 Add http proxy suport
Jens Deppe <jens.deppe@sun.com>
parents: 311
diff changeset
  1528
	int len = 0;
e750468b2782 4487 Add http proxy suport
Jens Deppe <jens.deppe@sun.com>
parents: 311
diff changeset
  1529
	char **value;
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1530
	char *proxy;
369
e750468b2782 4487 Add http proxy suport
Jens Deppe <jens.deppe@sun.com>
parents: 311
diff changeset
  1531
459
56b6b042a167 5653 AI manifest should offer keyword to use max available space for partition/slice
William Schumann <william.schumann@sun.com>
parents: 449
diff changeset
  1532
	value = ai_get_manifest_values(AIM_PROXY_URL, &len);
369
e750468b2782 4487 Add http proxy suport
Jens Deppe <jens.deppe@sun.com>
parents: 311
diff changeset
  1533
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1534
	if (len > 0) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1535
		proxy = value[0];
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1536
		free(value);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1537
		return (proxy);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1538
	}
369
e750468b2782 4487 Add http proxy suport
Jens Deppe <jens.deppe@sun.com>
parents: 311
diff changeset
  1539
	return (NULL);
e750468b2782 4487 Add http proxy suport
Jens Deppe <jens.deppe@sun.com>
parents: 311
diff changeset
  1540
}
e750468b2782 4487 Add http proxy suport
Jens Deppe <jens.deppe@sun.com>
parents: 311
diff changeset
  1541
e750468b2782 4487 Add http proxy suport
Jens Deppe <jens.deppe@sun.com>
parents: 311
diff changeset
  1542
/*
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1543
 * Retrieve the list of packages to be installed
495
a0961490f883 7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents: 477
diff changeset
  1544
 *
a0961490f883 7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents: 477
diff changeset
  1545
 * Parameters:
a0961490f883 7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents: 477
diff changeset
  1546
 *    *num_packages - set to number of obtained packages
a0961490f883 7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents: 477
diff changeset
  1547
 *    pkg_list_tag - path to XML node which contents is to be obtained
a0961490f883 7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents: 477
diff changeset
  1548
 *
a0961490f883 7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents: 477
diff changeset
  1549
 * Returns:
a0961490f883 7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents: 477
diff changeset
  1550
 *    - array of strings specified for given tag
a0961490f883 7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents: 477
diff changeset
  1551
 *    - NULL, if tag is empty or not defined
294
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
  1552
 */
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1553
char **
495
a0961490f883 7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents: 477
diff changeset
  1554
ai_get_manifest_packages(int *num_packages_p, char *pkg_list_tag_p)
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1555
{
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1556
	char **package_list;
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1557
495
a0961490f883 7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents: 477
diff changeset
  1558
	package_list = ai_get_manifest_values(pkg_list_tag_p, num_packages_p);
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1559
495
a0961490f883 7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents: 477
diff changeset
  1560
	if (*num_packages_p > 0)
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1561
		return (package_list);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1562
	return (NULL);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1563
}
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1564
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1565
static int
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1566
parse_property(char *str, char *keyword, char *value)
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1567
{
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1568
	char	*token;
436
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1569
	char	*eol;
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1570
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1571
	if (str == NULL) {
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1572
		return (NULL);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1573
	}
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1574
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1575
	if (*str == '#') {
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1576
		return (NULL);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1577
	}
436
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1578
	strcpy(value, "[not found]"); /* assume failure to parse value */
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1579
436
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1580
	eol = str + strlen(str);
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1581
	*keyword = '\0';
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1582
	token = strtok(str, " ");
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1583
294
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
  1584
	while ((token = strtok(NULL, " ")) != NULL) {
846
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1585
		if (strstr(token, AUTO_PROPERTY_ROOTPASS) != NULL) {
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1586
			strlcpy(keyword, AUTO_PROPERTY_ROOTPASS, KEYWORD_SIZE);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1587
			break;
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1588
		} else if (strstr(token, AUTO_PROPERTY_TIMEZONE) != NULL) {
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1589
			strlcpy(keyword, AUTO_PROPERTY_TIMEZONE, KEYWORD_SIZE);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1590
			break;
477
04c667d64a87 4629 Cannot set timezone in automated installation
William Schumann <william.schumann@sun.com>
parents: 471
diff changeset
  1591
		} else if (strstr(token, AUTO_PROPERTY_HOSTNAME) != NULL) {
04c667d64a87 4629 Cannot set timezone in automated installation
William Schumann <william.schumann@sun.com>
parents: 471
diff changeset
  1592
			strlcpy(keyword, AUTO_PROPERTY_HOSTNAME, KEYWORD_SIZE);
04c667d64a87 4629 Cannot set timezone in automated installation
William Schumann <william.schumann@sun.com>
parents: 471
diff changeset
  1593
			break;
294
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
  1594
		}
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1595
	}
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1596
846
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1597
	/*
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1598
	 * Tolerate unrecognized SMF properties, they might belong to SMF
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1599
	 * services which will process those properties later during first boot.
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1600
	 */
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1601
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1602
	if (*keyword == '\0') {
846
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1603
		return (AUTO_INSTALL_SUCCESS);
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1604
	}
846
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1605
294
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
  1606
	while ((token = strtok(NULL, " ")) != NULL) {
436
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1607
		char	*pkeyword_value, *pbeg, *pend;
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1608
436
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1609
		/* find keyword 'value=<something>' */
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1610
		pkeyword_value = strstr(token, KEYWORD_VALUE);
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1611
		if (pkeyword_value == NULL) {
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1612
			continue;
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1613
		}
436
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1614
		/* find beginning value delimiter */
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1615
		pbeg = strchr(pkeyword_value, '\'');
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1616
		if (pbeg == NULL) {
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1617
			pbeg = strchr(pkeyword_value, '\"');
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1618
			if (pbeg == NULL) /* no starting delimiter */
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1619
				return (AUTO_INSTALL_FAILURE);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1620
		}
436
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1621
		if (eol > pbeg + strlen(pbeg)) /* if strtok inserted NULL */
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1622
			*(pbeg + strlen(pbeg)) = ' '; /* restore orig delim */
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1623
		/* find ending value delimiter */
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1624
		pend = strchr(pbeg + 1, *pbeg);
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1625
		if (pend == NULL) /* no ending delimiter */
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1626
			return (AUTO_INSTALL_FAILURE);
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1627
		*pend = '\0';
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1628
		if (strlcpy(value, ++pbeg, VALUE_SIZE) >= VALUE_SIZE) {
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1629
			auto_debug_print(AUTO_DBGLVL_ERR,
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1630
			    "SC manifest value for %s is too long (>%d bytes) "
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1631
			    "and will be truncated to |%s|\n",
86bc65bc6cb6 4246 The user and root password are not encrypted in SC manifest
William Schumann <william.schumann@sun.com>
parents: 414
diff changeset
  1632
			    keyword, VALUE_SIZE, pbeg);
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1633
		}
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1634
		return (AUTO_INSTALL_SUCCESS);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1635
	}
405
785221d05f6b 4195 need to make changes to AI Engine for SPARC
William Schumann <william.schumann@sun.com>
parents: 369
diff changeset
  1636
	return (AUTO_INSTALL_FAILURE);
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1637
}
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1638
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1639
/*
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1640
 * Parse the system configuration (SC) manifest
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1641
 * and return the information in the passed in
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1642
 * auto_sc_params
294
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
  1643
 */
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1644
int
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1645
auto_parse_sc_manifest(char *profile_file, auto_sc_params *sp)
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1646
{
846
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1647
	FILE		*profile_fp;
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1648
	char		line[BUFSIZ];
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1649
	char		keyword[KEYWORD_SIZE];
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1650
	char		value[VALUE_SIZE];
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1651
	int		ret;
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1652
	boolean_t	is_legacy_sc_manifest = B_FALSE;
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1653
	char		cmd[MAX_SHELLCMD_LEN];
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1654
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1655
	profile_fp = fopen(profile_file, "r");
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1656
	if (profile_fp == NULL) {
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1657
		auto_log_print(gettext("Profile %s missing\n"), profile_file);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1658
		return (AUTO_INSTALL_FAILURE);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1659
	}
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1660
	while (fgets(line, sizeof (line), profile_fp) != NULL) {
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1661
		if (strstr(line, SC_PROPVAL_MARKER) != NULL) {
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1662
			ret = parse_property(line, keyword, value);
635
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1663
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1664
			/*
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1665
			 * if couldn't parse the property, log the error
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1666
			 * message and return
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1667
			 */
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1668
			if (ret != AUTO_INSTALL_SUCCESS) {
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1669
				auto_debug_print(AUTO_DBGLVL_ERR,
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1670
				    "Could not parse %s property from SC"
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1671
				    " manifest\n", keyword);
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1672
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1673
				return (AUTO_INSTALL_FAILURE);
846
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1674
			} else if (keyword[0] == '\0') {
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1675
				/*
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1676
				 * Tolerate unrecognized SMF properties, they
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1677
				 * might belong to SMF services which will
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1678
				 * process those properties later during
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1679
				 * first boot.
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1680
				 */
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1681
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1682
				continue;
635
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1683
			}
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1684
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1685
			/*
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1686
			 * log the property and value obtained as a result
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1687
			 * of parsing SC manifest for debugging purposes
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1688
			 */
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1689
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1690
			auto_debug_print(AUTO_DBGLVL_INFO,
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1691
			    "SC manifest keyword=|%s| value=|%s|\n",
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1692
			    keyword, value);
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1693
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1694
			/*
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1695
			 * if property is set to empty string, complain and
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1696
			 * exit, since this is invalid value
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1697
			 */
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1698
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1699
			if (value[0] == '\0') {
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1700
				auto_debug_print(AUTO_DBGLVL_ERR,
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1701
				    "Property '%s' in system configuration"
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1702
				    " manifest is set to empty string which is"
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1703
				    " invalid value.\n"
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1704
				    "If you do not want to configure this"
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1705
				    " property, please remove it from SC"
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1706
				    " manifest.\n",
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1707
				    keyword);
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1708
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1709
				return (AUTO_INSTALL_FAILURE);
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1710
			}
846
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1711
			if (strcmp(keyword,
635
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1712
			    AUTO_PROPERTY_ROOTPASS) == 0) {
846
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1713
				is_legacy_sc_manifest = B_TRUE;
635
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1714
			} else if (strcmp(keyword,
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1715
			    AUTO_PROPERTY_TIMEZONE) == 0) {
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1716
				sp->timezone = strdup(value);
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1717
			} else if (strcmp(keyword,
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1718
			    AUTO_PROPERTY_HOSTNAME) == 0) {
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1719
				sp->hostname = strdup(value);
846
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1720
			} else {
635
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1721
				auto_debug_print(AUTO_DBGLVL_ERR,
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1722
				    "unrecognized SC manifest keyword "
74823d433dc4 6651 autoinstall needs more useful error messages from Orchestrator module
Jan Damborsky <jan.damborsky@sun.com>
parents: 495
diff changeset
  1723
				    "%s ignored\n", keyword);
846
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1724
			}
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1725
		}
294
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
  1726
	}
e81456645d2a 4007 ai_post_bootroot_archive finalizer script has errors
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents: 272
diff changeset
  1727
	fclose(profile_fp);
846
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1728
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1729
	/*
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1730
	 * If System Configuration has legacy format, convert it to new format
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1731
	 */
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1732
	if (is_legacy_sc_manifest) {
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1733
		auto_log_print(gettext(
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1734
		    "Legacy System Configuration manifest provided, an attempt"
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1735
		    " will be made to convert it to the latest format.\n"));
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1736
		auto_log_print(gettext(
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1737
		    "Please be aware that support for the legacy format can be "
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1738
		    "removed at any time without prior notice.\n"));
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1739
		auto_log_print(gettext(
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1740
		    "Thus it is strongly recommended that the latest format "
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1741
		    "of the System Configuration manifest be used.\n"));
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1742
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1743
		/* Create copy of legacy manifest for purposes of conversion */
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1744
		(void) snprintf(cmd, sizeof (cmd),
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1745
		    "/usr/bin/cp %s %s.legacy 2>&1 1>/dev/null",
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1746
		    profile_file, profile_file);
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1747
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1748
		ret = ai_exec_cmd(cmd);
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1749
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1750
		if (ret != 0) {
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1751
			auto_debug_print(AUTO_DBGLVL_ERR,
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1752
			    "Could not create a copy of the legacy System"
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1753
			    " Configuration manifest, err=%d.\n", ret);
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1754
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1755
			return (AUTO_INSTALL_FAILURE);
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1756
		}
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1757
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1758
		/* Now convert SC manifest */
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1759
		(void) snprintf(cmd, sizeof (cmd),
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1760
		    SC_CONVERSION_SCRIPT" %s.legacy %s 2>&1 1>/dev/null",
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1761
		    profile_file, profile_file);
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1762
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1763
		ret = ai_exec_cmd(cmd);
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1764
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1765
		if (ret != 0) {
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1766
			auto_debug_print(AUTO_DBGLVL_ERR,
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1767
			    "Could not convert the legacy System Configuration"
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1768
			    " manifest to the new format, err=%d.\n", ret);
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1769
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1770
			return (AUTO_INSTALL_FAILURE);
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1771
		}
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1772
	} else {
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1773
		auto_log_print(gettext(
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1774
		    "Detected the latest format of System Configuration"
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1775
		    " manifest.\n"));
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1776
	}
70dd9e819f25 15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents: 822
diff changeset
  1777
272
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1778
	return (AUTO_INSTALL_SUCCESS);
6ffbbcf6242a 3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff changeset
  1779
}
664
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1780
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1781
/*
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1782
 * Free the mirror list created while the parsing the manifest
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1783
 */
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1784
void
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1785
free_repo_mirror_list(auto_mirror_repo_t *mirror)
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1786
{
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1787
	auto_mirror_repo_t *mptr;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1788
	while (mirror != NULL) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1789
		free(mirror->mirror_url);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1790
		mptr = mirror;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1791
		mirror = mirror->next_mirror;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1792
		free(mptr);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1793
	}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1794
}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1795
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1796
/*
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1797
 * Free the IPS repo list created while the parsing the manifest
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1798
 */
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1799
void
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1800
free_repo_info_list(auto_repo_info_t *repo)
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1801
{
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1802
	auto_repo_info_t  *rptr;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1803
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1804
	while (repo != NULL) {
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1805
		free(repo->publisher);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1806
		free(repo->url);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1807
		free_repo_mirror_list(repo->mirror_repo);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1808
		rptr = repo;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1809
		repo = repo->next_repo;
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1810
		free(rptr);
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1811
	}
9a2107fc86ac 12659 AI only allows one "additional authority"
sundar.yamunachari@sun.com
parents: 658
diff changeset
  1812
}