xref: /onnv-gate/usr/src/cmd/svr4pkg/pkgrm/check.c (revision 9781:ccf49524d5dc)
1*9781SMoriah.Waterland@Sun.COM /*
2*9781SMoriah.Waterland@Sun.COM  * CDDL HEADER START
3*9781SMoriah.Waterland@Sun.COM  *
4*9781SMoriah.Waterland@Sun.COM  * The contents of this file are subject to the terms of the
5*9781SMoriah.Waterland@Sun.COM  * Common Development and Distribution License (the "License").
6*9781SMoriah.Waterland@Sun.COM  * You may not use this file except in compliance with the License.
7*9781SMoriah.Waterland@Sun.COM  *
8*9781SMoriah.Waterland@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*9781SMoriah.Waterland@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*9781SMoriah.Waterland@Sun.COM  * See the License for the specific language governing permissions
11*9781SMoriah.Waterland@Sun.COM  * and limitations under the License.
12*9781SMoriah.Waterland@Sun.COM  *
13*9781SMoriah.Waterland@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*9781SMoriah.Waterland@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*9781SMoriah.Waterland@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*9781SMoriah.Waterland@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*9781SMoriah.Waterland@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*9781SMoriah.Waterland@Sun.COM  *
19*9781SMoriah.Waterland@Sun.COM  * CDDL HEADER END
20*9781SMoriah.Waterland@Sun.COM  */
21*9781SMoriah.Waterland@Sun.COM 
22*9781SMoriah.Waterland@Sun.COM /*
23*9781SMoriah.Waterland@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*9781SMoriah.Waterland@Sun.COM  * Use is subject to license terms.
25*9781SMoriah.Waterland@Sun.COM  */
26*9781SMoriah.Waterland@Sun.COM 
27*9781SMoriah.Waterland@Sun.COM 
28*9781SMoriah.Waterland@Sun.COM #include <stdio.h>
29*9781SMoriah.Waterland@Sun.COM #include <limits.h>
30*9781SMoriah.Waterland@Sun.COM #include <string.h>
31*9781SMoriah.Waterland@Sun.COM #include <stdlib.h>
32*9781SMoriah.Waterland@Sun.COM #include <sys/stat.h>
33*9781SMoriah.Waterland@Sun.COM #include <unistd.h>
34*9781SMoriah.Waterland@Sun.COM #include <errno.h>
35*9781SMoriah.Waterland@Sun.COM #include <utmpx.h>
36*9781SMoriah.Waterland@Sun.COM #include <dirent.h>
37*9781SMoriah.Waterland@Sun.COM #include <sys/types.h>
38*9781SMoriah.Waterland@Sun.COM #include <locale.h>
39*9781SMoriah.Waterland@Sun.COM #include <libintl.h>
40*9781SMoriah.Waterland@Sun.COM #include <pkgstrct.h>
41*9781SMoriah.Waterland@Sun.COM #include <pkglocs.h>
42*9781SMoriah.Waterland@Sun.COM #include <assert.h>
43*9781SMoriah.Waterland@Sun.COM #include <pkglib.h>
44*9781SMoriah.Waterland@Sun.COM #include <install.h>
45*9781SMoriah.Waterland@Sun.COM #include <libinst.h>
46*9781SMoriah.Waterland@Sun.COM #include <libadm.h>
47*9781SMoriah.Waterland@Sun.COM #include <messages.h>
48*9781SMoriah.Waterland@Sun.COM #include <instzones_api.h>
49*9781SMoriah.Waterland@Sun.COM 
50*9781SMoriah.Waterland@Sun.COM extern int	npkgs;	/* the number of packages yet to be installed */
51*9781SMoriah.Waterland@Sun.COM 
52*9781SMoriah.Waterland@Sun.COM /*
53*9781SMoriah.Waterland@Sun.COM  * ckquit is a global that controls 'ckyorn' (defined in libadm)
54*9781SMoriah.Waterland@Sun.COM  * If ckquit is non-zero, then "quit" is allowed as an answer when
55*9781SMoriah.Waterland@Sun.COM  * ckyorn is called. If is it zero, then "quit" is not an allowed answer.
56*9781SMoriah.Waterland@Sun.COM  */
57*9781SMoriah.Waterland@Sun.COM extern int	ckquit;
58*9781SMoriah.Waterland@Sun.COM 
59*9781SMoriah.Waterland@Sun.COM extern struct admin adm;
60*9781SMoriah.Waterland@Sun.COM 
61*9781SMoriah.Waterland@Sun.COM /*
62*9781SMoriah.Waterland@Sun.COM  * each one of these represents a single kind of dependency check
63*9781SMoriah.Waterland@Sun.COM  */
64*9781SMoriah.Waterland@Sun.COM 
65*9781SMoriah.Waterland@Sun.COM static depckError_t er_depsonme = {0, (depckErrorRecord_t *)NULL};
66*9781SMoriah.Waterland@Sun.COM static depckError_t er_prenci = {0, (depckErrorRecord_t *)NULL};
67*9781SMoriah.Waterland@Sun.COM static depckError_t er_prereq = {0, (depckErrorRecord_t *)NULL};
68*9781SMoriah.Waterland@Sun.COM static depckError_t er_rckdepend = {0, (depckErrorRecord_t *)NULL};
69*9781SMoriah.Waterland@Sun.COM static depckError_t er_rckpriv = {0, (depckErrorRecord_t *)NULL};
70*9781SMoriah.Waterland@Sun.COM static depckError_t er_rckrunlevel = {0, (depckErrorRecord_t *)NULL};
71*9781SMoriah.Waterland@Sun.COM static depckError_t er_runlevel = {0, (depckErrorRecord_t *)NULL};
72*9781SMoriah.Waterland@Sun.COM 
73*9781SMoriah.Waterland@Sun.COM /*
74*9781SMoriah.Waterland@Sun.COM  * each one of these represents a localized message for a single kind
75*9781SMoriah.Waterland@Sun.COM  * of dependency check
76*9781SMoriah.Waterland@Sun.COM  */
77*9781SMoriah.Waterland@Sun.COM 
78*9781SMoriah.Waterland@Sun.COM static char *IMSG_PKGRMCHK_CKRUNLVL = (char *)NULL;
79*9781SMoriah.Waterland@Sun.COM static char *IMSG_PKGRMCHK_DEPEND = (char *)NULL;
80*9781SMoriah.Waterland@Sun.COM static char *IMSG_PKGRMCHK_DEPSONME = (char *)NULL;
81*9781SMoriah.Waterland@Sun.COM static char *IMSG_PKGRMCHK_PRENCI = (char *)NULL;
82*9781SMoriah.Waterland@Sun.COM static char *IMSG_PKGRMCHK_PREREQ = (char *)NULL;
83*9781SMoriah.Waterland@Sun.COM static char *IMSG_PKGRMCHK_PRIV = (char *)NULL;
84*9781SMoriah.Waterland@Sun.COM static char *IMSG_PKGRMCHK_RUNLEVEL = (char *)NULL;
85*9781SMoriah.Waterland@Sun.COM 
86*9781SMoriah.Waterland@Sun.COM /*
87*9781SMoriah.Waterland@Sun.COM  * each one of these represents a function to handle a single kind of
88*9781SMoriah.Waterland@Sun.COM  * dependency check
89*9781SMoriah.Waterland@Sun.COM  */
90*9781SMoriah.Waterland@Sun.COM 
91*9781SMoriah.Waterland@Sun.COM static int rckdepend(char *a_msg, char *a_pkg);
92*9781SMoriah.Waterland@Sun.COM static int rckdepsonme(char *a_msg, char *a_pkg);
93*9781SMoriah.Waterland@Sun.COM static int rckprenci(char *a_msg, char *a_pkg);
94*9781SMoriah.Waterland@Sun.COM static int rckprereq(char *a_msg, char *a_pkg);
95*9781SMoriah.Waterland@Sun.COM static int rckpriv(char *a_msg, char *a_pkg);
96*9781SMoriah.Waterland@Sun.COM static int rckrunlevel(char *a_msg, char *a_pkg);
97*9781SMoriah.Waterland@Sun.COM 
98*9781SMoriah.Waterland@Sun.COM static depckl_t DEPCKL[] = {
99*9781SMoriah.Waterland@Sun.COM 	/*
100*9781SMoriah.Waterland@Sun.COM 	 * Message hierarchy:
101*9781SMoriah.Waterland@Sun.COM 	 * -- runlevel=%s
102*9781SMoriah.Waterland@Sun.COM 	 * --- rckrunlevel=%d
103*9781SMoriah.Waterland@Sun.COM 	 * --- rckpriv=%d  ****
104*9781SMoriah.Waterland@Sun.COM 	 * -- incompat=%s
105*9781SMoriah.Waterland@Sun.COM 	 * -- prerequisite-incomplete=%s
106*9781SMoriah.Waterland@Sun.COM 	 * -- dependonme=%s
107*9781SMoriah.Waterland@Sun.COM 	 * -- dependsonme=%s:%s
108*9781SMoriah.Waterland@Sun.COM 	 * -- prerequisite-installed=%s
109*9781SMoriah.Waterland@Sun.COM 	 * ---rckdepend=%d ****
110*9781SMoriah.Waterland@Sun.COM 	 */
111*9781SMoriah.Waterland@Sun.COM 
112*9781SMoriah.Waterland@Sun.COM 	/* name,	ignore_values,	err_msg,	depcklFunc,	recrd */
113*9781SMoriah.Waterland@Sun.COM 	/*
114*9781SMoriah.Waterland@Sun.COM 	 * package and zone information is collected in the "record" object for
115*9781SMoriah.Waterland@Sun.COM 	 * each occurance - then a message is constructed for each zone that
116*9781SMoriah.Waterland@Sun.COM 	 * reported the condition - the message includes that portion of the
117*9781SMoriah.Waterland@Sun.COM 	 * check past the "=" - then the specified "depcklFunc" is called to
118*9781SMoriah.Waterland@Sun.COM 	 * process each message.
119*9781SMoriah.Waterland@Sun.COM 	 * Message format:
120*9781SMoriah.Waterland@Sun.COM 	 * 	%s %s <%s> %s <%s>
121*9781SMoriah.Waterland@Sun.COM 	 * Message arguments:
122*9781SMoriah.Waterland@Sun.COM 	 *	value, "package", package-name, "zone/zones", zone-name
123*9781SMoriah.Waterland@Sun.COM 	 */
124*9781SMoriah.Waterland@Sun.COM 
125*9781SMoriah.Waterland@Sun.COM 	{ "dependsonme=",		NULL, 	&IMSG_PKGRMCHK_DEPSONME,
126*9781SMoriah.Waterland@Sun.COM 					&rckdepsonme,	&er_depsonme
127*9781SMoriah.Waterland@Sun.COM 	},
128*9781SMoriah.Waterland@Sun.COM 	{ "dependonme=",		NULL, 	&IMSG_PKGRMCHK_DEPSONME,
129*9781SMoriah.Waterland@Sun.COM 					&rckdepsonme,	&er_depsonme
130*9781SMoriah.Waterland@Sun.COM 	},
131*9781SMoriah.Waterland@Sun.COM 	{ "prerequisite-incomplete=",	NULL,	&IMSG_PKGRMCHK_PRENCI,
132*9781SMoriah.Waterland@Sun.COM 					&rckprenci,	&er_prenci
133*9781SMoriah.Waterland@Sun.COM 	},
134*9781SMoriah.Waterland@Sun.COM 	{ "prerequisite-installed=",	NULL,	&IMSG_PKGRMCHK_PREREQ,
135*9781SMoriah.Waterland@Sun.COM 					&rckprereq,	&er_prereq
136*9781SMoriah.Waterland@Sun.COM 	},
137*9781SMoriah.Waterland@Sun.COM 	{ "runlevel=",			NULL,	&IMSG_PKGRMCHK_RUNLEVEL,
138*9781SMoriah.Waterland@Sun.COM 					NULL,		&er_runlevel
139*9781SMoriah.Waterland@Sun.COM 	},
140*9781SMoriah.Waterland@Sun.COM 
141*9781SMoriah.Waterland@Sun.COM 	/*
142*9781SMoriah.Waterland@Sun.COM 	 * these checks are ignored if they return one of the listed values
143*9781SMoriah.Waterland@Sun.COM 	 * if they do NOT return one of the listed values, then the package
144*9781SMoriah.Waterland@Sun.COM 	 * and zone information is collected in the "record" object for each
145*9781SMoriah.Waterland@Sun.COM 	 * occurance - then a single unified message is constructed for all
146*9781SMoriah.Waterland@Sun.COM 	 * zones that report the same condition; then the specified "depcklFunc"
147*9781SMoriah.Waterland@Sun.COM 	 * is called to process the resulting combined message.
148*9781SMoriah.Waterland@Sun.COM 	 * Message format:
149*9781SMoriah.Waterland@Sun.COM 	 * 	%s <%s> %s <%s>
150*9781SMoriah.Waterland@Sun.COM 	 * Message arguments:
151*9781SMoriah.Waterland@Sun.COM 	 *	"package", package-name, "zone/zones", zone-name(s)
152*9781SMoriah.Waterland@Sun.COM 	 */
153*9781SMoriah.Waterland@Sun.COM 
154*9781SMoriah.Waterland@Sun.COM 	{ "rckdepend=",			"0",	&IMSG_PKGRMCHK_DEPEND,
155*9781SMoriah.Waterland@Sun.COM 					&rckdepend,	&er_rckdepend
156*9781SMoriah.Waterland@Sun.COM 	},
157*9781SMoriah.Waterland@Sun.COM 	{ "rckpriv=",			"0",	&IMSG_PKGRMCHK_PRIV,
158*9781SMoriah.Waterland@Sun.COM 					&rckpriv,	&er_rckpriv
159*9781SMoriah.Waterland@Sun.COM 	},
160*9781SMoriah.Waterland@Sun.COM 	{ "rckrunlevel=",		"0",	&IMSG_PKGRMCHK_CKRUNLVL,
161*9781SMoriah.Waterland@Sun.COM 					&rckrunlevel,	&er_rckrunlevel
162*9781SMoriah.Waterland@Sun.COM 	},
163*9781SMoriah.Waterland@Sun.COM 
164*9781SMoriah.Waterland@Sun.COM 	/*
165*9781SMoriah.Waterland@Sun.COM 	 * same as above BUT no check to ignore is done; message always reported
166*9781SMoriah.Waterland@Sun.COM 	 */
167*9781SMoriah.Waterland@Sun.COM 
168*9781SMoriah.Waterland@Sun.COM 	{ NULL,				NULL,	NULL,
169*9781SMoriah.Waterland@Sun.COM 						NULL,		NULL
170*9781SMoriah.Waterland@Sun.COM 	}
171*9781SMoriah.Waterland@Sun.COM };
172*9781SMoriah.Waterland@Sun.COM 
173*9781SMoriah.Waterland@Sun.COM /*
174*9781SMoriah.Waterland@Sun.COM  * Name:	preremove_verify
175*9781SMoriah.Waterland@Sun.COM  * Description:	verify results of preremoval dependency checking
176*9781SMoriah.Waterland@Sun.COM  * Arguments:	a_pkglist - pointer to array of strings representing the names
177*9781SMoriah.Waterland@Sun.COM  *			of all the packages that have been checked
178*9781SMoriah.Waterland@Sun.COM  *		a_zlst - list of zones that dependencies were checked on
179*9781SMoriah.Waterland@Sun.COM  *		a_zoneTempDir - pointer to string representing the path where
180*9781SMoriah.Waterland@Sun.COM  *			the files containing the preremoval dependency
181*9781SMoriah.Waterland@Sun.COM  *			check data are located
182*9781SMoriah.Waterland@Sun.COM  * Returns:	int
183*9781SMoriah.Waterland@Sun.COM  *		== 0 - continue processing
184*9781SMoriah.Waterland@Sun.COM  *		!= 0 - do not continue processing
185*9781SMoriah.Waterland@Sun.COM  */
186*9781SMoriah.Waterland@Sun.COM 
187*9781SMoriah.Waterland@Sun.COM int
preremove_verify(char ** a_pkglist,zoneList_t a_zlst,char * a_zoneTempDir)188*9781SMoriah.Waterland@Sun.COM preremove_verify(char **a_pkglist, zoneList_t a_zlst, char *a_zoneTempDir)
189*9781SMoriah.Waterland@Sun.COM {
190*9781SMoriah.Waterland@Sun.COM 	char		*pkginst;
191*9781SMoriah.Waterland@Sun.COM 	int		i;
192*9781SMoriah.Waterland@Sun.COM 	int		savenpkgs = npkgs;
193*9781SMoriah.Waterland@Sun.COM 
194*9781SMoriah.Waterland@Sun.COM 	/*
195*9781SMoriah.Waterland@Sun.COM 	 * entry assertions
196*9781SMoriah.Waterland@Sun.COM 	 */
197*9781SMoriah.Waterland@Sun.COM 
198*9781SMoriah.Waterland@Sun.COM 	assert(a_pkglist != (char **)NULL);
199*9781SMoriah.Waterland@Sun.COM 	assert(a_zlst != (zoneList_t)NULL);
200*9781SMoriah.Waterland@Sun.COM 	assert(a_zoneTempDir != (char *)NULL);
201*9781SMoriah.Waterland@Sun.COM 
202*9781SMoriah.Waterland@Sun.COM 	/*
203*9781SMoriah.Waterland@Sun.COM 	 * entry debugging info
204*9781SMoriah.Waterland@Sun.COM 	 */
205*9781SMoriah.Waterland@Sun.COM 
206*9781SMoriah.Waterland@Sun.COM 	echoDebug(DBG_PRERVFY_ENTRY);
207*9781SMoriah.Waterland@Sun.COM 
208*9781SMoriah.Waterland@Sun.COM 	/*
209*9781SMoriah.Waterland@Sun.COM 	 * localize messages
210*9781SMoriah.Waterland@Sun.COM 	 */
211*9781SMoriah.Waterland@Sun.COM 
212*9781SMoriah.Waterland@Sun.COM 	IMSG_PKGRMCHK_DEPSONME = MSG_PKGRMCHK_DEPSONME;
213*9781SMoriah.Waterland@Sun.COM 	IMSG_PKGRMCHK_PRENCI = MSG_PKGRMCHK_PRENCI;
214*9781SMoriah.Waterland@Sun.COM 	IMSG_PKGRMCHK_PREREQ = MSG_PKGRMCHK_PREREQ;
215*9781SMoriah.Waterland@Sun.COM 	IMSG_PKGRMCHK_RUNLEVEL = MSG_PKGRMCHK_RUNLEVEL;
216*9781SMoriah.Waterland@Sun.COM 	IMSG_PKGRMCHK_DEPEND = MSG_PKGRMCHK_DEPEND;
217*9781SMoriah.Waterland@Sun.COM 	IMSG_PKGRMCHK_PRIV = MSG_PKGRMCHK_PRIV;
218*9781SMoriah.Waterland@Sun.COM 	IMSG_PKGRMCHK_CKRUNLVL = MSG_PKGRMCHK_CKRUNLVL;
219*9781SMoriah.Waterland@Sun.COM 
220*9781SMoriah.Waterland@Sun.COM 	/*
221*9781SMoriah.Waterland@Sun.COM 	 * outer loop - process each package first
222*9781SMoriah.Waterland@Sun.COM 	 */
223*9781SMoriah.Waterland@Sun.COM 
224*9781SMoriah.Waterland@Sun.COM 	for (i = 0; (pkginst = a_pkglist[i]) != NULL; i++) {
225*9781SMoriah.Waterland@Sun.COM 
226*9781SMoriah.Waterland@Sun.COM 		char	*zoneName;
227*9781SMoriah.Waterland@Sun.COM 		int	zoneIndex;
228*9781SMoriah.Waterland@Sun.COM 
229*9781SMoriah.Waterland@Sun.COM 		/*
230*9781SMoriah.Waterland@Sun.COM 		 * inner loop - for each package process each zone second
231*9781SMoriah.Waterland@Sun.COM 		 */
232*9781SMoriah.Waterland@Sun.COM 
233*9781SMoriah.Waterland@Sun.COM 		if (pkgIsPkgInGzOnly(get_inst_root(), pkginst) == B_TRUE) {
234*9781SMoriah.Waterland@Sun.COM 			continue;
235*9781SMoriah.Waterland@Sun.COM 		}
236*9781SMoriah.Waterland@Sun.COM 
237*9781SMoriah.Waterland@Sun.COM 		for (zoneIndex = 0;
238*9781SMoriah.Waterland@Sun.COM 			(zoneName = z_zlist_get_zonename(a_zlst, zoneIndex)) !=
239*9781SMoriah.Waterland@Sun.COM 				(char *)NULL; zoneIndex++) {
240*9781SMoriah.Waterland@Sun.COM 
241*9781SMoriah.Waterland@Sun.COM 			FILE	*fp;
242*9781SMoriah.Waterland@Sun.COM 			char	line[PATH_MAX+1];
243*9781SMoriah.Waterland@Sun.COM 			char	preremovecheckPath[PATH_MAX+1];
244*9781SMoriah.Waterland@Sun.COM 			int	len;
245*9781SMoriah.Waterland@Sun.COM 
246*9781SMoriah.Waterland@Sun.COM 			/* skip the zone if it is NOT bootable */
247*9781SMoriah.Waterland@Sun.COM 
248*9781SMoriah.Waterland@Sun.COM 			if (z_zlist_is_zone_runnable(a_zlst,
249*9781SMoriah.Waterland@Sun.COM 			    zoneIndex) == B_FALSE) {
250*9781SMoriah.Waterland@Sun.COM 				continue;
251*9781SMoriah.Waterland@Sun.COM 			}
252*9781SMoriah.Waterland@Sun.COM 
253*9781SMoriah.Waterland@Sun.COM 			/* create path to this packages preremove check data */
254*9781SMoriah.Waterland@Sun.COM 
255*9781SMoriah.Waterland@Sun.COM 			len = snprintf(preremovecheckPath,
256*9781SMoriah.Waterland@Sun.COM 			    sizeof (preremovecheckPath),
257*9781SMoriah.Waterland@Sun.COM 			    "%s/%s.%s.preremovecheck.txt",
258*9781SMoriah.Waterland@Sun.COM 			    a_zoneTempDir, pkginst,
259*9781SMoriah.Waterland@Sun.COM 			    z_zlist_get_scratch(a_zlst, zoneIndex));
260*9781SMoriah.Waterland@Sun.COM 
261*9781SMoriah.Waterland@Sun.COM 			if (len > sizeof (preremovecheckPath)) {
262*9781SMoriah.Waterland@Sun.COM 				progerr(ERR_CREATE_PATH_3, a_zoneTempDir,
263*9781SMoriah.Waterland@Sun.COM 					pkginst, zoneName);
264*9781SMoriah.Waterland@Sun.COM 				continue;
265*9781SMoriah.Waterland@Sun.COM 			}
266*9781SMoriah.Waterland@Sun.COM 
267*9781SMoriah.Waterland@Sun.COM 			/* error if preremove check data path is not a file */
268*9781SMoriah.Waterland@Sun.COM 
269*9781SMoriah.Waterland@Sun.COM 			if (isfile((char *)NULL, preremovecheckPath) != 0) {
270*9781SMoriah.Waterland@Sun.COM 				echoDebug(DBG_PRERVFY_NOFILE, pkginst, zoneName,
271*9781SMoriah.Waterland@Sun.COM 					preremovecheckPath, strerror(errno));
272*9781SMoriah.Waterland@Sun.COM 				progerr(ERR_PRERVFY_NOFILE, pkginst, zoneName);
273*9781SMoriah.Waterland@Sun.COM 				continue;
274*9781SMoriah.Waterland@Sun.COM 			}
275*9781SMoriah.Waterland@Sun.COM 
276*9781SMoriah.Waterland@Sun.COM 			/* open the preremove check data file */
277*9781SMoriah.Waterland@Sun.COM 
278*9781SMoriah.Waterland@Sun.COM 			fp = fopen(preremovecheckPath, "r");
279*9781SMoriah.Waterland@Sun.COM 			if (fp == (FILE *)NULL) {
280*9781SMoriah.Waterland@Sun.COM 				progerr(ERR_PRERVFY_OPEN_FILE,
281*9781SMoriah.Waterland@Sun.COM 					preremovecheckPath, pkginst, zoneName,
282*9781SMoriah.Waterland@Sun.COM 					strerror(errno));
283*9781SMoriah.Waterland@Sun.COM 				continue;
284*9781SMoriah.Waterland@Sun.COM 			}
285*9781SMoriah.Waterland@Sun.COM 
286*9781SMoriah.Waterland@Sun.COM 			/* read and process each preremove check data line */
287*9781SMoriah.Waterland@Sun.COM 
288*9781SMoriah.Waterland@Sun.COM 			while (fgets(line, sizeof (line), fp) != (char *)NULL) {
289*9781SMoriah.Waterland@Sun.COM 				int	len;
290*9781SMoriah.Waterland@Sun.COM 				int	j;
291*9781SMoriah.Waterland@Sun.COM 
292*9781SMoriah.Waterland@Sun.COM 				/* remove all new-lines from end of line */
293*9781SMoriah.Waterland@Sun.COM 
294*9781SMoriah.Waterland@Sun.COM 				len = strlen(line);
295*9781SMoriah.Waterland@Sun.COM 				while ((len > 0) && (line[len-1] == '\n')) {
296*9781SMoriah.Waterland@Sun.COM 					line[--len] = '\0';
297*9781SMoriah.Waterland@Sun.COM 				}
298*9781SMoriah.Waterland@Sun.COM 
299*9781SMoriah.Waterland@Sun.COM 				/* ignore comment lines */
300*9781SMoriah.Waterland@Sun.COM 
301*9781SMoriah.Waterland@Sun.COM 				if (line[0] == '#') {
302*9781SMoriah.Waterland@Sun.COM 					continue;
303*9781SMoriah.Waterland@Sun.COM 				}
304*9781SMoriah.Waterland@Sun.COM 
305*9781SMoriah.Waterland@Sun.COM 				/* ignore empty lines */
306*9781SMoriah.Waterland@Sun.COM 
307*9781SMoriah.Waterland@Sun.COM 				if (line[0] == '\0') {
308*9781SMoriah.Waterland@Sun.COM 					continue;
309*9781SMoriah.Waterland@Sun.COM 				}
310*9781SMoriah.Waterland@Sun.COM 
311*9781SMoriah.Waterland@Sun.COM 				/* scan dependency list for this item */
312*9781SMoriah.Waterland@Sun.COM 
313*9781SMoriah.Waterland@Sun.COM 				for (j = 0;
314*9781SMoriah.Waterland@Sun.COM 					DEPCKL[j].name != (char *)NULL; j++) {
315*9781SMoriah.Waterland@Sun.COM 					len = strlen(DEPCKL[j].name);
316*9781SMoriah.Waterland@Sun.COM 
317*9781SMoriah.Waterland@Sun.COM 					if (strncmp(line, DEPCKL[j].name,
318*9781SMoriah.Waterland@Sun.COM 								len) == 0) {
319*9781SMoriah.Waterland@Sun.COM 						break;
320*9781SMoriah.Waterland@Sun.COM 					}
321*9781SMoriah.Waterland@Sun.COM 				}
322*9781SMoriah.Waterland@Sun.COM 
323*9781SMoriah.Waterland@Sun.COM 				echoDebug(DBG_PRERVFY_SCAN, line, pkginst,
324*9781SMoriah.Waterland@Sun.COM 						zoneName);
325*9781SMoriah.Waterland@Sun.COM 
326*9781SMoriah.Waterland@Sun.COM 				/* ignore line if not found */
327*9781SMoriah.Waterland@Sun.COM 
328*9781SMoriah.Waterland@Sun.COM 				if (DEPCKL[j].name == (char *)NULL) {
329*9781SMoriah.Waterland@Sun.COM 					progerr(ERR_PRERVFY_UNKNOWN_LINE, line,
330*9781SMoriah.Waterland@Sun.COM 							pkginst, zoneName);
331*9781SMoriah.Waterland@Sun.COM 					continue;
332*9781SMoriah.Waterland@Sun.COM 				}
333*9781SMoriah.Waterland@Sun.COM 
334*9781SMoriah.Waterland@Sun.COM 				if ((DEPCKL[j].ignore_values != (char *)NULL) &&
335*9781SMoriah.Waterland@Sun.COM 					(*(DEPCKL[j].ignore_values) != '\0') &&
336*9781SMoriah.Waterland@Sun.COM 					(strchr(DEPCKL[j].ignore_values,
337*9781SMoriah.Waterland@Sun.COM 						line[len]) != (char *)NULL)) {
338*9781SMoriah.Waterland@Sun.COM 						continue;
339*9781SMoriah.Waterland@Sun.COM 				}
340*9781SMoriah.Waterland@Sun.COM 				/* found match - record this dependency issue */
341*9781SMoriah.Waterland@Sun.COM 
342*9781SMoriah.Waterland@Sun.COM 				depchkRecordError(DEPCKL[j].record, pkginst,
343*9781SMoriah.Waterland@Sun.COM 					zoneName, &line[len]);
344*9781SMoriah.Waterland@Sun.COM 			}
345*9781SMoriah.Waterland@Sun.COM 
346*9781SMoriah.Waterland@Sun.COM 			/* close preremove check data file */
347*9781SMoriah.Waterland@Sun.COM 
348*9781SMoriah.Waterland@Sun.COM 			(void) fclose(fp);
349*9781SMoriah.Waterland@Sun.COM 		}
350*9781SMoriah.Waterland@Sun.COM 	}
351*9781SMoriah.Waterland@Sun.COM 
352*9781SMoriah.Waterland@Sun.COM 	/*
353*9781SMoriah.Waterland@Sun.COM 	 * all dependency issues have been recorded; report results
354*9781SMoriah.Waterland@Sun.COM 	 */
355*9781SMoriah.Waterland@Sun.COM 
356*9781SMoriah.Waterland@Sun.COM 	i = depchkReportErrors(DEPCKL);
357*9781SMoriah.Waterland@Sun.COM 
358*9781SMoriah.Waterland@Sun.COM 	/* restore "npkgs" */
359*9781SMoriah.Waterland@Sun.COM 
360*9781SMoriah.Waterland@Sun.COM 	npkgs = savenpkgs;
361*9781SMoriah.Waterland@Sun.COM 
362*9781SMoriah.Waterland@Sun.COM 	/* return continue/dont dontinue results */
363*9781SMoriah.Waterland@Sun.COM 
364*9781SMoriah.Waterland@Sun.COM 	return (i);
365*9781SMoriah.Waterland@Sun.COM }
366*9781SMoriah.Waterland@Sun.COM 
367*9781SMoriah.Waterland@Sun.COM /*
368*9781SMoriah.Waterland@Sun.COM  * Name:	getyorn
369*9781SMoriah.Waterland@Sun.COM  * Description:	Deliver dependency check reason; ask question; return response
370*9781SMoriah.Waterland@Sun.COM  * Arguments:	a_msg - pointer to string representing the message to output
371*9781SMoriah.Waterland@Sun.COM  *			such as 'The package <..> contains <...>'
372*9781SMoriah.Waterland@Sun.COM  *		a_pkg - pointer to string representing the package for which
373*9781SMoriah.Waterland@Sun.COM  *			the question is being asked
374*9781SMoriah.Waterland@Sun.COM  *		a_nocheck - should the message be output?
375*9781SMoriah.Waterland@Sun.COM  *			== 0 - do not output the message
376*9781SMoriah.Waterland@Sun.COM  *			!= 0 - output the message
377*9781SMoriah.Waterland@Sun.COM  *		a_quit - should the question NOT be asked?
378*9781SMoriah.Waterland@Sun.COM  *			== 0 - ask the question
379*9781SMoriah.Waterland@Sun.COM  *			!= 0 - do not ask the question - return "no"
380*9781SMoriah.Waterland@Sun.COM  *		a_helpMsg - pointer to string representing help message to be
381*9781SMoriah.Waterland@Sun.COM  *			made available if the question is asked
382*9781SMoriah.Waterland@Sun.COM  *			== NULL - no help message is available
383*9781SMoriah.Waterland@Sun.COM  *		a_adminMsg - pointer to string representing the dependency check
384*9781SMoriah.Waterland@Sun.COM  *			failure 'reason' - such as "Privilege checking failed."
385*9781SMoriah.Waterland@Sun.COM  *			== NULL - no failure reason is available
386*9781SMoriah.Waterland@Sun.COM  * Returns:	int - results of question/response actions
387*9781SMoriah.Waterland@Sun.COM  *			0 - success
388*9781SMoriah.Waterland@Sun.COM  *			1 - end of file
389*9781SMoriah.Waterland@Sun.COM  *			2 - undefined error
390*9781SMoriah.Waterland@Sun.COM  *			3 - answer was not "y"/was "q"
391*9781SMoriah.Waterland@Sun.COM  *			4 - quit action taken
392*9781SMoriah.Waterland@Sun.COM  *			5 - interactive mode required
393*9781SMoriah.Waterland@Sun.COM  */
394*9781SMoriah.Waterland@Sun.COM 
395*9781SMoriah.Waterland@Sun.COM static int
getyorn(char * a_msg,char * a_pkg,int a_nocheck,int a_quit,char * a_helpMsg,char * a_adminMsg)396*9781SMoriah.Waterland@Sun.COM getyorn(char *a_msg, char *a_pkg, int a_nocheck, int a_quit,
397*9781SMoriah.Waterland@Sun.COM 	char *a_helpMsg, char *a_adminMsg)
398*9781SMoriah.Waterland@Sun.COM {
399*9781SMoriah.Waterland@Sun.COM 	char	ans[MAX_INPUT];
400*9781SMoriah.Waterland@Sun.COM 	char	ask_cont[MSG_MAX];
401*9781SMoriah.Waterland@Sun.COM 	int	n;
402*9781SMoriah.Waterland@Sun.COM 	int	saveCkquit;
403*9781SMoriah.Waterland@Sun.COM 
404*9781SMoriah.Waterland@Sun.COM 	/*
405*9781SMoriah.Waterland@Sun.COM 	 * entry assertions
406*9781SMoriah.Waterland@Sun.COM 	 */
407*9781SMoriah.Waterland@Sun.COM 
408*9781SMoriah.Waterland@Sun.COM 	assert(a_pkg != (char *)NULL);
409*9781SMoriah.Waterland@Sun.COM 	assert(*a_pkg != '\0');
410*9781SMoriah.Waterland@Sun.COM 
411*9781SMoriah.Waterland@Sun.COM 	/*
412*9781SMoriah.Waterland@Sun.COM 	 * entry debugging info
413*9781SMoriah.Waterland@Sun.COM 	 */
414*9781SMoriah.Waterland@Sun.COM 
415*9781SMoriah.Waterland@Sun.COM 	echoDebug(DBG_PRERVFY_GETYORN_ARGS, a_pkg, a_nocheck, a_quit, a_msg,
416*9781SMoriah.Waterland@Sun.COM 			a_adminMsg ? a_adminMsg : "");
417*9781SMoriah.Waterland@Sun.COM 
418*9781SMoriah.Waterland@Sun.COM 	/* return success (0) if "nocheck" is non-zero */
419*9781SMoriah.Waterland@Sun.COM 
420*9781SMoriah.Waterland@Sun.COM 	if (a_nocheck != 0) {
421*9781SMoriah.Waterland@Sun.COM 		echoDebug(DBG_PRERVFY_GETYORN_NOCHECK, a_pkg);
422*9781SMoriah.Waterland@Sun.COM 		return (0);
423*9781SMoriah.Waterland@Sun.COM 	}
424*9781SMoriah.Waterland@Sun.COM 
425*9781SMoriah.Waterland@Sun.COM 	/* output reason for this particular failure */
426*9781SMoriah.Waterland@Sun.COM 
427*9781SMoriah.Waterland@Sun.COM 	if ((a_msg != (char *)NULL) && (*a_msg != '\0')) {
428*9781SMoriah.Waterland@Sun.COM 		ptext(stderr, "%s", a_msg);
429*9781SMoriah.Waterland@Sun.COM 	}
430*9781SMoriah.Waterland@Sun.COM 
431*9781SMoriah.Waterland@Sun.COM 	/* return "4 (administration)" if "quit" is non-zero */
432*9781SMoriah.Waterland@Sun.COM 
433*9781SMoriah.Waterland@Sun.COM 	if (a_quit != 0) {
434*9781SMoriah.Waterland@Sun.COM 		/* output failure "admin reason" if available */
435*9781SMoriah.Waterland@Sun.COM 		if ((a_adminMsg != (char *)NULL) && (*a_adminMsg != '\0')) {
436*9781SMoriah.Waterland@Sun.COM 			ptext(stderr, a_adminMsg);
437*9781SMoriah.Waterland@Sun.COM 		}
438*9781SMoriah.Waterland@Sun.COM 		echoDebug(DBG_PRERVFY_GETYORN_QUIT, a_pkg);
439*9781SMoriah.Waterland@Sun.COM 		return (4);
440*9781SMoriah.Waterland@Sun.COM 	}
441*9781SMoriah.Waterland@Sun.COM 
442*9781SMoriah.Waterland@Sun.COM 	/* return "5 (administration interaction required)" if -n */
443*9781SMoriah.Waterland@Sun.COM 
444*9781SMoriah.Waterland@Sun.COM 	if (echoGetFlag() == B_FALSE) {
445*9781SMoriah.Waterland@Sun.COM 		ptext(stderr, MSG_PRERVFY_GETYORN_SUSP, a_pkg);
446*9781SMoriah.Waterland@Sun.COM 		echoDebug(DBG_PRERVFY_GETYORN_QUIT_USER, a_pkg);
447*9781SMoriah.Waterland@Sun.COM 		return (5);
448*9781SMoriah.Waterland@Sun.COM 	}
449*9781SMoriah.Waterland@Sun.COM 
450*9781SMoriah.Waterland@Sun.COM 	/* prepare question to ask "continue with removal of pkg <xxx>?" */
451*9781SMoriah.Waterland@Sun.COM 
452*9781SMoriah.Waterland@Sun.COM 	(void) snprintf(ask_cont, sizeof (ask_cont), gettext(ASK_PKGRMCHK_CONT),
453*9781SMoriah.Waterland@Sun.COM 		a_pkg);
454*9781SMoriah.Waterland@Sun.COM 
455*9781SMoriah.Waterland@Sun.COM 	/* ask question */
456*9781SMoriah.Waterland@Sun.COM 
457*9781SMoriah.Waterland@Sun.COM 	saveCkquit = ckquit;
458*9781SMoriah.Waterland@Sun.COM 	ckquit = 0;
459*9781SMoriah.Waterland@Sun.COM 
460*9781SMoriah.Waterland@Sun.COM 	n = ckyorn(ans, NULL, NULL, a_helpMsg, ask_cont);
461*9781SMoriah.Waterland@Sun.COM 
462*9781SMoriah.Waterland@Sun.COM 	ckquit = saveCkquit;
463*9781SMoriah.Waterland@Sun.COM 
464*9781SMoriah.Waterland@Sun.COM 	if (n != 0) {
465*9781SMoriah.Waterland@Sun.COM 		ptext(stderr, MSG_PRERVFY_GETYORN_TERM, a_pkg);
466*9781SMoriah.Waterland@Sun.COM 		echoDebug(DBG_PRERVFY_GETYORN_CKYORN, a_pkg, n);
467*9781SMoriah.Waterland@Sun.COM 		return (n);
468*9781SMoriah.Waterland@Sun.COM 	}
469*9781SMoriah.Waterland@Sun.COM 
470*9781SMoriah.Waterland@Sun.COM 	/* return "3 (interruption) if not "y" or "Y" */
471*9781SMoriah.Waterland@Sun.COM 
472*9781SMoriah.Waterland@Sun.COM 	if (strchr("yY", *ans) == NULL) {
473*9781SMoriah.Waterland@Sun.COM 		ptext(stderr, MSG_PRERVFY_GETYORN_TERM_USER, a_pkg);
474*9781SMoriah.Waterland@Sun.COM 		echoDebug(DBG_PRERVFY_GETYORN_NOT_Y, a_pkg, ans);
475*9781SMoriah.Waterland@Sun.COM 		return (3);
476*9781SMoriah.Waterland@Sun.COM 	}
477*9781SMoriah.Waterland@Sun.COM 
478*9781SMoriah.Waterland@Sun.COM 	/* return "0 - success" */
479*9781SMoriah.Waterland@Sun.COM 
480*9781SMoriah.Waterland@Sun.COM 	echoDebug(DBG_PRERVFY_GETYORN_SUCCESS, a_pkg);
481*9781SMoriah.Waterland@Sun.COM 
482*9781SMoriah.Waterland@Sun.COM 	return (0);
483*9781SMoriah.Waterland@Sun.COM }
484*9781SMoriah.Waterland@Sun.COM 
485*9781SMoriah.Waterland@Sun.COM /*
486*9781SMoriah.Waterland@Sun.COM  * Trigger:	dependsonme=<<package>>
487*9781SMoriah.Waterland@Sun.COM  * Sequence:	- one or more: dependsonme=<<package>>
488*9781SMoriah.Waterland@Sun.COM  *		- one: rckdepend=<<n>>
489*9781SMoriah.Waterland@Sun.COM  * Actions:	Output message if "rdepend!=nocheck"
490*9781SMoriah.Waterland@Sun.COM  *		Return 0
491*9781SMoriah.Waterland@Sun.COM  *		Terminate when 'rckdepend' processed
492*9781SMoriah.Waterland@Sun.COM  */
493*9781SMoriah.Waterland@Sun.COM 
494*9781SMoriah.Waterland@Sun.COM static int
rckdepsonme(char * a_msg,char * a_pkg)495*9781SMoriah.Waterland@Sun.COM rckdepsonme(char *a_msg, char *a_pkg)
496*9781SMoriah.Waterland@Sun.COM {
497*9781SMoriah.Waterland@Sun.COM 	echoDebug(DBG_PRERVFY_RCKDEPSONME, a_pkg, a_msg);
498*9781SMoriah.Waterland@Sun.COM 
499*9781SMoriah.Waterland@Sun.COM 	if (!(ADM(rdepend, "nocheck"))) {
500*9781SMoriah.Waterland@Sun.COM 		ptext(stderr, "%s", a_msg);
501*9781SMoriah.Waterland@Sun.COM 	}
502*9781SMoriah.Waterland@Sun.COM 
503*9781SMoriah.Waterland@Sun.COM 	return (0);
504*9781SMoriah.Waterland@Sun.COM }
505*9781SMoriah.Waterland@Sun.COM 
506*9781SMoriah.Waterland@Sun.COM /*
507*9781SMoriah.Waterland@Sun.COM  * Trigger:	prerequisite-incomplete=<<package>>
508*9781SMoriah.Waterland@Sun.COM  * Sequence:	- one or more: prerequisite-incomplete=<<package>>
509*9781SMoriah.Waterland@Sun.COM  *		- one: rckdepend=<<n>>
510*9781SMoriah.Waterland@Sun.COM  * Actions:	Output message if "rdepend!=nocheck"
511*9781SMoriah.Waterland@Sun.COM  *		Return 0
512*9781SMoriah.Waterland@Sun.COM  *		Terminate when 'rckdepend' processed
513*9781SMoriah.Waterland@Sun.COM  */
514*9781SMoriah.Waterland@Sun.COM 
515*9781SMoriah.Waterland@Sun.COM static int
rckprenci(char * a_msg,char * a_pkg)516*9781SMoriah.Waterland@Sun.COM rckprenci(char *a_msg, char *a_pkg)
517*9781SMoriah.Waterland@Sun.COM {
518*9781SMoriah.Waterland@Sun.COM 	echoDebug(DBG_PRERVFY_RCKPRENCI, a_pkg, a_msg);
519*9781SMoriah.Waterland@Sun.COM 
520*9781SMoriah.Waterland@Sun.COM 	if (!(ADM(rdepend, "nocheck"))) {
521*9781SMoriah.Waterland@Sun.COM 		ptext(stderr, "%s", a_msg);
522*9781SMoriah.Waterland@Sun.COM 	}
523*9781SMoriah.Waterland@Sun.COM 
524*9781SMoriah.Waterland@Sun.COM 	return (0);
525*9781SMoriah.Waterland@Sun.COM }
526*9781SMoriah.Waterland@Sun.COM 
527*9781SMoriah.Waterland@Sun.COM /*
528*9781SMoriah.Waterland@Sun.COM  * Trigger:	prerequisite-installed=<<package>>
529*9781SMoriah.Waterland@Sun.COM  * Sequence:	- one or more: prerequisite-installed=<<package>>
530*9781SMoriah.Waterland@Sun.COM  *		- one: rckdepend=<<n>>
531*9781SMoriah.Waterland@Sun.COM  * Actions:	Output message if "rdepend!=nocheck"
532*9781SMoriah.Waterland@Sun.COM  *		Return 0
533*9781SMoriah.Waterland@Sun.COM  *		Terminate when 'rckdepend' processed
534*9781SMoriah.Waterland@Sun.COM  */
535*9781SMoriah.Waterland@Sun.COM 
536*9781SMoriah.Waterland@Sun.COM static int
rckprereq(char * a_msg,char * a_pkg)537*9781SMoriah.Waterland@Sun.COM rckprereq(char *a_msg, char *a_pkg)
538*9781SMoriah.Waterland@Sun.COM {
539*9781SMoriah.Waterland@Sun.COM 	echoDebug(DBG_PRERVFY_RCKPREREQ, a_pkg, a_msg);
540*9781SMoriah.Waterland@Sun.COM 
541*9781SMoriah.Waterland@Sun.COM 	if (!(ADM(rdepend, "nocheck"))) {
542*9781SMoriah.Waterland@Sun.COM 		ptext(stderr, "%s", a_msg);
543*9781SMoriah.Waterland@Sun.COM 	}
544*9781SMoriah.Waterland@Sun.COM 
545*9781SMoriah.Waterland@Sun.COM 	return (0);
546*9781SMoriah.Waterland@Sun.COM }
547*9781SMoriah.Waterland@Sun.COM 
548*9781SMoriah.Waterland@Sun.COM /*
549*9781SMoriah.Waterland@Sun.COM  * Return value:	int
550*9781SMoriah.Waterland@Sun.COM  *			0 - success
551*9781SMoriah.Waterland@Sun.COM  *			1 - end of file
552*9781SMoriah.Waterland@Sun.COM  *			2 - undefined error
553*9781SMoriah.Waterland@Sun.COM  *			3 - answer was not "y"/was "q"
554*9781SMoriah.Waterland@Sun.COM  *			4 - quit action taken
555*9781SMoriah.Waterland@Sun.COM  *			5 - interactive mode required
556*9781SMoriah.Waterland@Sun.COM  *			99 - fatal error
557*9781SMoriah.Waterland@Sun.COM  */
558*9781SMoriah.Waterland@Sun.COM 
559*9781SMoriah.Waterland@Sun.COM static int
rckrunlevel(char * a_msg,char * a_pkg)560*9781SMoriah.Waterland@Sun.COM rckrunlevel(char *a_msg, char *a_pkg)
561*9781SMoriah.Waterland@Sun.COM {
562*9781SMoriah.Waterland@Sun.COM 	echoDebug(DBG_PRERVFY_RCKRUNLEVEL, a_pkg, a_msg);
563*9781SMoriah.Waterland@Sun.COM 	/*
564*9781SMoriah.Waterland@Sun.COM 	 * For now, we are ignoring runlevel removal issues within
565*9781SMoriah.Waterland@Sun.COM 	 * non-global zones.  This is questionable, but the RSTATES
566*9781SMoriah.Waterland@Sun.COM 	 * feature is rarely used and known uses within Solaris are
567*9781SMoriah.Waterland@Sun.COM 	 * effectively no-ops as of this time
568*9781SMoriah.Waterland@Sun.COM 	 */
569*9781SMoriah.Waterland@Sun.COM 	return (0);
570*9781SMoriah.Waterland@Sun.COM }
571*9781SMoriah.Waterland@Sun.COM 
572*9781SMoriah.Waterland@Sun.COM /*
573*9781SMoriah.Waterland@Sun.COM  * Trigger:	rckdepend=<<n>>
574*9781SMoriah.Waterland@Sun.COM  * Sequence:	- one or more of:
575*9781SMoriah.Waterland@Sun.COM  *		-- incompat=<<package>>
576*9781SMoriah.Waterland@Sun.COM  *		-- prerequisite-incomplete=<<package>>
577*9781SMoriah.Waterland@Sun.COM  *		-- prerequisite-installed=<<package>>
578*9781SMoriah.Waterland@Sun.COM  *		-- dependson=<<package>>
579*9781SMoriah.Waterland@Sun.COM  *		-- dependsonme=<<package>>
580*9781SMoriah.Waterland@Sun.COM  *		- one: ckpdepend=<<n>>
581*9781SMoriah.Waterland@Sun.COM  * Actions:	process according to settings
582*9781SMoriah.Waterland@Sun.COM  * Return value:	int
583*9781SMoriah.Waterland@Sun.COM  *			0 - success
584*9781SMoriah.Waterland@Sun.COM  *			1 - end of file
585*9781SMoriah.Waterland@Sun.COM  *			2 - undefined error
586*9781SMoriah.Waterland@Sun.COM  *			3 - answer was not "y"/was "q"
587*9781SMoriah.Waterland@Sun.COM  *			4 - quit action taken
588*9781SMoriah.Waterland@Sun.COM  *			5 - interactive mode required
589*9781SMoriah.Waterland@Sun.COM  */
590*9781SMoriah.Waterland@Sun.COM 
591*9781SMoriah.Waterland@Sun.COM static int
rckdepend(char * a_msg,char * a_pkg)592*9781SMoriah.Waterland@Sun.COM rckdepend(char *a_msg, char *a_pkg)
593*9781SMoriah.Waterland@Sun.COM {
594*9781SMoriah.Waterland@Sun.COM 	echoDebug(DBG_PRERVFY_RCKDEPEND, a_pkg, a_msg);
595*9781SMoriah.Waterland@Sun.COM 
596*9781SMoriah.Waterland@Sun.COM 	return (getyorn(a_msg, a_pkg, ADM(rdepend, "nocheck"),
597*9781SMoriah.Waterland@Sun.COM 		ADM(rdepend, "quit"), HLP_PKGRMCHK_DEPEND,
598*9781SMoriah.Waterland@Sun.COM 		ERR_PKGRMCHK_DEPFAILED));
599*9781SMoriah.Waterland@Sun.COM }
600*9781SMoriah.Waterland@Sun.COM 
601*9781SMoriah.Waterland@Sun.COM /*
602*9781SMoriah.Waterland@Sun.COM  * Trigger:	rckpriv=<<n>>
603*9781SMoriah.Waterland@Sun.COM  * Sequence:	- one: rckpriv=<<n>>
604*9781SMoriah.Waterland@Sun.COM  * Actions:	process according to settings
605*9781SMoriah.Waterland@Sun.COM  * Return value:	int
606*9781SMoriah.Waterland@Sun.COM  *			0 - success
607*9781SMoriah.Waterland@Sun.COM  *			1 - end of file
608*9781SMoriah.Waterland@Sun.COM  *			2 - undefined error
609*9781SMoriah.Waterland@Sun.COM  *			3 - answer was not "y"/was "q"
610*9781SMoriah.Waterland@Sun.COM  *			4 - quit action taken
611*9781SMoriah.Waterland@Sun.COM  *			5 - interactive mode required
612*9781SMoriah.Waterland@Sun.COM  */
613*9781SMoriah.Waterland@Sun.COM 
614*9781SMoriah.Waterland@Sun.COM static int
rckpriv(char * a_msg,char * a_pkg)615*9781SMoriah.Waterland@Sun.COM rckpriv(char *a_msg, char *a_pkg)
616*9781SMoriah.Waterland@Sun.COM {
617*9781SMoriah.Waterland@Sun.COM 	echoDebug(DBG_PRERVFY_RCKPRIV, a_pkg, a_msg);
618*9781SMoriah.Waterland@Sun.COM 
619*9781SMoriah.Waterland@Sun.COM 	return (getyorn(a_msg, a_pkg, ADM(action, "nocheck"),
620*9781SMoriah.Waterland@Sun.COM 		ADM(action, "quit"), HLP_PKGRMCHK_PRIV,
621*9781SMoriah.Waterland@Sun.COM 		ERR_PKGRMCHK_PRIVFAILED));
622*9781SMoriah.Waterland@Sun.COM }
623