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