xref: /illumos-gate/usr/src/cmd/svr4pkg/pkgadd/check.c (revision 5c51f124)
1*5c51f124SMoriah Waterland /*
2*5c51f124SMoriah Waterland  * CDDL HEADER START
3*5c51f124SMoriah Waterland  *
4*5c51f124SMoriah Waterland  * The contents of this file are subject to the terms of the
5*5c51f124SMoriah Waterland  * Common Development and Distribution License (the "License").
6*5c51f124SMoriah Waterland  * You may not use this file except in compliance with the License.
7*5c51f124SMoriah Waterland  *
8*5c51f124SMoriah Waterland  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*5c51f124SMoriah Waterland  * or http://www.opensolaris.org/os/licensing.
10*5c51f124SMoriah Waterland  * See the License for the specific language governing permissions
11*5c51f124SMoriah Waterland  * and limitations under the License.
12*5c51f124SMoriah Waterland  *
13*5c51f124SMoriah Waterland  * When distributing Covered Code, include this CDDL HEADER in each
14*5c51f124SMoriah Waterland  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*5c51f124SMoriah Waterland  * If applicable, add the following below this CDDL HEADER, with the
16*5c51f124SMoriah Waterland  * fields enclosed by brackets "[]" replaced with your own identifying
17*5c51f124SMoriah Waterland  * information: Portions Copyright [yyyy] [name of copyright owner]
18*5c51f124SMoriah Waterland  *
19*5c51f124SMoriah Waterland  * CDDL HEADER END
20*5c51f124SMoriah Waterland  */
21*5c51f124SMoriah Waterland 
22*5c51f124SMoriah Waterland /*
23*5c51f124SMoriah Waterland  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*5c51f124SMoriah Waterland  * Use is subject to license terms.
25*5c51f124SMoriah Waterland  */
26*5c51f124SMoriah Waterland 
27*5c51f124SMoriah Waterland #include <stdio.h>
28*5c51f124SMoriah Waterland #include <limits.h>
29*5c51f124SMoriah Waterland #include <string.h>
30*5c51f124SMoriah Waterland #include <stdlib.h>
31*5c51f124SMoriah Waterland #include <sys/stat.h>
32*5c51f124SMoriah Waterland #include <unistd.h>
33*5c51f124SMoriah Waterland #include <errno.h>
34*5c51f124SMoriah Waterland #include <dirent.h>
35*5c51f124SMoriah Waterland #include <sys/types.h>
36*5c51f124SMoriah Waterland #include <locale.h>
37*5c51f124SMoriah Waterland #include <libintl.h>
38*5c51f124SMoriah Waterland #include <pkgstrct.h>
39*5c51f124SMoriah Waterland #include <pkglocs.h>
40*5c51f124SMoriah Waterland #include <assert.h>
41*5c51f124SMoriah Waterland 
42*5c51f124SMoriah Waterland #include <instzones_api.h>
43*5c51f124SMoriah Waterland #include <pkglib.h>
44*5c51f124SMoriah Waterland #include <messages.h>
45*5c51f124SMoriah Waterland 
46*5c51f124SMoriah Waterland #include <install.h>
47*5c51f124SMoriah Waterland #include <libinst.h>
48*5c51f124SMoriah Waterland #include <libadm.h>
49*5c51f124SMoriah Waterland 
50*5c51f124SMoriah Waterland extern int	npkgs;	/* the number of packages yet to be installed */
51*5c51f124SMoriah Waterland 
52*5c51f124SMoriah Waterland /*
53*5c51f124SMoriah Waterland  * ckquit is a global that controls 'ckyorn' (defined in libadm)
54*5c51f124SMoriah Waterland  * If ckquit is non-zero, then "quit" is allowed as an answer when
55*5c51f124SMoriah Waterland  * ckyorn is called. If is it zero, then "quit" is not an allowed answer.
56*5c51f124SMoriah Waterland  */
57*5c51f124SMoriah Waterland extern int	ckquit;
58*5c51f124SMoriah Waterland 
59*5c51f124SMoriah Waterland extern struct admin adm;
60*5c51f124SMoriah Waterland 
61*5c51f124SMoriah Waterland /*
62*5c51f124SMoriah Waterland  * each one of these represents a single kind of dependency check
63*5c51f124SMoriah Waterland  */
64*5c51f124SMoriah Waterland 
65*5c51f124SMoriah Waterland static depckError_t er_ckconflict = {0, (depckErrorRecord_t *)NULL};
66*5c51f124SMoriah Waterland static depckError_t er_ckdepend = {0, (depckErrorRecord_t *)NULL};
67*5c51f124SMoriah Waterland static depckError_t er_ckcfcontent = {0, (depckErrorRecord_t *)NULL};
68*5c51f124SMoriah Waterland static depckError_t er_ckinstance = {0, (depckErrorRecord_t *)NULL};
69*5c51f124SMoriah Waterland static depckError_t er_ckdirs = {0, (depckErrorRecord_t *)NULL};
70*5c51f124SMoriah Waterland static depckError_t er_ckpartinst = {0, (depckErrorRecord_t *)NULL};
71*5c51f124SMoriah Waterland static depckError_t er_ckpartrem = {0, (depckErrorRecord_t *)NULL};
72*5c51f124SMoriah Waterland static depckError_t er_ckpkgdirs = {0, (depckErrorRecord_t *)NULL};
73*5c51f124SMoriah Waterland static depckError_t er_ckpkgfilebad = {0, (depckErrorRecord_t *)NULL};
74*5c51f124SMoriah Waterland static depckError_t er_ckpkgfiles = {0, (depckErrorRecord_t *)NULL};
75*5c51f124SMoriah Waterland static depckError_t er_ckpriv = {0, (depckErrorRecord_t *)NULL};
76*5c51f124SMoriah Waterland static depckError_t er_ckrunlevel = {0, (depckErrorRecord_t *)NULL};
77*5c51f124SMoriah Waterland static depckError_t er_cksetuid = {0, (depckErrorRecord_t *)NULL};
78*5c51f124SMoriah Waterland static depckError_t er_ckspace = {0, (depckErrorRecord_t *)NULL};
79*5c51f124SMoriah Waterland static depckError_t er_newonly = {0, (depckErrorRecord_t *)NULL};
80*5c51f124SMoriah Waterland static depckError_t er_prereqinc = {0, (depckErrorRecord_t *)NULL};
81*5c51f124SMoriah Waterland static depckError_t er_prereqinst = {0, (depckErrorRecord_t *)NULL};
82*5c51f124SMoriah Waterland static depckError_t er_runlevel = {0, (depckErrorRecord_t *)NULL};
83*5c51f124SMoriah Waterland static depckError_t er_same = {0, (depckErrorRecord_t *)NULL};
84*5c51f124SMoriah Waterland static depckError_t er_overwrite = {0, (depckErrorRecord_t *)NULL};
85*5c51f124SMoriah Waterland static depckError_t er_uniq1 = {0, (depckErrorRecord_t *)NULL};
86*5c51f124SMoriah Waterland static depckError_t er_attrib = {0, NULL};
87*5c51f124SMoriah Waterland static depckError_t er_setuidf = {0, NULL};
88*5c51f124SMoriah Waterland static depckError_t er_setgidf = {0, NULL};
89*5c51f124SMoriah Waterland static depckError_t er_overwr = {0, NULL};
90*5c51f124SMoriah Waterland 
91*5c51f124SMoriah Waterland /*
92*5c51f124SMoriah Waterland  * each one of these represents a localized message for a single kind
93*5c51f124SMoriah Waterland  * of dependency check
94*5c51f124SMoriah Waterland  */
95*5c51f124SMoriah Waterland 
96*5c51f124SMoriah Waterland static char *IMSG_ABADFILE = (char *)NULL;
97*5c51f124SMoriah Waterland static char *IMSG_BADFILE = (char *)NULL;
98*5c51f124SMoriah Waterland static char *IMSG_CKRUNLVL = (char *)NULL;
99*5c51f124SMoriah Waterland static char *IMSG_CNFFAILED = (char *)NULL;
100*5c51f124SMoriah Waterland static char *IMSG_DEPEND = (char *)NULL;
101*5c51f124SMoriah Waterland static char *IMSG_CFCONTENT = (char *)NULL;
102*5c51f124SMoriah Waterland static char *IMSG_INSTANCE = "INSTANCE %s <%s> on %s <%s>";
103*5c51f124SMoriah Waterland static char *IMSG_DIRS  = (char *)NULL;
104*5c51f124SMoriah Waterland static char *IMSG_NEWONLY = (char *)NULL;
105*5c51f124SMoriah Waterland static char *IMSG_PARTINST = (char *)NULL;
106*5c51f124SMoriah Waterland static char *IMSG_PARTREM = (char *)NULL;
107*5c51f124SMoriah Waterland static char *IMSG_PKGDIRS = (char *)NULL;
108*5c51f124SMoriah Waterland static char *IMSG_PRENCI  = (char *)NULL;
109*5c51f124SMoriah Waterland static char *IMSG_PREREQ  = (char *)NULL;
110*5c51f124SMoriah Waterland static char *IMSG_PRIV = (char *)NULL;
111*5c51f124SMoriah Waterland static char *IMSG_RUNLEVEL = (char *)NULL;
112*5c51f124SMoriah Waterland static char *IMSG_SAME = (char *)NULL;
113*5c51f124SMoriah Waterland static char *IMSG_OVERWRITE = (char *)NULL;
114*5c51f124SMoriah Waterland static char *IMSG_UNIQ1 = (char *)NULL;
115*5c51f124SMoriah Waterland static char *IMSG_SETUID = (char *)NULL;
116*5c51f124SMoriah Waterland static char *IMSG_SPCFAILED = (char *)NULL;
117*5c51f124SMoriah Waterland static char *IMSG_ATTRIB;
118*5c51f124SMoriah Waterland static char *IMSG_SETUIDF;
119*5c51f124SMoriah Waterland static char *IMSG_SETGIDF;
120*5c51f124SMoriah Waterland static char *IMSG_OVERWR;
121*5c51f124SMoriah Waterland 
122*5c51f124SMoriah Waterland /*
123*5c51f124SMoriah Waterland  * each one of these represents a function to handle a single kind of
124*5c51f124SMoriah Waterland  * dependency check
125*5c51f124SMoriah Waterland  */
126*5c51f124SMoriah Waterland 
127*5c51f124SMoriah Waterland static int ckconflict(char *a_msg, char *a_pkg);
128*5c51f124SMoriah Waterland static int ckdepend(char *a_msg, char *a_pkg);
129*5c51f124SMoriah Waterland static int ckcfcontent(char *a_msg, char *a_pkg);
130*5c51f124SMoriah Waterland static int ckinstance(char *a_msg, char *a_pkg);
131*5c51f124SMoriah Waterland static int ckdirs(char *a_msg, char *a_pkg);
132*5c51f124SMoriah Waterland static int ckpartinst(char *a_msg, char *a_pkg);
133*5c51f124SMoriah Waterland static int ckpartrem(char *a_msg, char *a_pkg);
134*5c51f124SMoriah Waterland static int ckpkgfilebad(char *a_msg, char *a_pkg);
135*5c51f124SMoriah Waterland static int ckpkgdirs(char *a_msg, char *a_pkg);
136*5c51f124SMoriah Waterland static int ckpkgfiles(char *a_msg, char *a_pkg);
137*5c51f124SMoriah Waterland static int ckprereqinc(char *a_msg, char *a_pkg);
138*5c51f124SMoriah Waterland static int ckprereqinst(char *a_msg, char *a_pkg);
139*5c51f124SMoriah Waterland static int ckpriv(char *a_msg, char *a_pkg);
140*5c51f124SMoriah Waterland static int ckrunlevel(char *a_msg, char *a_pkg);
141*5c51f124SMoriah Waterland static int cksetuid(char *a_msg, char *a_pkg);
142*5c51f124SMoriah Waterland static int ckspace(char *a_msg, char *a_pkg);
143*5c51f124SMoriah Waterland static int attrib(char *a_msg, char *a_pkg);
144*5c51f124SMoriah Waterland static int setuidf(char *a_msg, char *a_pkg);
145*5c51f124SMoriah Waterland static int setgidf(char *a_msg, char *a_pkg);
146*5c51f124SMoriah Waterland static int overwr(char *a_msg, char *a_pkg);
147*5c51f124SMoriah Waterland 
148*5c51f124SMoriah Waterland static depckl_t DEPCKL[] = {
149*5c51f124SMoriah Waterland 	/*
150*5c51f124SMoriah Waterland 	 * name,	ignore_values,	err_msg,	depcklFunc,	recrd
151*5c51f124SMoriah Waterland 	 * ---
152*5c51f124SMoriah Waterland 	 * ignore_values == NULL:
153*5c51f124SMoriah Waterland 	 * package and zone information is collected in the "record" object for
154*5c51f124SMoriah Waterland 	 * each occurance - then a message is constructed for each zone that
155*5c51f124SMoriah Waterland 	 * reported the condition - the message includes that portion of the
156*5c51f124SMoriah Waterland 	 * check past the "=" - then the specified "depcklFunc" is called to
157*5c51f124SMoriah Waterland 	 * process each message.
158*5c51f124SMoriah Waterland 	 * Message format:
159*5c51f124SMoriah Waterland 	 * 	%s %s <%s> %s <%s>
160*5c51f124SMoriah Waterland 	 * Message arguments:
161*5c51f124SMoriah Waterland 	 *	value, "package", package-name, "zone/zones", zone-name
162*5c51f124SMoriah Waterland 	 * ---
163*5c51f124SMoriah Waterland 	 * ignore-values == "???":
164*5c51f124SMoriah Waterland 	 * these checks are ignored if they return one of the listed values
165*5c51f124SMoriah Waterland 	 * if they do NOT return one of the listed values, then the package
166*5c51f124SMoriah Waterland 	 * and zone information is collected in the "record" object for each
167*5c51f124SMoriah Waterland 	 * occurance - then a single unified message is constructed for all
168*5c51f124SMoriah Waterland 	 * zones that report the same condition; then the specified "depcklFunc"
169*5c51f124SMoriah Waterland 	 * is called to process the resulting combined message.
170*5c51f124SMoriah Waterland 	 * Message format:
171*5c51f124SMoriah Waterland 	 * 	%s <%s> %s <%s>
172*5c51f124SMoriah Waterland 	 * Message arguments:
173*5c51f124SMoriah Waterland 	 *	"package", package-name, "zone/zones", zone-name(s)
174*5c51f124SMoriah Waterland 	 * ---
175*5c51f124SMoriah Waterland 	 * ignore-values="":
176*5c51f124SMoriah Waterland 	 * same as above BUT no check to ignore is done; message always reported
177*5c51f124SMoriah Waterland 	 */
178*5c51f124SMoriah Waterland 
179*5c51f124SMoriah Waterland 	{ "install-same-instance=true",	"",		&IMSG_SAME,
180*5c51f124SMoriah Waterland 					NULL,		&er_same
181*5c51f124SMoriah Waterland 	},
182*5c51f124SMoriah Waterland 	{ "ckpkgfilebad=",		NULL,		&IMSG_ABADFILE,
183*5c51f124SMoriah Waterland 					&ckpkgfilebad,	&er_ckpkgfilebad
184*5c51f124SMoriah Waterland 	},
185*5c51f124SMoriah Waterland 	{ "ckdirs=",			NULL,		&IMSG_DIRS,
186*5c51f124SMoriah Waterland 					&ckdirs,	&er_ckdirs
187*5c51f124SMoriah Waterland 	},
188*5c51f124SMoriah Waterland 	{ "prerequisite-incomplete=",	NULL,		&IMSG_PRENCI,
189*5c51f124SMoriah Waterland 					&ckprereqinc,	&er_prereqinc
190*5c51f124SMoriah Waterland 	},
191*5c51f124SMoriah Waterland 	{ "prerequisite-installed=",	NULL,		&IMSG_PREREQ,
192*5c51f124SMoriah Waterland 					&ckprereqinst,	&er_prereqinst
193*5c51f124SMoriah Waterland 	},
194*5c51f124SMoriah Waterland 	{ "runlevel=",			NULL,		&IMSG_RUNLEVEL,
195*5c51f124SMoriah Waterland 					NULL,		&er_runlevel
196*5c51f124SMoriah Waterland 	},
197*5c51f124SMoriah Waterland 	{ "conflict-contents=",		NULL,		&IMSG_CFCONTENT,
198*5c51f124SMoriah Waterland 					&ckcfcontent,	&er_ckcfcontent
199*5c51f124SMoriah Waterland 	},
200*5c51f124SMoriah Waterland 	{ "ckconflict=",		"0",		&IMSG_CNFFAILED,
201*5c51f124SMoriah Waterland 					&ckconflict,	&er_ckconflict
202*5c51f124SMoriah Waterland 	},
203*5c51f124SMoriah Waterland 	{ "ckdepend=",			"0",		&IMSG_DEPEND,
204*5c51f124SMoriah Waterland 					&ckdepend,	&er_ckdepend
205*5c51f124SMoriah Waterland 	},
206*5c51f124SMoriah Waterland 	{ "ckpartialinstall=",		"0",		&IMSG_PARTINST,
207*5c51f124SMoriah Waterland 					&ckpartinst,	&er_ckpartinst
208*5c51f124SMoriah Waterland 	},
209*5c51f124SMoriah Waterland 	{ "ckpartialremove=",		"0",		&IMSG_PARTREM,
210*5c51f124SMoriah Waterland 					&ckpartrem,	&er_ckpartrem
211*5c51f124SMoriah Waterland 	},
212*5c51f124SMoriah Waterland 	{ "ckpkgdirs=",			"0",		&IMSG_PKGDIRS,
213*5c51f124SMoriah Waterland 					&ckpkgdirs,	&er_ckpkgdirs
214*5c51f124SMoriah Waterland 	},
215*5c51f124SMoriah Waterland 	{ "ckpkgfiles=",		"0",		&IMSG_BADFILE,
216*5c51f124SMoriah Waterland 					&ckpkgfiles,	&er_ckpkgfiles
217*5c51f124SMoriah Waterland 	},
218*5c51f124SMoriah Waterland 	{ "ckpriv=",			"0",		&IMSG_PRIV,
219*5c51f124SMoriah Waterland 					&ckpriv,	&er_ckpriv
220*5c51f124SMoriah Waterland 	},
221*5c51f124SMoriah Waterland 	{ "ckrunlevel=",		"0",		&IMSG_CKRUNLVL,
222*5c51f124SMoriah Waterland 					&ckrunlevel,	&er_ckrunlevel
223*5c51f124SMoriah Waterland 	},
224*5c51f124SMoriah Waterland 	{ "cksetuid=",			"0",		&IMSG_SETUID,
225*5c51f124SMoriah Waterland 					&cksetuid,	&er_cksetuid
226*5c51f124SMoriah Waterland 	},
227*5c51f124SMoriah Waterland 	{ "ckspace=",			"0",		&IMSG_SPCFAILED,
228*5c51f124SMoriah Waterland 					&ckspace,	&er_ckspace
229*5c51f124SMoriah Waterland 	},
230*5c51f124SMoriah Waterland 	{ "install-new-only=true",	"",		&IMSG_NEWONLY,
231*5c51f124SMoriah Waterland 					NULL,		&er_newonly
232*5c51f124SMoriah Waterland 	},
233*5c51f124SMoriah Waterland 	{ "install-ovewrite=true",	"",		&IMSG_OVERWRITE,
234*5c51f124SMoriah Waterland 					NULL,		&er_overwrite
235*5c51f124SMoriah Waterland 	},
236*5c51f124SMoriah Waterland 	{ "install-too-many-instances=true",	"",	&IMSG_UNIQ1,
237*5c51f124SMoriah Waterland 					NULL,		&er_uniq1
238*5c51f124SMoriah Waterland 	},
239*5c51f124SMoriah Waterland 	{ "ckinstance=",		"0",		&IMSG_INSTANCE,
240*5c51f124SMoriah Waterland 					&ckinstance,	&er_ckinstance
241*5c51f124SMoriah Waterland 	},
242*5c51f124SMoriah Waterland 	{ "conflict-attributes=",	NULL,		&IMSG_ATTRIB,
243*5c51f124SMoriah Waterland 					&attrib,	&er_attrib
244*5c51f124SMoriah Waterland 	},
245*5c51f124SMoriah Waterland 	{ "setuid=",			NULL,		&IMSG_SETUIDF,
246*5c51f124SMoriah Waterland 					&setuidf,	&er_setuidf
247*5c51f124SMoriah Waterland 	},
248*5c51f124SMoriah Waterland 	{ "setgid=",			NULL,		&IMSG_SETGIDF,
249*5c51f124SMoriah Waterland 					&setgidf,	&er_setgidf
250*5c51f124SMoriah Waterland 	},
251*5c51f124SMoriah Waterland 	{ "setuid-overwrite=true",	"",		&IMSG_OVERWR,
252*5c51f124SMoriah Waterland 					&overwr,	&er_overwr
253*5c51f124SMoriah Waterland 	},
254*5c51f124SMoriah Waterland 
255*5c51f124SMoriah Waterland 	{ NULL,				NULL,	NULL,
256*5c51f124SMoriah Waterland 				NULL,		NULL }
257*5c51f124SMoriah Waterland };
258*5c51f124SMoriah Waterland 
259*5c51f124SMoriah Waterland /*
260*5c51f124SMoriah Waterland  * Name:	preinstall_verify
261*5c51f124SMoriah Waterland  * Description:	verify results of preinstallation dependency checking
262*5c51f124SMoriah Waterland  * Arguments:	a_pkglist - pointer to array of strings representing the names
263*5c51f124SMoriah Waterland  *			of all the packages that have been checked
264*5c51f124SMoriah Waterland  *		a_zlst - list of zones that dependencies were checked on
265*5c51f124SMoriah Waterland  *		a_zoneTempDir - pointer to string representing the path where
266*5c51f124SMoriah Waterland  *			the files containing the preinstallation dependency
267*5c51f124SMoriah Waterland  *			check data are located
268*5c51f124SMoriah Waterland  * Returns:	int
269*5c51f124SMoriah Waterland  *		== 0 - continue processing
270*5c51f124SMoriah Waterland  *		!= 0 - do not continue processing
271*5c51f124SMoriah Waterland  */
272*5c51f124SMoriah Waterland 
273*5c51f124SMoriah Waterland int
preinstall_verify(char ** a_pkglist,zoneList_t a_zlst,char * a_zoneTempDir)274*5c51f124SMoriah Waterland preinstall_verify(char **a_pkglist, zoneList_t a_zlst, char *a_zoneTempDir)
275*5c51f124SMoriah Waterland {
276*5c51f124SMoriah Waterland 	char		*pkginst;
277*5c51f124SMoriah Waterland 	int		i;
278*5c51f124SMoriah Waterland 	int		savenpkgs = npkgs;
279*5c51f124SMoriah Waterland 
280*5c51f124SMoriah Waterland 	/*
281*5c51f124SMoriah Waterland 	 * entry assertions
282*5c51f124SMoriah Waterland 	 */
283*5c51f124SMoriah Waterland 
284*5c51f124SMoriah Waterland 	assert(a_pkglist != (char **)NULL);
285*5c51f124SMoriah Waterland 	assert(a_zlst != (zoneList_t)NULL);
286*5c51f124SMoriah Waterland 	assert(a_zoneTempDir != (char *)NULL);
287*5c51f124SMoriah Waterland 
288*5c51f124SMoriah Waterland 	/*
289*5c51f124SMoriah Waterland 	 * entry debugging info
290*5c51f124SMoriah Waterland 	 */
291*5c51f124SMoriah Waterland 
292*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_ENTRY);
293*5c51f124SMoriah Waterland 
294*5c51f124SMoriah Waterland 	/*
295*5c51f124SMoriah Waterland 	 * localize messages
296*5c51f124SMoriah Waterland 	 */
297*5c51f124SMoriah Waterland 
298*5c51f124SMoriah Waterland 	IMSG_ABADFILE = MSG_PKGADDCHK_ABADFILE;
299*5c51f124SMoriah Waterland 	IMSG_BADFILE = MSG_PKGADDCHK_BADFILE;
300*5c51f124SMoriah Waterland 	IMSG_CFCONTENT = MSG_PKGADDCHK_CFCONTENT;
301*5c51f124SMoriah Waterland 	IMSG_CKRUNLVL = MSG_PKGADDCHK_CKRUNLVL;
302*5c51f124SMoriah Waterland 	IMSG_CNFFAILED = MSG_PKGADDCHK_CNFFAILED;
303*5c51f124SMoriah Waterland 	IMSG_DEPEND = MSG_PKGADDCHK_DEPEND;
304*5c51f124SMoriah Waterland 	IMSG_DIRS  = MSG_PKGADDCHK_DIRS;
305*5c51f124SMoriah Waterland 	IMSG_NEWONLY = MSG_PKGADDCHK_NEWONLY;
306*5c51f124SMoriah Waterland 	IMSG_OVERWRITE = MSG_PKGADDCHK_OVERWRITE;
307*5c51f124SMoriah Waterland 	IMSG_PARTINST = MSG_PKGADDCHK_PARTINST;
308*5c51f124SMoriah Waterland 	IMSG_PARTREM = MSG_PKGADDCHK_PARTREM;
309*5c51f124SMoriah Waterland 	IMSG_PKGDIRS = MSG_PKGADDCHK_PKGDIRS;
310*5c51f124SMoriah Waterland 	IMSG_PRENCI  = MSG_PKGADDCHK_PRENCI;
311*5c51f124SMoriah Waterland 	IMSG_PREREQ  = MSG_PKGADDCHK_PREREQ;
312*5c51f124SMoriah Waterland 	IMSG_PRIV = MSG_PKGADDCHK_PRIV;
313*5c51f124SMoriah Waterland 	IMSG_RUNLEVEL = MSG_PKGADDCHK_RUNLEVEL;
314*5c51f124SMoriah Waterland 	IMSG_SAME = MSG_PKGADDCHK_SAME;
315*5c51f124SMoriah Waterland 	IMSG_SETUID = MSG_PKGADDCHK_SETUID;
316*5c51f124SMoriah Waterland 	IMSG_SPCFAILED = MSG_PKGADDCHK_SPCFAILED;
317*5c51f124SMoriah Waterland 	IMSG_UNIQ1 = MSG_PKGADDCHK_UNIQ1;
318*5c51f124SMoriah Waterland 	IMSG_ATTRIB = gettext("\\nattribute change for %s <%s> on %s <%s>\n");
319*5c51f124SMoriah Waterland 	IMSG_SETUIDF = gettext("\\nsetuid %s in %s <%s> on %s <%s>\n");
320*5c51f124SMoriah Waterland 	IMSG_SETGIDF = gettext("\\nsetgid %s in %s <%s> on %s <%s>\n");
321*5c51f124SMoriah Waterland 	IMSG_OVERWR = gettext("\\nFiles that are setuid will be overwritten "
322*5c51f124SMoriah Waterland 	    "by installation of %s\n<%s> on %s <%s>.\n");
323*5c51f124SMoriah Waterland 
324*5c51f124SMoriah Waterland 	/*
325*5c51f124SMoriah Waterland 	 * outer loop - process each package first
326*5c51f124SMoriah Waterland 	 */
327*5c51f124SMoriah Waterland 
328*5c51f124SMoriah Waterland 	for (i = 0; (pkginst = a_pkglist[i]) != NULL; i++) {
329*5c51f124SMoriah Waterland 
330*5c51f124SMoriah Waterland 		char	*zoneName;
331*5c51f124SMoriah Waterland 		int	zoneIndex;
332*5c51f124SMoriah Waterland 
333*5c51f124SMoriah Waterland 		/*
334*5c51f124SMoriah Waterland 		 * if this package is marked "install in this zone only", then
335*5c51f124SMoriah Waterland 		 * do not check dependencies in any zone
336*5c51f124SMoriah Waterland 		 */
337*5c51f124SMoriah Waterland 
338*5c51f124SMoriah Waterland 		if (pkgPackageIsThisZone(pkginst) == B_TRUE) {
339*5c51f124SMoriah Waterland 			echoDebug(DBG_PREIVFY_SKIP_THISZONE, pkginst);
340*5c51f124SMoriah Waterland 			continue;
341*5c51f124SMoriah Waterland 		}
342*5c51f124SMoriah Waterland 
343*5c51f124SMoriah Waterland 		/*
344*5c51f124SMoriah Waterland 		 * inner loop - for each package process each zone second
345*5c51f124SMoriah Waterland 		 */
346*5c51f124SMoriah Waterland 
347*5c51f124SMoriah Waterland 		for (zoneIndex = 0;
348*5c51f124SMoriah Waterland 			(zoneName = z_zlist_get_zonename(a_zlst, zoneIndex)) !=
349*5c51f124SMoriah Waterland 				(char *)NULL; zoneIndex++) {
350*5c51f124SMoriah Waterland 
351*5c51f124SMoriah Waterland 			FILE	*fp;
352*5c51f124SMoriah Waterland 			char	line[PATH_MAX+1];
353*5c51f124SMoriah Waterland 			char	preinstallcheckPath[PATH_MAX+1];
354*5c51f124SMoriah Waterland 			int	len;
355*5c51f124SMoriah Waterland 
356*5c51f124SMoriah Waterland 			/* skip the zone if it is NOT bootable */
357*5c51f124SMoriah Waterland 
358*5c51f124SMoriah Waterland 			if (z_zlist_is_zone_runnable(a_zlst,
359*5c51f124SMoriah Waterland 							zoneIndex) == B_FALSE) {
360*5c51f124SMoriah Waterland 				continue;
361*5c51f124SMoriah Waterland 			}
362*5c51f124SMoriah Waterland 
363*5c51f124SMoriah Waterland 			/* create path to this packages preinstall check data */
364*5c51f124SMoriah Waterland 
365*5c51f124SMoriah Waterland 			len = snprintf(preinstallcheckPath,
366*5c51f124SMoriah Waterland 				sizeof (preinstallcheckPath),
367*5c51f124SMoriah Waterland 				"%s/%s.%s.preinstallcheck.txt", a_zoneTempDir,
368*5c51f124SMoriah Waterland 				pkginst, zoneName);
369*5c51f124SMoriah Waterland 
370*5c51f124SMoriah Waterland 			if (len > sizeof (preinstallcheckPath)) {
371*5c51f124SMoriah Waterland 				progerr(ERR_CREATE_PATH_3, a_zoneTempDir,
372*5c51f124SMoriah Waterland 					pkginst, zoneName);
373*5c51f124SMoriah Waterland 				continue;
374*5c51f124SMoriah Waterland 			}
375*5c51f124SMoriah Waterland 
376*5c51f124SMoriah Waterland 			/* error if preinstall check data path is not a file */
377*5c51f124SMoriah Waterland 
378*5c51f124SMoriah Waterland 			if (isfile((char *)NULL, preinstallcheckPath) != 0) {
379*5c51f124SMoriah Waterland 				echoDebug(DBG_PREIVFY_NOFILE,
380*5c51f124SMoriah Waterland 					pkginst, zoneName, preinstallcheckPath,
381*5c51f124SMoriah Waterland 					strerror(errno));
382*5c51f124SMoriah Waterland 				progerr(ERR_PREIVFY_NOFILE,
383*5c51f124SMoriah Waterland 					pkginst, zoneName);
384*5c51f124SMoriah Waterland 				continue;
385*5c51f124SMoriah Waterland 			}
386*5c51f124SMoriah Waterland 
387*5c51f124SMoriah Waterland 			/* open the preinstall check data file */
388*5c51f124SMoriah Waterland 
389*5c51f124SMoriah Waterland 			fp = fopen(preinstallcheckPath, "r");
390*5c51f124SMoriah Waterland 			if (fp == (FILE *)NULL) {
391*5c51f124SMoriah Waterland 				progerr(ERR_PREIVFY_OPEN_FILE,
392*5c51f124SMoriah Waterland 					preinstallcheckPath, pkginst, zoneName,
393*5c51f124SMoriah Waterland 					strerror(errno));
394*5c51f124SMoriah Waterland 				continue;
395*5c51f124SMoriah Waterland 			}
396*5c51f124SMoriah Waterland 
397*5c51f124SMoriah Waterland 			/* read and process each preinstall check data line */
398*5c51f124SMoriah Waterland 
399*5c51f124SMoriah Waterland 			while (fgets(line, sizeof (line), fp) != (char *)NULL) {
400*5c51f124SMoriah Waterland 				int	j;
401*5c51f124SMoriah Waterland 				int	len;
402*5c51f124SMoriah Waterland 
403*5c51f124SMoriah Waterland 				/* remove all new-lines from end of line */
404*5c51f124SMoriah Waterland 
405*5c51f124SMoriah Waterland 				len = strlen(line);
406*5c51f124SMoriah Waterland 				while ((len > 0) && (line[len-1] == '\n')) {
407*5c51f124SMoriah Waterland 					line[--len] = '\0';
408*5c51f124SMoriah Waterland 				}
409*5c51f124SMoriah Waterland 
410*5c51f124SMoriah Waterland 				/* ignore comment lines */
411*5c51f124SMoriah Waterland 
412*5c51f124SMoriah Waterland 				if (line[0] == '#') {
413*5c51f124SMoriah Waterland 					continue;
414*5c51f124SMoriah Waterland 				}
415*5c51f124SMoriah Waterland 
416*5c51f124SMoriah Waterland 				/* ignore empty lines */
417*5c51f124SMoriah Waterland 
418*5c51f124SMoriah Waterland 				if (line[0] == '\0') {
419*5c51f124SMoriah Waterland 					continue;
420*5c51f124SMoriah Waterland 				}
421*5c51f124SMoriah Waterland 
422*5c51f124SMoriah Waterland 				/* scan dependency list for this item */
423*5c51f124SMoriah Waterland 
424*5c51f124SMoriah Waterland 				for (j = 0;
425*5c51f124SMoriah Waterland 					DEPCKL[j].name != (char *)NULL; j++) {
426*5c51f124SMoriah Waterland 					len = strlen(DEPCKL[j].name);
427*5c51f124SMoriah Waterland 
428*5c51f124SMoriah Waterland 					if (strncmp(line, DEPCKL[j].name,
429*5c51f124SMoriah Waterland 							len) == 0) {
430*5c51f124SMoriah Waterland 						break;
431*5c51f124SMoriah Waterland 					}
432*5c51f124SMoriah Waterland 				}
433*5c51f124SMoriah Waterland 
434*5c51f124SMoriah Waterland 				echoDebug(DBG_PREIVFY_SCAN, line, pkginst,
435*5c51f124SMoriah Waterland 						zoneName);
436*5c51f124SMoriah Waterland 
437*5c51f124SMoriah Waterland 				/* ignore line if not found */
438*5c51f124SMoriah Waterland 
439*5c51f124SMoriah Waterland 				if (DEPCKL[j].name == (char *)NULL) {
440*5c51f124SMoriah Waterland 					progerr(ERR_PREIVFY_UNKNOWN_LINE, line,
441*5c51f124SMoriah Waterland 							pkginst, zoneName);
442*5c51f124SMoriah Waterland 					continue;
443*5c51f124SMoriah Waterland 				}
444*5c51f124SMoriah Waterland 
445*5c51f124SMoriah Waterland 				if ((DEPCKL[j].ignore_values != (char *)NULL) &&
446*5c51f124SMoriah Waterland 					(*(DEPCKL[j].ignore_values) != '\0') &&
447*5c51f124SMoriah Waterland 					(strchr(DEPCKL[j].ignore_values,
448*5c51f124SMoriah Waterland 						line[len]) != (char *)NULL)) {
449*5c51f124SMoriah Waterland 						continue;
450*5c51f124SMoriah Waterland 				}
451*5c51f124SMoriah Waterland 
452*5c51f124SMoriah Waterland 				/* found match - record this dependency issue */
453*5c51f124SMoriah Waterland 
454*5c51f124SMoriah Waterland 				depchkRecordError(DEPCKL[j].record, pkginst,
455*5c51f124SMoriah Waterland 					zoneName, &line[len]);
456*5c51f124SMoriah Waterland 			}
457*5c51f124SMoriah Waterland 
458*5c51f124SMoriah Waterland 			/* close preinstall check data file */
459*5c51f124SMoriah Waterland 
460*5c51f124SMoriah Waterland 			(void) fclose(fp);
461*5c51f124SMoriah Waterland 		}
462*5c51f124SMoriah Waterland 	}
463*5c51f124SMoriah Waterland 
464*5c51f124SMoriah Waterland 	/*
465*5c51f124SMoriah Waterland 	 * all dependency issues have been recorded; report results
466*5c51f124SMoriah Waterland 	 */
467*5c51f124SMoriah Waterland 
468*5c51f124SMoriah Waterland 	i = depchkReportErrors(DEPCKL);
469*5c51f124SMoriah Waterland 
470*5c51f124SMoriah Waterland 	/* restore "npkgs" */
471*5c51f124SMoriah Waterland 
472*5c51f124SMoriah Waterland 	npkgs = savenpkgs;
473*5c51f124SMoriah Waterland 
474*5c51f124SMoriah Waterland 	/* return continue/dont dontinue results */
475*5c51f124SMoriah Waterland 
476*5c51f124SMoriah Waterland 	return (i);
477*5c51f124SMoriah Waterland }
478*5c51f124SMoriah Waterland 
479*5c51f124SMoriah Waterland /*
480*5c51f124SMoriah Waterland  * Name:	getyorn
481*5c51f124SMoriah Waterland  * Description:	Deliver dependency check reason; ask question; return response
482*5c51f124SMoriah Waterland  * Arguments:	a_msg - pointer to string representing the message to output
483*5c51f124SMoriah Waterland  *			such as 'The package <..> contains <...>'
484*5c51f124SMoriah Waterland  *		a_pkg - pointer to string representing the package for which
485*5c51f124SMoriah Waterland  *			the question is being asked
486*5c51f124SMoriah Waterland  *		a_nocheck - should the message be output?
487*5c51f124SMoriah Waterland  *			== 0 - do not output the message
488*5c51f124SMoriah Waterland  *			!= 0 - output the message
489*5c51f124SMoriah Waterland  *		a_quit - should the question NOT be asked?
490*5c51f124SMoriah Waterland  *			== 0 - ask the question
491*5c51f124SMoriah Waterland  *			!= 0 - do not ask the question - return "no"
492*5c51f124SMoriah Waterland  *		a_helpMsg - pointer to string representing help message to be
493*5c51f124SMoriah Waterland  *			made available if the question is asked
494*5c51f124SMoriah Waterland  *			== NULL - no help message is available
495*5c51f124SMoriah Waterland  *		a_adminMsg - pointer to string representing the dependency check
496*5c51f124SMoriah Waterland  *			failure 'reason' - such as "Privilege checking failed."
497*5c51f124SMoriah Waterland  *			== NULL - no failure reason is available
498*5c51f124SMoriah Waterland  * Returns:	int - results of question/response actions
499*5c51f124SMoriah Waterland  *			0 - success
500*5c51f124SMoriah Waterland  *			1 - end of file
501*5c51f124SMoriah Waterland  *			2 - undefined error
502*5c51f124SMoriah Waterland  *			3 - answer was not "y"/was "q"
503*5c51f124SMoriah Waterland  *			4 - quit action taken
504*5c51f124SMoriah Waterland  *			5 - interactive mode required
505*5c51f124SMoriah Waterland  */
506*5c51f124SMoriah Waterland 
507*5c51f124SMoriah Waterland static int
getyorn(char * a_msg,char * a_pkg,int a_nocheck,int a_quit,char * a_helpMsg,char * a_adminMsg)508*5c51f124SMoriah Waterland getyorn(char *a_msg, char *a_pkg, int a_nocheck, int a_quit,
509*5c51f124SMoriah Waterland 	char *a_helpMsg, char *a_adminMsg)
510*5c51f124SMoriah Waterland {
511*5c51f124SMoriah Waterland 	char	ans[MAX_INPUT];
512*5c51f124SMoriah Waterland 	char	ask_cont[MSG_MAX];
513*5c51f124SMoriah Waterland 	int	n;
514*5c51f124SMoriah Waterland 	int	saveCkquit;
515*5c51f124SMoriah Waterland 
516*5c51f124SMoriah Waterland 	/*
517*5c51f124SMoriah Waterland 	 * entry assertions
518*5c51f124SMoriah Waterland 	 */
519*5c51f124SMoriah Waterland 
520*5c51f124SMoriah Waterland 	assert(a_pkg != (char *)NULL);
521*5c51f124SMoriah Waterland 	assert(*a_pkg != '\0');
522*5c51f124SMoriah Waterland 
523*5c51f124SMoriah Waterland 	/*
524*5c51f124SMoriah Waterland 	 * entry debugging info
525*5c51f124SMoriah Waterland 	 */
526*5c51f124SMoriah Waterland 
527*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_GETYORN_ARGS, a_pkg, a_nocheck, a_quit, a_msg,
528*5c51f124SMoriah Waterland 			a_adminMsg ? a_adminMsg : "");
529*5c51f124SMoriah Waterland 
530*5c51f124SMoriah Waterland 	/* return success (0) if "nocheck" is non-zero */
531*5c51f124SMoriah Waterland 
532*5c51f124SMoriah Waterland 	if (a_nocheck != 0) {
533*5c51f124SMoriah Waterland 		echoDebug(DBG_PREIVFY_GETYORN_NOCHECK, a_pkg);
534*5c51f124SMoriah Waterland 		return (0);
535*5c51f124SMoriah Waterland 	}
536*5c51f124SMoriah Waterland 
537*5c51f124SMoriah Waterland 	/* output reason for this particular failure */
538*5c51f124SMoriah Waterland 
539*5c51f124SMoriah Waterland 	if ((a_msg != (char *)NULL) && (*a_msg != '\0')) {
540*5c51f124SMoriah Waterland 		ptext(stderr, "%s", a_msg);
541*5c51f124SMoriah Waterland 	}
542*5c51f124SMoriah Waterland 
543*5c51f124SMoriah Waterland 	/* return "4 (administration)" if "quit" is non-zero */
544*5c51f124SMoriah Waterland 
545*5c51f124SMoriah Waterland 	if (a_quit != 0) {
546*5c51f124SMoriah Waterland 		/* output failure "admin reason" if available */
547*5c51f124SMoriah Waterland 		if ((a_adminMsg != (char *)NULL) && (*a_adminMsg != '\0')) {
548*5c51f124SMoriah Waterland 			ptext(stderr, a_adminMsg);
549*5c51f124SMoriah Waterland 		}
550*5c51f124SMoriah Waterland 		echoDebug(DBG_PREIVFY_GETYORN_QUIT, a_pkg);
551*5c51f124SMoriah Waterland 		return (4);
552*5c51f124SMoriah Waterland 	}
553*5c51f124SMoriah Waterland 
554*5c51f124SMoriah Waterland 	/* return "5 (administration interaction required)" if -n */
555*5c51f124SMoriah Waterland 
556*5c51f124SMoriah Waterland 	if (echoGetFlag() == B_FALSE) {
557*5c51f124SMoriah Waterland 		ptext(stderr, MSG_PREIVFY_GETYORN_SUSP, a_pkg);
558*5c51f124SMoriah Waterland 		echoDebug(DBG_PREIVFY_GETYORN_QUIT_USER, a_pkg);
559*5c51f124SMoriah Waterland 		return (5);
560*5c51f124SMoriah Waterland 	}
561*5c51f124SMoriah Waterland 
562*5c51f124SMoriah Waterland 	/* prepare question to ask "continue with pkg <xxx>?" */
563*5c51f124SMoriah Waterland 
564*5c51f124SMoriah Waterland 	(void) snprintf(ask_cont, sizeof (ask_cont), gettext(ASK_CONT), a_pkg);
565*5c51f124SMoriah Waterland 
566*5c51f124SMoriah Waterland 	/* ask question */
567*5c51f124SMoriah Waterland 
568*5c51f124SMoriah Waterland 	saveCkquit = ckquit;
569*5c51f124SMoriah Waterland 	ckquit = 0;
570*5c51f124SMoriah Waterland 
571*5c51f124SMoriah Waterland 	n = ckyorn(ans, NULL, NULL, a_helpMsg, ask_cont);
572*5c51f124SMoriah Waterland 
573*5c51f124SMoriah Waterland 	ckquit = saveCkquit;
574*5c51f124SMoriah Waterland 
575*5c51f124SMoriah Waterland 	if (n != 0) {
576*5c51f124SMoriah Waterland 		ptext(stderr, MSG_PREIVFY_GETYORN_TERM, a_pkg);
577*5c51f124SMoriah Waterland 		echoDebug(DBG_PREIVFY_GETYORN_CKYORN, a_pkg, n);
578*5c51f124SMoriah Waterland 		return (n);
579*5c51f124SMoriah Waterland 	}
580*5c51f124SMoriah Waterland 
581*5c51f124SMoriah Waterland 	/* return "3 (interruption) if not "y" or "Y" */
582*5c51f124SMoriah Waterland 
583*5c51f124SMoriah Waterland 	if (strchr("yY", *ans) == NULL) {
584*5c51f124SMoriah Waterland 		ptext(stderr, MSG_PREIVFY_GETYORN_TERM_USER, a_pkg);
585*5c51f124SMoriah Waterland 		echoDebug(DBG_PREIVFY_GETYORN_NOT_Y, a_pkg, ans);
586*5c51f124SMoriah Waterland 		return (3);
587*5c51f124SMoriah Waterland 	}
588*5c51f124SMoriah Waterland 
589*5c51f124SMoriah Waterland 	/* return "0 - success" */
590*5c51f124SMoriah Waterland 
591*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_GETYORN_SUCCESS, a_pkg);
592*5c51f124SMoriah Waterland 
593*5c51f124SMoriah Waterland 	return (0);
594*5c51f124SMoriah Waterland }
595*5c51f124SMoriah Waterland 
596*5c51f124SMoriah Waterland /*
597*5c51f124SMoriah Waterland  * Trigger:	prerequisite-incomplete=<<package>>
598*5c51f124SMoriah Waterland  * Sequence:	- one or more: prerequisite-incomplete=<<package>>
599*5c51f124SMoriah Waterland  *		- one: ckdepend=<<n>>
600*5c51f124SMoriah Waterland  * Actions:	Output message if "idepend!=nocheck"
601*5c51f124SMoriah Waterland  *		Return 0
602*5c51f124SMoriah Waterland  *		Terminate when 'ckdepend' processed
603*5c51f124SMoriah Waterland  */
604*5c51f124SMoriah Waterland 
605*5c51f124SMoriah Waterland static int
ckprereqinc(char * a_msg,char * a_pkg)606*5c51f124SMoriah Waterland ckprereqinc(char *a_msg, char *a_pkg)
607*5c51f124SMoriah Waterland {
608*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKPRENCI, a_pkg, a_msg);
609*5c51f124SMoriah Waterland 
610*5c51f124SMoriah Waterland 	if (!(ADM(idepend, "nocheck"))) {
611*5c51f124SMoriah Waterland 		ptext(stderr, "%s", a_msg);
612*5c51f124SMoriah Waterland 	}
613*5c51f124SMoriah Waterland 
614*5c51f124SMoriah Waterland 	return (0);
615*5c51f124SMoriah Waterland }
616*5c51f124SMoriah Waterland 
617*5c51f124SMoriah Waterland /*
618*5c51f124SMoriah Waterland  * Trigger:	prerequisite-installed=<<package>>
619*5c51f124SMoriah Waterland  * Sequence:	- one or more: prerequisite-installed=<<package>>
620*5c51f124SMoriah Waterland  *		- one: ckdepend=<<n>>
621*5c51f124SMoriah Waterland  * Actions:	Output message if "idepend!=nocheck"
622*5c51f124SMoriah Waterland  *		Return 0
623*5c51f124SMoriah Waterland  *		Terminate when 'ckdepend' processed
624*5c51f124SMoriah Waterland  */
625*5c51f124SMoriah Waterland 
626*5c51f124SMoriah Waterland static int
ckprereqinst(char * a_msg,char * a_pkg)627*5c51f124SMoriah Waterland ckprereqinst(char *a_msg, char *a_pkg)
628*5c51f124SMoriah Waterland {
629*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKPREREQ, a_pkg, a_msg);
630*5c51f124SMoriah Waterland 
631*5c51f124SMoriah Waterland 	if (!(ADM(idepend, "nocheck"))) {
632*5c51f124SMoriah Waterland 		ptext(stderr, "%s", a_msg);
633*5c51f124SMoriah Waterland 	}
634*5c51f124SMoriah Waterland 
635*5c51f124SMoriah Waterland 	return (0);
636*5c51f124SMoriah Waterland }
637*5c51f124SMoriah Waterland 
638*5c51f124SMoriah Waterland /*
639*5c51f124SMoriah Waterland  * Trigger:	ckpartialinstall=<<n>>
640*5c51f124SMoriah Waterland  * Sequence:	- one: ckpartialinstall=<<n>>
641*5c51f124SMoriah Waterland  * Actions:	process according to settings
642*5c51f124SMoriah Waterland  * Return value:	int
643*5c51f124SMoriah Waterland  *			0 - success
644*5c51f124SMoriah Waterland  *			1 - end of file
645*5c51f124SMoriah Waterland  *			2 - undefined error
646*5c51f124SMoriah Waterland  *			3 - answer was not "y"/was "q"
647*5c51f124SMoriah Waterland  *			4 - quit action taken
648*5c51f124SMoriah Waterland  *			5 - interactive mode required
649*5c51f124SMoriah Waterland  */
650*5c51f124SMoriah Waterland 
651*5c51f124SMoriah Waterland static int
ckpartinst(char * a_msg,char * a_pkg)652*5c51f124SMoriah Waterland ckpartinst(char *a_msg, char *a_pkg)
653*5c51f124SMoriah Waterland {
654*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKPARTIALINSTALL, a_pkg, a_msg);
655*5c51f124SMoriah Waterland 
656*5c51f124SMoriah Waterland 	return (getyorn(a_msg, a_pkg, ADM(partial, "nocheck"),
657*5c51f124SMoriah Waterland 			ADM(partial, "quit"), HLP_PKGADDCHK_PARTIAL, NULL));
658*5c51f124SMoriah Waterland }
659*5c51f124SMoriah Waterland 
660*5c51f124SMoriah Waterland /*
661*5c51f124SMoriah Waterland  * Trigger:	ckpartialremove=<<n>>
662*5c51f124SMoriah Waterland  * Sequence:	- one: ckpartialremove=<<n>>
663*5c51f124SMoriah Waterland  * Actions:	process according to settings
664*5c51f124SMoriah Waterland  * Return value:	int
665*5c51f124SMoriah Waterland  *			0 - success
666*5c51f124SMoriah Waterland  *			1 - end of file
667*5c51f124SMoriah Waterland  *			2 - undefined error
668*5c51f124SMoriah Waterland  *			3 - answer was not "y"/was "q"
669*5c51f124SMoriah Waterland  *			4 - quit action taken
670*5c51f124SMoriah Waterland  *			5 - interactive mode required
671*5c51f124SMoriah Waterland  */
672*5c51f124SMoriah Waterland 
673*5c51f124SMoriah Waterland static int
ckpartrem(char * a_msg,char * a_pkg)674*5c51f124SMoriah Waterland ckpartrem(char *a_msg, char *a_pkg)
675*5c51f124SMoriah Waterland {
676*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKPARTIALREMOVE, a_pkg, a_msg);
677*5c51f124SMoriah Waterland 
678*5c51f124SMoriah Waterland 	return (getyorn(a_msg, a_pkg, ADM(partial, "nocheck"),
679*5c51f124SMoriah Waterland 		ADM(partial, "quit"), HLP_PKGADDCHK_PARTIAL, NULL));
680*5c51f124SMoriah Waterland }
681*5c51f124SMoriah Waterland 
682*5c51f124SMoriah Waterland /*
683*5c51f124SMoriah Waterland  * Return value:	int
684*5c51f124SMoriah Waterland  *			0 - success
685*5c51f124SMoriah Waterland  *			1 - end of file
686*5c51f124SMoriah Waterland  *			2 - undefined error
687*5c51f124SMoriah Waterland  *			3 - answer was not "y"/was "q"
688*5c51f124SMoriah Waterland  *			4 - quit action taken
689*5c51f124SMoriah Waterland  *			5 - interactive mode required
690*5c51f124SMoriah Waterland  *			99 - fatal error
691*5c51f124SMoriah Waterland  */
692*5c51f124SMoriah Waterland 
693*5c51f124SMoriah Waterland static int
ckrunlevel(char * a_msg,char * a_pkg)694*5c51f124SMoriah Waterland ckrunlevel(char *a_msg, char *a_pkg)
695*5c51f124SMoriah Waterland {
696*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKRUNLEVEL, a_pkg, a_msg);
697*5c51f124SMoriah Waterland 	return (0);
698*5c51f124SMoriah Waterland }
699*5c51f124SMoriah Waterland 
700*5c51f124SMoriah Waterland /*
701*5c51f124SMoriah Waterland  * Trigger:	conflict-contents=<<n>>
702*5c51f124SMoriah Waterland  * Sequence:	- one or more of:
703*5c51f124SMoriah Waterland  *		-- conflict-contents=<<path>>
704*5c51f124SMoriah Waterland  *		-- conflict-attributes=<<path>>
705*5c51f124SMoriah Waterland  *		- one: ckconflict=<<n>>
706*5c51f124SMoriah Waterland  * Actions:	output message
707*5c51f124SMoriah Waterland  * Return value:	int
708*5c51f124SMoriah Waterland  *			0 - success
709*5c51f124SMoriah Waterland  */
710*5c51f124SMoriah Waterland 
711*5c51f124SMoriah Waterland static int
ckcfcontent(char * a_msg,char * a_pkg)712*5c51f124SMoriah Waterland ckcfcontent(char *a_msg, char *a_pkg)
713*5c51f124SMoriah Waterland {
714*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKCFCONTENT, a_pkg, a_msg);
715*5c51f124SMoriah Waterland 
716*5c51f124SMoriah Waterland 	ptext(stderr, "%s", a_msg);
717*5c51f124SMoriah Waterland 
718*5c51f124SMoriah Waterland 	return (0);
719*5c51f124SMoriah Waterland }
720*5c51f124SMoriah Waterland 
721*5c51f124SMoriah Waterland /*
722*5c51f124SMoriah Waterland  * Trigger:	ckinstance=<<n>>
723*5c51f124SMoriah Waterland  * Sequence:	- one or more of:
724*5c51f124SMoriah Waterland  *		-- install-instance=true
725*5c51f124SMoriah Waterland  *		-- install-new-only=true\n
726*5c51f124SMoriah Waterland  *		-- install-same-instance=true\n
727*5c51f124SMoriah Waterland  *		-- install-ovewrite=true\n
728*5c51f124SMoriah Waterland  *		-- install-too-many-instances=true\n
729*5c51f124SMoriah Waterland  *		-- install-new-instance=true\n
730*5c51f124SMoriah Waterland  *		- one: ckpdepend=<<n>>
731*5c51f124SMoriah Waterland  * Actions:	process according to settings
732*5c51f124SMoriah Waterland  * Return value:	int
733*5c51f124SMoriah Waterland  *			0 - success
734*5c51f124SMoriah Waterland  *			1 - end of file
735*5c51f124SMoriah Waterland  *			2 - undefined error
736*5c51f124SMoriah Waterland  *			3 - answer was not "y"/was "q"
737*5c51f124SMoriah Waterland  *			4 - quit action taken
738*5c51f124SMoriah Waterland  *			5 - interactive mode required
739*5c51f124SMoriah Waterland  */
740*5c51f124SMoriah Waterland 
741*5c51f124SMoriah Waterland static int
ckinstance(char * a_msg,char * a_pkg)742*5c51f124SMoriah Waterland ckinstance(char *a_msg, char *a_pkg)
743*5c51f124SMoriah Waterland {
744*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKINSTANCE, a_pkg, a_msg);
745*5c51f124SMoriah Waterland 
746*5c51f124SMoriah Waterland 	return (getyorn(a_msg, a_pkg, ADM(instance, "nocheck"),
747*5c51f124SMoriah Waterland 		ADM(instance, "quit"), HLP_PKGADDCHK_DEPEND,
748*5c51f124SMoriah Waterland 		ERR_PKGADDCHK_DEPFAILED));
749*5c51f124SMoriah Waterland }
750*5c51f124SMoriah Waterland 
751*5c51f124SMoriah Waterland /*
752*5c51f124SMoriah Waterland  * Trigger:	ckdepend=<<n>>
753*5c51f124SMoriah Waterland  * Sequence:	- one or more of:
754*5c51f124SMoriah Waterland  *		-- incompat=<<package>>
755*5c51f124SMoriah Waterland  *		-- prerequisite-incomplete=<<package>>
756*5c51f124SMoriah Waterland  *		-- prerequisite-installed=<<package>>
757*5c51f124SMoriah Waterland  *		-- dependson=<<package>>
758*5c51f124SMoriah Waterland  *		-- dependsonme=<<package>>
759*5c51f124SMoriah Waterland  *		- one: ckpdepend=<<n>>
760*5c51f124SMoriah Waterland  * Actions:	process according to settings
761*5c51f124SMoriah Waterland  * Return value:	int
762*5c51f124SMoriah Waterland  *			0 - success
763*5c51f124SMoriah Waterland  *			1 - end of file
764*5c51f124SMoriah Waterland  *			2 - undefined error
765*5c51f124SMoriah Waterland  *			3 - answer was not "y"/was "q"
766*5c51f124SMoriah Waterland  *			4 - quit action taken
767*5c51f124SMoriah Waterland  *			5 - interactive mode required
768*5c51f124SMoriah Waterland  */
769*5c51f124SMoriah Waterland 
770*5c51f124SMoriah Waterland static int
ckdepend(char * a_msg,char * a_pkg)771*5c51f124SMoriah Waterland ckdepend(char *a_msg, char *a_pkg)
772*5c51f124SMoriah Waterland {
773*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKDEPEND, a_pkg, a_msg);
774*5c51f124SMoriah Waterland 
775*5c51f124SMoriah Waterland 	return (getyorn(a_msg, a_pkg, ADM(idepend, "nocheck"),
776*5c51f124SMoriah Waterland 		ADM(idepend, "quit"), HLP_PKGADDCHK_DEPEND,
777*5c51f124SMoriah Waterland 		ERR_PKGADDCHK_DEPFAILED));
778*5c51f124SMoriah Waterland }
779*5c51f124SMoriah Waterland 
780*5c51f124SMoriah Waterland /*
781*5c51f124SMoriah Waterland  * Trigger:	ckspace=<<n>>
782*5c51f124SMoriah Waterland  * Sequence:	- one: ckspace=<<n>>
783*5c51f124SMoriah Waterland  * Actions:	process according to settings
784*5c51f124SMoriah Waterland  * Return value:	int
785*5c51f124SMoriah Waterland  *			0 - success
786*5c51f124SMoriah Waterland  *			1 - end of file
787*5c51f124SMoriah Waterland  *			2 - undefined error
788*5c51f124SMoriah Waterland  *			3 - answer was not "y"/was "q"
789*5c51f124SMoriah Waterland  *			4 - quit action taken
790*5c51f124SMoriah Waterland  *			5 - interactive mode required
791*5c51f124SMoriah Waterland  */
792*5c51f124SMoriah Waterland 
793*5c51f124SMoriah Waterland static int
ckspace(char * a_msg,char * a_pkg)794*5c51f124SMoriah Waterland ckspace(char *a_msg, char *a_pkg)
795*5c51f124SMoriah Waterland {
796*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKSPACE, a_pkg, a_msg);
797*5c51f124SMoriah Waterland 
798*5c51f124SMoriah Waterland 	return (getyorn(a_msg, a_pkg, ADM(space, "nocheck"),
799*5c51f124SMoriah Waterland 		ADM(space, "quit"), HLP_PKGADDCHK_SPACE,
800*5c51f124SMoriah Waterland 		ERR_PKGADDCHK_SPCFAILED));
801*5c51f124SMoriah Waterland }
802*5c51f124SMoriah Waterland 
803*5c51f124SMoriah Waterland /*
804*5c51f124SMoriah Waterland  * Trigger:	ckpkgdirs=<<n>>
805*5c51f124SMoriah Waterland  * Sequence:	- one: ckpkgdirs=<<n>>
806*5c51f124SMoriah Waterland  * Actions:	output message
807*5c51f124SMoriah Waterland  *		Return 4
808*5c51f124SMoriah Waterland  */
809*5c51f124SMoriah Waterland 
810*5c51f124SMoriah Waterland static int
ckpkgdirs(char * a_msg,char * a_pkg)811*5c51f124SMoriah Waterland ckpkgdirs(char *a_msg, char *a_pkg)
812*5c51f124SMoriah Waterland {
813*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKPKGDIRS, a_pkg, a_msg);
814*5c51f124SMoriah Waterland 
815*5c51f124SMoriah Waterland 	ptext(stderr, "%s", a_msg);
816*5c51f124SMoriah Waterland 
817*5c51f124SMoriah Waterland 	return (4);
818*5c51f124SMoriah Waterland }
819*5c51f124SMoriah Waterland 
820*5c51f124SMoriah Waterland /*
821*5c51f124SMoriah Waterland  * Trigger:	ckdirs=<<path>>
822*5c51f124SMoriah Waterland  * Sequence:	- one: ckdirs=<<path>>
823*5c51f124SMoriah Waterland  * Actions:	output message
824*5c51f124SMoriah Waterland  *		Return 4
825*5c51f124SMoriah Waterland  */
826*5c51f124SMoriah Waterland 
827*5c51f124SMoriah Waterland static int
ckdirs(char * a_msg,char * a_pkg)828*5c51f124SMoriah Waterland ckdirs(char *a_msg, char *a_pkg)
829*5c51f124SMoriah Waterland {
830*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKDIRS, a_pkg, a_msg);
831*5c51f124SMoriah Waterland 
832*5c51f124SMoriah Waterland 	ptext(stderr, "%s", a_msg);
833*5c51f124SMoriah Waterland 
834*5c51f124SMoriah Waterland 	ptext(stderr, ERR_PKGADDCHK_MKPKGDIR);
835*5c51f124SMoriah Waterland 
836*5c51f124SMoriah Waterland 	return (4);
837*5c51f124SMoriah Waterland }
838*5c51f124SMoriah Waterland 
839*5c51f124SMoriah Waterland /*
840*5c51f124SMoriah Waterland  * Trigger:	ckpkgfilebad=<<path>>
841*5c51f124SMoriah Waterland  * Sequence:	- one or more:
842*5c51f124SMoriah Waterland  *		-- ckpkgfilebad=<<path>>
843*5c51f124SMoriah Waterland  *		- one ckpkgfiles=<n>
844*5c51f124SMoriah Waterland  * Actions:	output message
845*5c51f124SMoriah Waterland  *		Return 0
846*5c51f124SMoriah Waterland  */
847*5c51f124SMoriah Waterland 
848*5c51f124SMoriah Waterland static int
ckpkgfilebad(char * a_msg,char * a_pkg)849*5c51f124SMoriah Waterland ckpkgfilebad(char *a_msg, char *a_pkg)
850*5c51f124SMoriah Waterland {
851*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKPKGFILEBAD, a_pkg, a_msg);
852*5c51f124SMoriah Waterland 
853*5c51f124SMoriah Waterland 	ptext(stderr, "%s", a_msg);
854*5c51f124SMoriah Waterland 
855*5c51f124SMoriah Waterland 	return (0);
856*5c51f124SMoriah Waterland }
857*5c51f124SMoriah Waterland 
858*5c51f124SMoriah Waterland /*
859*5c51f124SMoriah Waterland  * Trigger:	ckconflict=<<n>>
860*5c51f124SMoriah Waterland  * Sequence:	- one or more:
861*5c51f124SMoriah Waterland  *		-- conflict-contents=<<path>>
862*5c51f124SMoriah Waterland  *		-- conflict-attributes=<<path>>
863*5c51f124SMoriah Waterland  *		- one: ckconflict=<<n>>
864*5c51f124SMoriah Waterland  * Actions:	process according to settings
865*5c51f124SMoriah Waterland  * Return value:	int
866*5c51f124SMoriah Waterland  *			0 - success
867*5c51f124SMoriah Waterland  *			1 - end of file
868*5c51f124SMoriah Waterland  *			2 - undefined error
869*5c51f124SMoriah Waterland  *			3 - answer was not "y"/was "q"
870*5c51f124SMoriah Waterland  *			4 - quit action taken
871*5c51f124SMoriah Waterland  *			5 - interactive mode required
872*5c51f124SMoriah Waterland  */
873*5c51f124SMoriah Waterland 
874*5c51f124SMoriah Waterland static int
ckconflict(char * a_msg,char * a_pkg)875*5c51f124SMoriah Waterland ckconflict(char *a_msg, char *a_pkg)
876*5c51f124SMoriah Waterland {
877*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKCONFLICT, a_pkg, a_msg);
878*5c51f124SMoriah Waterland 
879*5c51f124SMoriah Waterland 	return (getyorn(a_msg, a_pkg, ADM(conflict, "nocheck"),
880*5c51f124SMoriah Waterland 		ADM(conflict, "quit"), HLP_PKGADDCHK_CONFLICT,
881*5c51f124SMoriah Waterland 		ERR_PKGADDCHK_CNFFAILED));
882*5c51f124SMoriah Waterland }
883*5c51f124SMoriah Waterland 
884*5c51f124SMoriah Waterland /*
885*5c51f124SMoriah Waterland  * Trigger:	cksetuid=<<n>>
886*5c51f124SMoriah Waterland  * Sequence:	- one or more:
887*5c51f124SMoriah Waterland  *		-- setuid=<path>:<owner>
888*5c51f124SMoriah Waterland  *		-- setgid=<path>:<group>
889*5c51f124SMoriah Waterland  *		-- setuid-overwrite=true
890*5c51f124SMoriah Waterland  *		- one: cksetuid=<<n>>
891*5c51f124SMoriah Waterland  * Actions:	process according to settings
892*5c51f124SMoriah Waterland  * Return value:	int
893*5c51f124SMoriah Waterland  *			0 - success
894*5c51f124SMoriah Waterland  *			1 - end of file
895*5c51f124SMoriah Waterland  *			2 - undefined error
896*5c51f124SMoriah Waterland  *			3 - answer was not "y"/was "q"
897*5c51f124SMoriah Waterland  *			4 - quit action taken
898*5c51f124SMoriah Waterland  *			5 - interactive mode required
899*5c51f124SMoriah Waterland  */
900*5c51f124SMoriah Waterland 
901*5c51f124SMoriah Waterland static int
cksetuid(char * a_msg,char * a_pkg)902*5c51f124SMoriah Waterland cksetuid(char *a_msg, char *a_pkg)
903*5c51f124SMoriah Waterland {
904*5c51f124SMoriah Waterland 	char	ans[MAX_INPUT];
905*5c51f124SMoriah Waterland 	char	ask_cont[MSG_MAX];
906*5c51f124SMoriah Waterland 	int	n;
907*5c51f124SMoriah Waterland 	int	saveCkquit;
908*5c51f124SMoriah Waterland 
909*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKSETUID, a_pkg, a_msg);
910*5c51f124SMoriah Waterland 
911*5c51f124SMoriah Waterland 	n = getyorn(a_msg, a_pkg, ADM(setuid, "nocheck"),
912*5c51f124SMoriah Waterland 		ADM(setuid, "quit"), HLP_PKGADDCHK_SETUID, NULL);
913*5c51f124SMoriah Waterland 
914*5c51f124SMoriah Waterland 	/* if user did not answer "n" return answer given */
915*5c51f124SMoriah Waterland 
916*5c51f124SMoriah Waterland 	if (n != 3) {
917*5c51f124SMoriah Waterland 		return (n);
918*5c51f124SMoriah Waterland 	}
919*5c51f124SMoriah Waterland 
920*5c51f124SMoriah Waterland 	(void) snprintf(ask_cont, sizeof (ask_cont), gettext(ASK_CONT), a_pkg);
921*5c51f124SMoriah Waterland 
922*5c51f124SMoriah Waterland 	saveCkquit = ckquit;
923*5c51f124SMoriah Waterland 	ckquit = 0;
924*5c51f124SMoriah Waterland 
925*5c51f124SMoriah Waterland 	n = ckyorn(ans, NULL, NULL, gettext(HLP_PKGADDCHK_CONT), ask_cont);
926*5c51f124SMoriah Waterland 
927*5c51f124SMoriah Waterland 	ckquit = saveCkquit;
928*5c51f124SMoriah Waterland 
929*5c51f124SMoriah Waterland 	if (n != 0) {
930*5c51f124SMoriah Waterland 		ptext(stderr, MSG_PREIVFY_GETYORN_TERM, a_pkg);
931*5c51f124SMoriah Waterland 		echoDebug(DBG_PREIVFY_GETYORN_CKYORN, a_pkg, n);
932*5c51f124SMoriah Waterland 		return (n);
933*5c51f124SMoriah Waterland 	}
934*5c51f124SMoriah Waterland 
935*5c51f124SMoriah Waterland 	/* return "3 (interruption) if not "y" or "Y" */
936*5c51f124SMoriah Waterland 
937*5c51f124SMoriah Waterland 	if (strchr("yY", *ans) == NULL) {
938*5c51f124SMoriah Waterland 		ptext(stderr, MSG_PREIVFY_GETYORN_TERM_USER, a_pkg);
939*5c51f124SMoriah Waterland 		echoDebug(DBG_PREIVFY_GETYORN_NOT_Y, a_pkg, ans);
940*5c51f124SMoriah Waterland 		return (3);
941*5c51f124SMoriah Waterland 	}
942*5c51f124SMoriah Waterland 
943*5c51f124SMoriah Waterland 	/* return "0 - success" */
944*5c51f124SMoriah Waterland 
945*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_GETYORN_SUCCESS, a_pkg);
946*5c51f124SMoriah Waterland 
947*5c51f124SMoriah Waterland 	return (0);
948*5c51f124SMoriah Waterland }
949*5c51f124SMoriah Waterland 
950*5c51f124SMoriah Waterland /*
951*5c51f124SMoriah Waterland  * Trigger:	ckpriv=<<n>>
952*5c51f124SMoriah Waterland  * Sequence:	- one: ckpriv=<<n>>
953*5c51f124SMoriah Waterland  * Actions:	process according to settings
954*5c51f124SMoriah Waterland  * Return value:	int
955*5c51f124SMoriah Waterland  *			0 - success
956*5c51f124SMoriah Waterland  *			1 - end of file
957*5c51f124SMoriah Waterland  *			2 - undefined error
958*5c51f124SMoriah Waterland  *			3 - answer was not "y"/was "q"
959*5c51f124SMoriah Waterland  *			4 - quit action taken
960*5c51f124SMoriah Waterland  *			5 - interactive mode required
961*5c51f124SMoriah Waterland  */
962*5c51f124SMoriah Waterland 
963*5c51f124SMoriah Waterland static int
ckpriv(char * a_msg,char * a_pkg)964*5c51f124SMoriah Waterland ckpriv(char *a_msg, char *a_pkg)
965*5c51f124SMoriah Waterland {
966*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKPRIV, a_pkg, a_msg);
967*5c51f124SMoriah Waterland 
968*5c51f124SMoriah Waterland 	return (getyorn(a_msg, a_pkg, ADM(action, "nocheck"),
969*5c51f124SMoriah Waterland 		ADM(action, "quit"), HLP_PKGADDCHK_PRIV,
970*5c51f124SMoriah Waterland 		ERR_PKGADDCHK_PRIVFAILED));
971*5c51f124SMoriah Waterland }
972*5c51f124SMoriah Waterland 
973*5c51f124SMoriah Waterland /*
974*5c51f124SMoriah Waterland  * Trigger:	ckpkgfiles=<<n>>
975*5c51f124SMoriah Waterland  * Sequence:	- one or more:
976*5c51f124SMoriah Waterland  *		-- ckpkgfilebad=<path>
977*5c51f124SMoriah Waterland  *		- one: ckpkgfiles=<<n>>
978*5c51f124SMoriah Waterland  * Return value:	int
979*5c51f124SMoriah Waterland  *			0 - success
980*5c51f124SMoriah Waterland  *			4 - failure
981*5c51f124SMoriah Waterland  */
982*5c51f124SMoriah Waterland 
983*5c51f124SMoriah Waterland static int
ckpkgfiles(char * a_msg,char * a_pkg)984*5c51f124SMoriah Waterland ckpkgfiles(char *a_msg, char *a_pkg)
985*5c51f124SMoriah Waterland {
986*5c51f124SMoriah Waterland 	echoDebug(DBG_PREIVFY_CKPKGFILES, a_pkg, a_msg);
987*5c51f124SMoriah Waterland 
988*5c51f124SMoriah Waterland 	ptext(stderr, "%s", a_msg);
989*5c51f124SMoriah Waterland 
990*5c51f124SMoriah Waterland 	return (4);
991*5c51f124SMoriah Waterland }
992*5c51f124SMoriah Waterland 
993*5c51f124SMoriah Waterland static int
attrib(char * a_msg,char * a_pkg)994*5c51f124SMoriah Waterland attrib(char *a_msg, char *a_pkg)
995*5c51f124SMoriah Waterland {
996*5c51f124SMoriah Waterland 	return (getyorn(a_msg, a_pkg, ADM(instance, "nocheck"),
997*5c51f124SMoriah Waterland 		ADM(instance, "quit"), HLP_PKGADDCHK_CONT,
998*5c51f124SMoriah Waterland 		ERR_PKGADDCHK_DEPFAILED));
999*5c51f124SMoriah Waterland }
1000*5c51f124SMoriah Waterland 
1001*5c51f124SMoriah Waterland /* ARGSUSED1 */
1002*5c51f124SMoriah Waterland static int
setuidf(char * a_msg,char * a_pkg)1003*5c51f124SMoriah Waterland setuidf(char *a_msg, char *a_pkg)
1004*5c51f124SMoriah Waterland {
1005*5c51f124SMoriah Waterland 	char *cp;
1006*5c51f124SMoriah Waterland 
1007*5c51f124SMoriah Waterland 	if ((cp = strchr(a_msg, ':')) != NULL)
1008*5c51f124SMoriah Waterland 		*cp = ' ';
1009*5c51f124SMoriah Waterland 	return (0);
1010*5c51f124SMoriah Waterland }
1011*5c51f124SMoriah Waterland 
1012*5c51f124SMoriah Waterland /* ARGSUSED1 */
1013*5c51f124SMoriah Waterland static int
setgidf(char * a_msg,char * a_pkg)1014*5c51f124SMoriah Waterland setgidf(char *a_msg, char *a_pkg)
1015*5c51f124SMoriah Waterland {
1016*5c51f124SMoriah Waterland 	char *cp;
1017*5c51f124SMoriah Waterland 
1018*5c51f124SMoriah Waterland 	if ((cp = strchr(a_msg, ':')) != NULL)
1019*5c51f124SMoriah Waterland 		*cp = ' ';
1020*5c51f124SMoriah Waterland 	return (0);
1021*5c51f124SMoriah Waterland }
1022*5c51f124SMoriah Waterland 
1023*5c51f124SMoriah Waterland static int
overwr(char * a_msg,char * a_pkg)1024*5c51f124SMoriah Waterland overwr(char *a_msg, char *a_pkg)
1025*5c51f124SMoriah Waterland {
1026*5c51f124SMoriah Waterland 	return (getyorn(a_msg, a_pkg, ADM(instance, "nocheck"),
1027*5c51f124SMoriah Waterland 		ADM(instance, "quit"), HLP_PKGADDCHK_SETUID,
1028*5c51f124SMoriah Waterland 		ERR_PKGADDCHK_DEPFAILED));
1029*5c51f124SMoriah Waterland }
1030