4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
32 * This module constructs a list of entries from the pkgmap associated
33 * with this package. When finished, this list is sorted in alphabetical
34 * order and an accompanying structure list, mergstat, provides
35 * information about how these new files merge with existing files
36 * already on the system.
44 #include <sys/types.h>
54 /* libinst/ocfile.c */
57 static int client_refer(struct cfextra
**ext
);
58 static int server_refer(struct cfextra
**ext
);
61 sortmap(struct cfextra
***extlist
, VFP_T
*pkgmapVfp
,
62 PKGserver pkgserver
, VFP_T
*tmpvfp
, char *a_zoneName
)
65 char *db_mrg
= "unable to merge package and system information";
67 if (a_zoneName
== (char *)NULL
) {
68 echo(gettext("## Processing package information."));
70 echo(gettext("## Processing package information in zone <%s>."),
75 * The following instruction puts the client-relative basedir
76 * into the environment iff it's a relocatable package and
77 * we're installing to a client. Otherwise, it uses the regular
78 * basedir. The only reason for this is so that mappath() upon
79 * finding $BASEDIR in a path will properly resolve it to the
80 * client-relative path. This way eval_path() can properly
81 * construct the server-relative path.
83 if (is_relocatable() && is_an_inst_root())
84 putparam("BASEDIR", get_info_basedir());
87 * read the pkgmap provided by this package into
88 * memory; map parameters specified in the pathname
89 * and sort in memory by pathname
92 vfpRewind(pkgmapVfp
); /* rewind input file */
94 *extlist
= pkgobjmap(pkgmapVfp
, 2, NULL
);
96 if (*extlist
== NULL
) {
97 progerr(gettext("unable to process pkgmap"));
101 /* Make all paths client-relative if necessary. */
102 if (is_an_inst_root()) {
103 (void) client_refer(*extlist
);
106 if (a_zoneName
== (char *)NULL
) {
107 echo(gettext("## Processing system information."));
109 echo(gettext("## Processing system information in zone <%s>."),
114 * calculate the number of parts in this package
115 * by locating the entry with the largest "volno"
119 if (is_depend_pkginfo_DB() == B_FALSE
) {
120 for (i
= 0; (*extlist
)[i
]; i
++) {
121 n
= (*extlist
)[i
]->cf_ent
.volno
;
128 dbchg
= pkgdbmerg(pkgserver
, tmpvfp
, *extlist
);
130 progerr(gettext(db_mrg
));
135 /* Restore the original BASEDIR. */
136 if (is_relocatable() && is_an_inst_root())
137 putparam("BASEDIR", get_basedir());
139 if (is_an_inst_root()) {
140 (void) server_refer(*extlist
);
147 client_refer(struct cfextra
**ext
)
151 for (count
= 0; ext
[count
] != (struct cfextra
*)NULL
; count
++) {
152 ext
[count
]->cf_ent
.path
= ext
[count
]->client_path
;
153 ext
[count
]->cf_ent
.ainfo
.local
= ext
[count
]->client_local
;
160 server_refer(struct cfextra
**ext
)
164 for (count
= 0; ext
[count
] != (struct cfextra
*)NULL
; count
++) {
165 ext
[count
]->cf_ent
.path
= ext
[count
]->server_path
;
166 ext
[count
]->cf_ent
.ainfo
.local
= ext
[count
]->server_local
;