4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
35 #include <sys/types.h>
42 #include <instzones_api.h>
50 extern int npkgs
; /* the number of packages yet to be installed */
53 * ckquit is a global that controls 'ckyorn' (defined in libadm)
54 * If ckquit is non-zero, then "quit" is allowed as an answer when
55 * ckyorn is called. If is it zero, then "quit" is not an allowed answer.
59 extern struct admin adm
;
62 * each one of these represents a single kind of dependency check
65 static depckError_t er_ckconflict
= {0, (depckErrorRecord_t
*)NULL
};
66 static depckError_t er_ckdepend
= {0, (depckErrorRecord_t
*)NULL
};
67 static depckError_t er_ckcfcontent
= {0, (depckErrorRecord_t
*)NULL
};
68 static depckError_t er_ckinstance
= {0, (depckErrorRecord_t
*)NULL
};
69 static depckError_t er_ckdirs
= {0, (depckErrorRecord_t
*)NULL
};
70 static depckError_t er_ckpartinst
= {0, (depckErrorRecord_t
*)NULL
};
71 static depckError_t er_ckpartrem
= {0, (depckErrorRecord_t
*)NULL
};
72 static depckError_t er_ckpkgdirs
= {0, (depckErrorRecord_t
*)NULL
};
73 static depckError_t er_ckpkgfilebad
= {0, (depckErrorRecord_t
*)NULL
};
74 static depckError_t er_ckpkgfiles
= {0, (depckErrorRecord_t
*)NULL
};
75 static depckError_t er_ckpriv
= {0, (depckErrorRecord_t
*)NULL
};
76 static depckError_t er_ckrunlevel
= {0, (depckErrorRecord_t
*)NULL
};
77 static depckError_t er_cksetuid
= {0, (depckErrorRecord_t
*)NULL
};
78 static depckError_t er_ckspace
= {0, (depckErrorRecord_t
*)NULL
};
79 static depckError_t er_newonly
= {0, (depckErrorRecord_t
*)NULL
};
80 static depckError_t er_prereqinc
= {0, (depckErrorRecord_t
*)NULL
};
81 static depckError_t er_prereqinst
= {0, (depckErrorRecord_t
*)NULL
};
82 static depckError_t er_runlevel
= {0, (depckErrorRecord_t
*)NULL
};
83 static depckError_t er_same
= {0, (depckErrorRecord_t
*)NULL
};
84 static depckError_t er_overwrite
= {0, (depckErrorRecord_t
*)NULL
};
85 static depckError_t er_uniq1
= {0, (depckErrorRecord_t
*)NULL
};
86 static depckError_t er_attrib
= {0, NULL
};
87 static depckError_t er_setuidf
= {0, NULL
};
88 static depckError_t er_setgidf
= {0, NULL
};
89 static depckError_t er_overwr
= {0, NULL
};
92 * each one of these represents a localized message for a single kind
96 static char *IMSG_ABADFILE
= (char *)NULL
;
97 static char *IMSG_BADFILE
= (char *)NULL
;
98 static char *IMSG_CKRUNLVL
= (char *)NULL
;
99 static char *IMSG_CNFFAILED
= (char *)NULL
;
100 static char *IMSG_DEPEND
= (char *)NULL
;
101 static char *IMSG_CFCONTENT
= (char *)NULL
;
102 static char *IMSG_INSTANCE
= "INSTANCE %s <%s> on %s <%s>";
103 static char *IMSG_DIRS
= (char *)NULL
;
104 static char *IMSG_NEWONLY
= (char *)NULL
;
105 static char *IMSG_PARTINST
= (char *)NULL
;
106 static char *IMSG_PARTREM
= (char *)NULL
;
107 static char *IMSG_PKGDIRS
= (char *)NULL
;
108 static char *IMSG_PRENCI
= (char *)NULL
;
109 static char *IMSG_PREREQ
= (char *)NULL
;
110 static char *IMSG_PRIV
= (char *)NULL
;
111 static char *IMSG_RUNLEVEL
= (char *)NULL
;
112 static char *IMSG_SAME
= (char *)NULL
;
113 static char *IMSG_OVERWRITE
= (char *)NULL
;
114 static char *IMSG_UNIQ1
= (char *)NULL
;
115 static char *IMSG_SETUID
= (char *)NULL
;
116 static char *IMSG_SPCFAILED
= (char *)NULL
;
117 static char *IMSG_ATTRIB
;
118 static char *IMSG_SETUIDF
;
119 static char *IMSG_SETGIDF
;
120 static char *IMSG_OVERWR
;
123 * each one of these represents a function to handle a single kind of
127 static int ckconflict(char *a_msg
, char *a_pkg
);
128 static int ckdepend(char *a_msg
, char *a_pkg
);
129 static int ckcfcontent(char *a_msg
, char *a_pkg
);
130 static int ckinstance(char *a_msg
, char *a_pkg
);
131 static int ckdirs(char *a_msg
, char *a_pkg
);
132 static int ckpartinst(char *a_msg
, char *a_pkg
);
133 static int ckpartrem(char *a_msg
, char *a_pkg
);
134 static int ckpkgfilebad(char *a_msg
, char *a_pkg
);
135 static int ckpkgdirs(char *a_msg
, char *a_pkg
);
136 static int ckpkgfiles(char *a_msg
, char *a_pkg
);
137 static int ckprereqinc(char *a_msg
, char *a_pkg
);
138 static int ckprereqinst(char *a_msg
, char *a_pkg
);
139 static int ckpriv(char *a_msg
, char *a_pkg
);
140 static int ckrunlevel(char *a_msg
, char *a_pkg
);
141 static int cksetuid(char *a_msg
, char *a_pkg
);
142 static int ckspace(char *a_msg
, char *a_pkg
);
143 static int attrib(char *a_msg
, char *a_pkg
);
144 static int setuidf(char *a_msg
, char *a_pkg
);
145 static int setgidf(char *a_msg
, char *a_pkg
);
146 static int overwr(char *a_msg
, char *a_pkg
);
148 static depckl_t DEPCKL
[] = {
150 * name, ignore_values, err_msg, depcklFunc, recrd
152 * ignore_values == NULL:
153 * package and zone information is collected in the "record" object for
154 * each occurance - then a message is constructed for each zone that
155 * reported the condition - the message includes that portion of the
156 * check past the "=" - then the specified "depcklFunc" is called to
157 * process each message.
161 * value, "package", package-name, "zone/zones", zone-name
163 * ignore-values == "???":
164 * these checks are ignored if they return one of the listed values
165 * if they do NOT return one of the listed values, then the package
166 * and zone information is collected in the "record" object for each
167 * occurance - then a single unified message is constructed for all
168 * zones that report the same condition; then the specified "depcklFunc"
169 * is called to process the resulting combined message.
173 * "package", package-name, "zone/zones", zone-name(s)
176 * same as above BUT no check to ignore is done; message always reported
179 { "install-same-instance=true", "", &IMSG_SAME
,
182 { "ckpkgfilebad=", NULL
, &IMSG_ABADFILE
,
183 &ckpkgfilebad
, &er_ckpkgfilebad
185 { "ckdirs=", NULL
, &IMSG_DIRS
,
188 { "prerequisite-incomplete=", NULL
, &IMSG_PRENCI
,
189 &ckprereqinc
, &er_prereqinc
191 { "prerequisite-installed=", NULL
, &IMSG_PREREQ
,
192 &ckprereqinst
, &er_prereqinst
194 { "runlevel=", NULL
, &IMSG_RUNLEVEL
,
197 { "conflict-contents=", NULL
, &IMSG_CFCONTENT
,
198 &ckcfcontent
, &er_ckcfcontent
200 { "ckconflict=", "0", &IMSG_CNFFAILED
,
201 &ckconflict
, &er_ckconflict
203 { "ckdepend=", "0", &IMSG_DEPEND
,
204 &ckdepend
, &er_ckdepend
206 { "ckpartialinstall=", "0", &IMSG_PARTINST
,
207 &ckpartinst
, &er_ckpartinst
209 { "ckpartialremove=", "0", &IMSG_PARTREM
,
210 &ckpartrem
, &er_ckpartrem
212 { "ckpkgdirs=", "0", &IMSG_PKGDIRS
,
213 &ckpkgdirs
, &er_ckpkgdirs
215 { "ckpkgfiles=", "0", &IMSG_BADFILE
,
216 &ckpkgfiles
, &er_ckpkgfiles
218 { "ckpriv=", "0", &IMSG_PRIV
,
221 { "ckrunlevel=", "0", &IMSG_CKRUNLVL
,
222 &ckrunlevel
, &er_ckrunlevel
224 { "cksetuid=", "0", &IMSG_SETUID
,
225 &cksetuid
, &er_cksetuid
227 { "ckspace=", "0", &IMSG_SPCFAILED
,
228 &ckspace
, &er_ckspace
230 { "install-new-only=true", "", &IMSG_NEWONLY
,
233 { "install-ovewrite=true", "", &IMSG_OVERWRITE
,
236 { "install-too-many-instances=true", "", &IMSG_UNIQ1
,
239 { "ckinstance=", "0", &IMSG_INSTANCE
,
240 &ckinstance
, &er_ckinstance
242 { "conflict-attributes=", NULL
, &IMSG_ATTRIB
,
245 { "setuid=", NULL
, &IMSG_SETUIDF
,
246 &setuidf
, &er_setuidf
248 { "setgid=", NULL
, &IMSG_SETGIDF
,
249 &setgidf
, &er_setgidf
251 { "setuid-overwrite=true", "", &IMSG_OVERWR
,
260 * Name: preinstall_verify
261 * Description: verify results of preinstallation dependency checking
262 * Arguments: a_pkglist - pointer to array of strings representing the names
263 * of all the packages that have been checked
264 * a_zlst - list of zones that dependencies were checked on
265 * a_zoneTempDir - pointer to string representing the path where
266 * the files containing the preinstallation dependency
267 * check data are located
269 * == 0 - continue processing
270 * != 0 - do not continue processing
274 preinstall_verify(char **a_pkglist
, zoneList_t a_zlst
, char *a_zoneTempDir
)
278 int savenpkgs
= npkgs
;
284 assert(a_pkglist
!= (char **)NULL
);
285 assert(a_zlst
!= (zoneList_t
)NULL
);
286 assert(a_zoneTempDir
!= (char *)NULL
);
289 * entry debugging info
292 echoDebug(DBG_PREIVFY_ENTRY
);
298 IMSG_ABADFILE
= MSG_PKGADDCHK_ABADFILE
;
299 IMSG_BADFILE
= MSG_PKGADDCHK_BADFILE
;
300 IMSG_CFCONTENT
= MSG_PKGADDCHK_CFCONTENT
;
301 IMSG_CKRUNLVL
= MSG_PKGADDCHK_CKRUNLVL
;
302 IMSG_CNFFAILED
= MSG_PKGADDCHK_CNFFAILED
;
303 IMSG_DEPEND
= MSG_PKGADDCHK_DEPEND
;
304 IMSG_DIRS
= MSG_PKGADDCHK_DIRS
;
305 IMSG_NEWONLY
= MSG_PKGADDCHK_NEWONLY
;
306 IMSG_OVERWRITE
= MSG_PKGADDCHK_OVERWRITE
;
307 IMSG_PARTINST
= MSG_PKGADDCHK_PARTINST
;
308 IMSG_PARTREM
= MSG_PKGADDCHK_PARTREM
;
309 IMSG_PKGDIRS
= MSG_PKGADDCHK_PKGDIRS
;
310 IMSG_PRENCI
= MSG_PKGADDCHK_PRENCI
;
311 IMSG_PREREQ
= MSG_PKGADDCHK_PREREQ
;
312 IMSG_PRIV
= MSG_PKGADDCHK_PRIV
;
313 IMSG_RUNLEVEL
= MSG_PKGADDCHK_RUNLEVEL
;
314 IMSG_SAME
= MSG_PKGADDCHK_SAME
;
315 IMSG_SETUID
= MSG_PKGADDCHK_SETUID
;
316 IMSG_SPCFAILED
= MSG_PKGADDCHK_SPCFAILED
;
317 IMSG_UNIQ1
= MSG_PKGADDCHK_UNIQ1
;
318 IMSG_ATTRIB
= gettext("\\nattribute change for %s <%s> on %s <%s>\n");
319 IMSG_SETUIDF
= gettext("\\nsetuid %s in %s <%s> on %s <%s>\n");
320 IMSG_SETGIDF
= gettext("\\nsetgid %s in %s <%s> on %s <%s>\n");
321 IMSG_OVERWR
= gettext("\\nFiles that are setuid will be overwritten "
322 "by installation of %s\n<%s> on %s <%s>.\n");
325 * outer loop - process each package first
328 for (i
= 0; (pkginst
= a_pkglist
[i
]) != NULL
; i
++) {
334 * if this package is marked "install in this zone only", then
335 * do not check dependencies in any zone
338 if (pkgPackageIsThisZone(pkginst
) == B_TRUE
) {
339 echoDebug(DBG_PREIVFY_SKIP_THISZONE
, pkginst
);
344 * inner loop - for each package process each zone second
348 (zoneName
= z_zlist_get_zonename(a_zlst
, zoneIndex
)) !=
349 (char *)NULL
; zoneIndex
++) {
352 char line
[PATH_MAX
+1];
353 char preinstallcheckPath
[PATH_MAX
+1];
356 /* skip the zone if it is NOT bootable */
358 if (z_zlist_is_zone_runnable(a_zlst
,
359 zoneIndex
) == B_FALSE
) {
363 /* create path to this packages preinstall check data */
365 len
= snprintf(preinstallcheckPath
,
366 sizeof (preinstallcheckPath
),
367 "%s/%s.%s.preinstallcheck.txt", a_zoneTempDir
,
370 if (len
> sizeof (preinstallcheckPath
)) {
371 progerr(ERR_CREATE_PATH_3
, a_zoneTempDir
,
376 /* error if preinstall check data path is not a file */
378 if (isfile((char *)NULL
, preinstallcheckPath
) != 0) {
379 echoDebug(DBG_PREIVFY_NOFILE
,
380 pkginst
, zoneName
, preinstallcheckPath
,
382 progerr(ERR_PREIVFY_NOFILE
,
387 /* open the preinstall check data file */
389 fp
= fopen(preinstallcheckPath
, "r");
390 if (fp
== (FILE *)NULL
) {
391 progerr(ERR_PREIVFY_OPEN_FILE
,
392 preinstallcheckPath
, pkginst
, zoneName
,
397 /* read and process each preinstall check data line */
399 while (fgets(line
, sizeof (line
), fp
) != (char *)NULL
) {
403 /* remove all new-lines from end of line */
406 while ((len
> 0) && (line
[len
-1] == '\n')) {
410 /* ignore comment lines */
412 if (line
[0] == '#') {
416 /* ignore empty lines */
418 if (line
[0] == '\0') {
422 /* scan dependency list for this item */
425 DEPCKL
[j
].name
!= (char *)NULL
; j
++) {
426 len
= strlen(DEPCKL
[j
].name
);
428 if (strncmp(line
, DEPCKL
[j
].name
,
434 echoDebug(DBG_PREIVFY_SCAN
, line
, pkginst
,
437 /* ignore line if not found */
439 if (DEPCKL
[j
].name
== (char *)NULL
) {
440 progerr(ERR_PREIVFY_UNKNOWN_LINE
, line
,
445 if ((DEPCKL
[j
].ignore_values
!= (char *)NULL
) &&
446 (*(DEPCKL
[j
].ignore_values
) != '\0') &&
447 (strchr(DEPCKL
[j
].ignore_values
,
448 line
[len
]) != (char *)NULL
)) {
452 /* found match - record this dependency issue */
454 depchkRecordError(DEPCKL
[j
].record
, pkginst
,
455 zoneName
, &line
[len
]);
458 /* close preinstall check data file */
465 * all dependency issues have been recorded; report results
468 i
= depchkReportErrors(DEPCKL
);
470 /* restore "npkgs" */
474 /* return continue/dont dontinue results */
481 * Description: Deliver dependency check reason; ask question; return response
482 * Arguments: a_msg - pointer to string representing the message to output
483 * such as 'The package <..> contains <...>'
484 * a_pkg - pointer to string representing the package for which
485 * the question is being asked
486 * a_nocheck - should the message be output?
487 * == 0 - do not output the message
488 * != 0 - output the message
489 * a_quit - should the question NOT be asked?
490 * == 0 - ask the question
491 * != 0 - do not ask the question - return "no"
492 * a_helpMsg - pointer to string representing help message to be
493 * made available if the question is asked
494 * == NULL - no help message is available
495 * a_adminMsg - pointer to string representing the dependency check
496 * failure 'reason' - such as "Privilege checking failed."
497 * == NULL - no failure reason is available
498 * Returns: int - results of question/response actions
501 * 2 - undefined error
502 * 3 - answer was not "y"/was "q"
503 * 4 - quit action taken
504 * 5 - interactive mode required
508 getyorn(char *a_msg
, char *a_pkg
, int a_nocheck
, int a_quit
,
509 char *a_helpMsg
, char *a_adminMsg
)
512 char ask_cont
[MSG_MAX
];
520 assert(a_pkg
!= (char *)NULL
);
521 assert(*a_pkg
!= '\0');
524 * entry debugging info
527 echoDebug(DBG_PREIVFY_GETYORN_ARGS
, a_pkg
, a_nocheck
, a_quit
, a_msg
,
528 a_adminMsg
? a_adminMsg
: "");
530 /* return success (0) if "nocheck" is non-zero */
532 if (a_nocheck
!= 0) {
533 echoDebug(DBG_PREIVFY_GETYORN_NOCHECK
, a_pkg
);
537 /* output reason for this particular failure */
539 if ((a_msg
!= (char *)NULL
) && (*a_msg
!= '\0')) {
540 ptext(stderr
, "%s", a_msg
);
543 /* return "4 (administration)" if "quit" is non-zero */
546 /* output failure "admin reason" if available */
547 if ((a_adminMsg
!= (char *)NULL
) && (*a_adminMsg
!= '\0')) {
548 ptext(stderr
, a_adminMsg
);
550 echoDebug(DBG_PREIVFY_GETYORN_QUIT
, a_pkg
);
554 /* return "5 (administration interaction required)" if -n */
556 if (echoGetFlag() == B_FALSE
) {
557 ptext(stderr
, MSG_PREIVFY_GETYORN_SUSP
, a_pkg
);
558 echoDebug(DBG_PREIVFY_GETYORN_QUIT_USER
, a_pkg
);
562 /* prepare question to ask "continue with pkg <xxx>?" */
564 (void) snprintf(ask_cont
, sizeof (ask_cont
), gettext(ASK_CONT
), a_pkg
);
571 n
= ckyorn(ans
, NULL
, NULL
, a_helpMsg
, ask_cont
);
576 ptext(stderr
, MSG_PREIVFY_GETYORN_TERM
, a_pkg
);
577 echoDebug(DBG_PREIVFY_GETYORN_CKYORN
, a_pkg
, n
);
581 /* return "3 (interruption) if not "y" or "Y" */
583 if (strchr("yY", *ans
) == NULL
) {
584 ptext(stderr
, MSG_PREIVFY_GETYORN_TERM_USER
, a_pkg
);
585 echoDebug(DBG_PREIVFY_GETYORN_NOT_Y
, a_pkg
, ans
);
589 /* return "0 - success" */
591 echoDebug(DBG_PREIVFY_GETYORN_SUCCESS
, a_pkg
);
597 * Trigger: prerequisite-incomplete=<<package>>
598 * Sequence: - one or more: prerequisite-incomplete=<<package>>
599 * - one: ckdepend=<<n>>
600 * Actions: Output message if "idepend!=nocheck"
602 * Terminate when 'ckdepend' processed
606 ckprereqinc(char *a_msg
, char *a_pkg
)
608 echoDebug(DBG_PREIVFY_CKPRENCI
, a_pkg
, a_msg
);
610 if (!(ADM(idepend
, "nocheck"))) {
611 ptext(stderr
, "%s", a_msg
);
618 * Trigger: prerequisite-installed=<<package>>
619 * Sequence: - one or more: prerequisite-installed=<<package>>
620 * - one: ckdepend=<<n>>
621 * Actions: Output message if "idepend!=nocheck"
623 * Terminate when 'ckdepend' processed
627 ckprereqinst(char *a_msg
, char *a_pkg
)
629 echoDebug(DBG_PREIVFY_CKPREREQ
, a_pkg
, a_msg
);
631 if (!(ADM(idepend
, "nocheck"))) {
632 ptext(stderr
, "%s", a_msg
);
639 * Trigger: ckpartialinstall=<<n>>
640 * Sequence: - one: ckpartialinstall=<<n>>
641 * Actions: process according to settings
645 * 2 - undefined error
646 * 3 - answer was not "y"/was "q"
647 * 4 - quit action taken
648 * 5 - interactive mode required
652 ckpartinst(char *a_msg
, char *a_pkg
)
654 echoDebug(DBG_PREIVFY_CKPARTIALINSTALL
, a_pkg
, a_msg
);
656 return (getyorn(a_msg
, a_pkg
, ADM(partial
, "nocheck"),
657 ADM(partial
, "quit"), HLP_PKGADDCHK_PARTIAL
, NULL
));
661 * Trigger: ckpartialremove=<<n>>
662 * Sequence: - one: ckpartialremove=<<n>>
663 * Actions: process according to settings
667 * 2 - undefined error
668 * 3 - answer was not "y"/was "q"
669 * 4 - quit action taken
670 * 5 - interactive mode required
674 ckpartrem(char *a_msg
, char *a_pkg
)
676 echoDebug(DBG_PREIVFY_CKPARTIALREMOVE
, a_pkg
, a_msg
);
678 return (getyorn(a_msg
, a_pkg
, ADM(partial
, "nocheck"),
679 ADM(partial
, "quit"), HLP_PKGADDCHK_PARTIAL
, NULL
));
686 * 2 - undefined error
687 * 3 - answer was not "y"/was "q"
688 * 4 - quit action taken
689 * 5 - interactive mode required
694 ckrunlevel(char *a_msg
, char *a_pkg
)
696 echoDebug(DBG_PREIVFY_CKRUNLEVEL
, a_pkg
, a_msg
);
701 * Trigger: conflict-contents=<<n>>
702 * Sequence: - one or more of:
703 * -- conflict-contents=<<path>>
704 * -- conflict-attributes=<<path>>
705 * - one: ckconflict=<<n>>
706 * Actions: output message
712 ckcfcontent(char *a_msg
, char *a_pkg
)
714 echoDebug(DBG_PREIVFY_CKCFCONTENT
, a_pkg
, a_msg
);
716 ptext(stderr
, "%s", a_msg
);
722 * Trigger: ckinstance=<<n>>
723 * Sequence: - one or more of:
724 * -- install-instance=true
725 * -- install-new-only=true\n
726 * -- install-same-instance=true\n
727 * -- install-ovewrite=true\n
728 * -- install-too-many-instances=true\n
729 * -- install-new-instance=true\n
730 * - one: ckpdepend=<<n>>
731 * Actions: process according to settings
735 * 2 - undefined error
736 * 3 - answer was not "y"/was "q"
737 * 4 - quit action taken
738 * 5 - interactive mode required
742 ckinstance(char *a_msg
, char *a_pkg
)
744 echoDebug(DBG_PREIVFY_CKINSTANCE
, a_pkg
, a_msg
);
746 return (getyorn(a_msg
, a_pkg
, ADM(instance
, "nocheck"),
747 ADM(instance
, "quit"), HLP_PKGADDCHK_DEPEND
,
748 ERR_PKGADDCHK_DEPFAILED
));
752 * Trigger: ckdepend=<<n>>
753 * Sequence: - one or more of:
754 * -- incompat=<<package>>
755 * -- prerequisite-incomplete=<<package>>
756 * -- prerequisite-installed=<<package>>
757 * -- dependson=<<package>>
758 * -- dependsonme=<<package>>
759 * - one: ckpdepend=<<n>>
760 * Actions: process according to settings
764 * 2 - undefined error
765 * 3 - answer was not "y"/was "q"
766 * 4 - quit action taken
767 * 5 - interactive mode required
771 ckdepend(char *a_msg
, char *a_pkg
)
773 echoDebug(DBG_PREIVFY_CKDEPEND
, a_pkg
, a_msg
);
775 return (getyorn(a_msg
, a_pkg
, ADM(idepend
, "nocheck"),
776 ADM(idepend
, "quit"), HLP_PKGADDCHK_DEPEND
,
777 ERR_PKGADDCHK_DEPFAILED
));
781 * Trigger: ckspace=<<n>>
782 * Sequence: - one: ckspace=<<n>>
783 * Actions: process according to settings
787 * 2 - undefined error
788 * 3 - answer was not "y"/was "q"
789 * 4 - quit action taken
790 * 5 - interactive mode required
794 ckspace(char *a_msg
, char *a_pkg
)
796 echoDebug(DBG_PREIVFY_CKSPACE
, a_pkg
, a_msg
);
798 return (getyorn(a_msg
, a_pkg
, ADM(space
, "nocheck"),
799 ADM(space
, "quit"), HLP_PKGADDCHK_SPACE
,
800 ERR_PKGADDCHK_SPCFAILED
));
804 * Trigger: ckpkgdirs=<<n>>
805 * Sequence: - one: ckpkgdirs=<<n>>
806 * Actions: output message
811 ckpkgdirs(char *a_msg
, char *a_pkg
)
813 echoDebug(DBG_PREIVFY_CKPKGDIRS
, a_pkg
, a_msg
);
815 ptext(stderr
, "%s", a_msg
);
821 * Trigger: ckdirs=<<path>>
822 * Sequence: - one: ckdirs=<<path>>
823 * Actions: output message
828 ckdirs(char *a_msg
, char *a_pkg
)
830 echoDebug(DBG_PREIVFY_CKDIRS
, a_pkg
, a_msg
);
832 ptext(stderr
, "%s", a_msg
);
834 ptext(stderr
, ERR_PKGADDCHK_MKPKGDIR
);
840 * Trigger: ckpkgfilebad=<<path>>
841 * Sequence: - one or more:
842 * -- ckpkgfilebad=<<path>>
843 * - one ckpkgfiles=<n>
844 * Actions: output message
849 ckpkgfilebad(char *a_msg
, char *a_pkg
)
851 echoDebug(DBG_PREIVFY_CKPKGFILEBAD
, a_pkg
, a_msg
);
853 ptext(stderr
, "%s", a_msg
);
859 * Trigger: ckconflict=<<n>>
860 * Sequence: - one or more:
861 * -- conflict-contents=<<path>>
862 * -- conflict-attributes=<<path>>
863 * - one: ckconflict=<<n>>
864 * Actions: process according to settings
868 * 2 - undefined error
869 * 3 - answer was not "y"/was "q"
870 * 4 - quit action taken
871 * 5 - interactive mode required
875 ckconflict(char *a_msg
, char *a_pkg
)
877 echoDebug(DBG_PREIVFY_CKCONFLICT
, a_pkg
, a_msg
);
879 return (getyorn(a_msg
, a_pkg
, ADM(conflict
, "nocheck"),
880 ADM(conflict
, "quit"), HLP_PKGADDCHK_CONFLICT
,
881 ERR_PKGADDCHK_CNFFAILED
));
885 * Trigger: cksetuid=<<n>>
886 * Sequence: - one or more:
887 * -- setuid=<path>:<owner>
888 * -- setgid=<path>:<group>
889 * -- setuid-overwrite=true
890 * - one: cksetuid=<<n>>
891 * Actions: process according to settings
895 * 2 - undefined error
896 * 3 - answer was not "y"/was "q"
897 * 4 - quit action taken
898 * 5 - interactive mode required
902 cksetuid(char *a_msg
, char *a_pkg
)
905 char ask_cont
[MSG_MAX
];
909 echoDebug(DBG_PREIVFY_CKSETUID
, a_pkg
, a_msg
);
911 n
= getyorn(a_msg
, a_pkg
, ADM(setuid
, "nocheck"),
912 ADM(setuid
, "quit"), HLP_PKGADDCHK_SETUID
, NULL
);
914 /* if user did not answer "n" return answer given */
920 (void) snprintf(ask_cont
, sizeof (ask_cont
), gettext(ASK_CONT
), a_pkg
);
925 n
= ckyorn(ans
, NULL
, NULL
, gettext(HLP_PKGADDCHK_CONT
), ask_cont
);
930 ptext(stderr
, MSG_PREIVFY_GETYORN_TERM
, a_pkg
);
931 echoDebug(DBG_PREIVFY_GETYORN_CKYORN
, a_pkg
, n
);
935 /* return "3 (interruption) if not "y" or "Y" */
937 if (strchr("yY", *ans
) == NULL
) {
938 ptext(stderr
, MSG_PREIVFY_GETYORN_TERM_USER
, a_pkg
);
939 echoDebug(DBG_PREIVFY_GETYORN_NOT_Y
, a_pkg
, ans
);
943 /* return "0 - success" */
945 echoDebug(DBG_PREIVFY_GETYORN_SUCCESS
, a_pkg
);
951 * Trigger: ckpriv=<<n>>
952 * Sequence: - one: ckpriv=<<n>>
953 * Actions: process according to settings
957 * 2 - undefined error
958 * 3 - answer was not "y"/was "q"
959 * 4 - quit action taken
960 * 5 - interactive mode required
964 ckpriv(char *a_msg
, char *a_pkg
)
966 echoDebug(DBG_PREIVFY_CKPRIV
, a_pkg
, a_msg
);
968 return (getyorn(a_msg
, a_pkg
, ADM(action
, "nocheck"),
969 ADM(action
, "quit"), HLP_PKGADDCHK_PRIV
,
970 ERR_PKGADDCHK_PRIVFAILED
));
974 * Trigger: ckpkgfiles=<<n>>
975 * Sequence: - one or more:
976 * -- ckpkgfilebad=<path>
977 * - one: ckpkgfiles=<<n>>
984 ckpkgfiles(char *a_msg
, char *a_pkg
)
986 echoDebug(DBG_PREIVFY_CKPKGFILES
, a_pkg
, a_msg
);
988 ptext(stderr
, "%s", a_msg
);
994 attrib(char *a_msg
, char *a_pkg
)
996 return (getyorn(a_msg
, a_pkg
, ADM(instance
, "nocheck"),
997 ADM(instance
, "quit"), HLP_PKGADDCHK_CONT
,
998 ERR_PKGADDCHK_DEPFAILED
));
1003 setuidf(char *a_msg
, char *a_pkg
)
1007 if ((cp
= strchr(a_msg
, ':')) != NULL
)
1014 setgidf(char *a_msg
, char *a_pkg
)
1018 if ((cp
= strchr(a_msg
, ':')) != NULL
)
1024 overwr(char *a_msg
, char *a_pkg
)
1026 return (getyorn(a_msg
, a_pkg
, ADM(instance
, "nocheck"),
1027 ADM(instance
, "quit"), HLP_PKGADDCHK_SETUID
,
1028 ERR_PKGADDCHK_DEPFAILED
));