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 #ifndef __HDRS_LIBINST_H__ 28*5c51f124SMoriah Waterland #define __HDRS_LIBINST_H__ 29*5c51f124SMoriah Waterland 30*5c51f124SMoriah Waterland 31*5c51f124SMoriah Waterland #ifdef __cplusplus 32*5c51f124SMoriah Waterland extern "C" { 33*5c51f124SMoriah Waterland #endif 34*5c51f124SMoriah Waterland 35*5c51f124SMoriah Waterland #include <stdio.h> 36*5c51f124SMoriah Waterland #include <fcntl.h> 37*5c51f124SMoriah Waterland #include <sys/types.h> 38*5c51f124SMoriah Waterland #include <sys/stat.h> 39*5c51f124SMoriah Waterland #include <pkgstrct.h> 40*5c51f124SMoriah Waterland #include <pkginfo.h> 41*5c51f124SMoriah Waterland #include "pkglib.h" 42*5c51f124SMoriah Waterland #include <cfext.h> 43*5c51f124SMoriah Waterland #include "install.h" 44*5c51f124SMoriah Waterland 45*5c51f124SMoriah Waterland #define DEF_NONE_SCR "i.CompCpio" 46*5c51f124SMoriah Waterland 47*5c51f124SMoriah Waterland #define BL_ALL -1 /* refers to all allocated lists */ 48*5c51f124SMoriah Waterland 49*5c51f124SMoriah Waterland /* signal handler function definition */ 50*5c51f124SMoriah Waterland 51*5c51f124SMoriah Waterland typedef void (sighdlrFunc_t)(int); 52*5c51f124SMoriah Waterland 53*5c51f124SMoriah Waterland /* maximum parameter length */ 54*5c51f124SMoriah Waterland 55*5c51f124SMoriah Waterland #define MAX_PKG_PARAM_LENGTH (64+1) /* +1 for null termination */ 56*5c51f124SMoriah Waterland 57*5c51f124SMoriah Waterland /* flag for check_applicability */ 58*5c51f124SMoriah Waterland 59*5c51f124SMoriah Waterland typedef unsigned long CAF_T; 60*5c51f124SMoriah Waterland 61*5c51f124SMoriah Waterland /* flags for check_applicability */ 62*5c51f124SMoriah Waterland 63*5c51f124SMoriah Waterland #define CAF_IN_GLOBAL_ZONE 0x00000001 /* in global zone */ 64*5c51f124SMoriah Waterland #define CAF_SCOPE_GLOBAL 0x00000002 /* -G specified */ 65*5c51f124SMoriah Waterland #define CAF_SCOPE_NONGLOBAL 0x00000004 /* -Z specified */ 66*5c51f124SMoriah Waterland 67*5c51f124SMoriah Waterland /* path to the request file in the package directory */ 68*5c51f124SMoriah Waterland 69*5c51f124SMoriah Waterland #define REQUEST_FILE "install/request" 70*5c51f124SMoriah Waterland 71*5c51f124SMoriah Waterland /* path to the copyright file in the package directory */ 72*5c51f124SMoriah Waterland 73*5c51f124SMoriah Waterland #define COPYRIGHT_FILE "install/copyright" 74*5c51f124SMoriah Waterland 75*5c51f124SMoriah Waterland /* path to the depend file in the package directory */ 76*5c51f124SMoriah Waterland 77*5c51f124SMoriah Waterland #define DEPEND_FILE "install/depend" 78*5c51f124SMoriah Waterland 79*5c51f124SMoriah Waterland /* 80*5c51f124SMoriah Waterland * name of environment variable set to non-global zone name being installed: 81*5c51f124SMoriah Waterland * pkgadd/pkginstall expects this name and passes it on to any scripts that 82*5c51f124SMoriah Waterland * are run if it is set. 83*5c51f124SMoriah Waterland */ 84*5c51f124SMoriah Waterland 85*5c51f124SMoriah Waterland #define PKG_ZONENAME_VARIABLE "SUNW_PKG_INSTALL_ZONENAME" 86*5c51f124SMoriah Waterland 87*5c51f124SMoriah Waterland /* 88*5c51f124SMoriah Waterland * name of environment variable set to indicate this package should be installed 89*5c51f124SMoriah Waterland * in the current zone only - see PSARC/2004/789 - New Pkginfo(4) attributes 90*5c51f124SMoriah Waterland * for zones 91*5c51f124SMoriah Waterland */ 92*5c51f124SMoriah Waterland 93*5c51f124SMoriah Waterland #define PKG_THISZONE_VARIABLE "SUNW_PKG_THISZONE" 94*5c51f124SMoriah Waterland 95*5c51f124SMoriah Waterland /* 96*5c51f124SMoriah Waterland * name of environment variable set to indicate this package should be installed 97*5c51f124SMoriah Waterland * in all zones, and only from the global zone - see PSARC/2003/460 98*5c51f124SMoriah Waterland */ 99*5c51f124SMoriah Waterland 100*5c51f124SMoriah Waterland #define PKG_ALLZONES_VARIABLE "SUNW_PKG_ALLZONES" 101*5c51f124SMoriah Waterland 102*5c51f124SMoriah Waterland /* 103*5c51f124SMoriah Waterland * name of environment variable set to indicate this package should be installed 104*5c51f124SMoriah Waterland * hollow (db update only) when installed in nonglobal zone - see PSARC/2003/460 105*5c51f124SMoriah Waterland */ 106*5c51f124SMoriah Waterland 107*5c51f124SMoriah Waterland #define PKG_HOLLOW_VARIABLE "SUNW_PKG_HOLLOW" 108*5c51f124SMoriah Waterland 109*5c51f124SMoriah Waterland /* 110*5c51f124SMoriah Waterland * General purpose return codes used for functions which don't return a basic 111*5c51f124SMoriah Waterland * success or failure. For those functions wherein a yes/no result is 112*5c51f124SMoriah Waterland * possible, then 1 means OK and 0 means FAIL. 113*5c51f124SMoriah Waterland */ 114*5c51f124SMoriah Waterland #define RESULT_OK 0x0 115*5c51f124SMoriah Waterland #define RESULT_WRN 0x1 116*5c51f124SMoriah Waterland #define RESULT_ERR 0x2 117*5c51f124SMoriah Waterland 118*5c51f124SMoriah Waterland /* These are the file status indicators for the contents file */ 119*5c51f124SMoriah Waterland #define INST_RDY '+' /* entry is ready to installf -f */ 120*5c51f124SMoriah Waterland #define RM_RDY '-' /* entry is ready for removef -f */ 121*5c51f124SMoriah Waterland #define NOT_FND '!' /* entry (or part of entry) was not found */ 122*5c51f124SMoriah Waterland #define SERVED_FILE '%' /* using the file server's RO partition */ 123*5c51f124SMoriah Waterland #define STAT_NEXT '@' /* this is awaiting eptstat */ 124*5c51f124SMoriah Waterland #define DUP_ENTRY '#' /* there's a duplicate of this */ 125*5c51f124SMoriah Waterland #define CONFIRM_CONT '*' /* need to confirm contents */ 126*5c51f124SMoriah Waterland #define CONFIRM_ATTR '~' /* need to confirm attributes */ 127*5c51f124SMoriah Waterland #define ENTRY_OK '\0' /* entry is a confirmed file */ 128*5c51f124SMoriah Waterland 129*5c51f124SMoriah Waterland /* control bits for pkgdbmerg() */ 130*5c51f124SMoriah Waterland #define NO_COPY 0x0001 131*5c51f124SMoriah Waterland #define CLIENT_PATHS 0x0002 /* working with a client database */ 132*5c51f124SMoriah Waterland 133*5c51f124SMoriah Waterland /* control bits for file verification by class */ 134*5c51f124SMoriah Waterland #define DEFAULT 0x0 /* standard full verification */ 135*5c51f124SMoriah Waterland #define NOVERIFY 0x1 /* do not verify */ 136*5c51f124SMoriah Waterland #define QKVERIFY 0x2 /* do a quick verification instead */ 137*5c51f124SMoriah Waterland 138*5c51f124SMoriah Waterland /* control bit for path type to pass to CAS */ 139*5c51f124SMoriah Waterland #define DEFAULT 0x0 /* standard server-relative absolute path */ 140*5c51f124SMoriah Waterland #define REL_2_CAS 0x1 /* pass pkgmap-type relative path */ 141*5c51f124SMoriah Waterland 142*5c51f124SMoriah Waterland /* findscripts() argument */ 143*5c51f124SMoriah Waterland #define I_ONLY 0x0 /* find install class action scripts */ 144*5c51f124SMoriah Waterland #define R_ONLY 0x1 /* find removal class action scripts */ 145*5c51f124SMoriah Waterland 146*5c51f124SMoriah Waterland struct cl_attr { 147*5c51f124SMoriah Waterland char name[CLSSIZ+1]; /* name of class */ 148*5c51f124SMoriah Waterland char *inst_script; /* install class action script */ 149*5c51f124SMoriah Waterland char *rem_script; /* remove class action script */ 150*5c51f124SMoriah Waterland unsigned src_verify:3; /* source verification level */ 151*5c51f124SMoriah Waterland unsigned dst_verify:4; /* destination verification level */ 152*5c51f124SMoriah Waterland unsigned relpath_2_CAS:1; /* CAS gets relative paths */ 153*5c51f124SMoriah Waterland }; 154*5c51f124SMoriah Waterland 155*5c51f124SMoriah Waterland #if defined(__STDC__) 156*5c51f124SMoriah Waterland #define __P(protos) protos 157*5c51f124SMoriah Waterland #else /* __STDC__ */ 158*5c51f124SMoriah Waterland #define __P(protos) () 159*5c51f124SMoriah Waterland #endif /* __STDC__ */ 160*5c51f124SMoriah Waterland 161*5c51f124SMoriah Waterland /* Common quit declaration used across many package commands */ 162*5c51f124SMoriah Waterland extern void quit(int) __NORETURN; 163*5c51f124SMoriah Waterland 164*5c51f124SMoriah Waterland 165*5c51f124SMoriah Waterland /* listmgr.c */ 166*5c51f124SMoriah Waterland extern int bl_create __P((int count_per_block, int struct_size, 167*5c51f124SMoriah Waterland char *desc)); 168*5c51f124SMoriah Waterland extern char *bl_next_avail __P((int list_handle)); 169*5c51f124SMoriah Waterland extern char *bl_get_record __P((int list_handle, int recno)); 170*5c51f124SMoriah Waterland extern void bl_free __P((int list_handle)); 171*5c51f124SMoriah Waterland extern int ar_create __P((int count_per_block, int struct_size, 172*5c51f124SMoriah Waterland char *desc)); 173*5c51f124SMoriah Waterland extern char **ar_next_avail __P((int list_handle)); 174*5c51f124SMoriah Waterland extern char **ar_get_head __P((int list_handle)); 175*5c51f124SMoriah Waterland extern int ar_delete __P((int list_handle, int index)); 176*5c51f124SMoriah Waterland extern void ar_free __P((int list_handle)); 177*5c51f124SMoriah Waterland 178*5c51f124SMoriah Waterland /* doulimit.c */ 179*5c51f124SMoriah Waterland extern int set_ulimit __P((char *script, char *err_msg)); 180*5c51f124SMoriah Waterland extern int clr_ulimit __P((void)); 181*5c51f124SMoriah Waterland extern int assign_ulimit __P((char *fslimit)); 182*5c51f124SMoriah Waterland 183*5c51f124SMoriah Waterland /* dryrun.c */ 184*5c51f124SMoriah Waterland extern void set_continue_not_ok __P((void)); 185*5c51f124SMoriah Waterland extern int continue_is_ok __P((void)); 186*5c51f124SMoriah Waterland extern int in_dryrun_mode __P((void)); 187*5c51f124SMoriah Waterland extern int in_continue_mode __P((void)); 188*5c51f124SMoriah Waterland extern void init_dryrunfile __P((char *dr_dir)); 189*5c51f124SMoriah Waterland extern void init_contfile __P((char *cn_dir)); 190*5c51f124SMoriah Waterland extern void set_dr_exitmsg __P((char *value)); 191*5c51f124SMoriah Waterland extern void set_dr_info __P((int type, int value)); 192*5c51f124SMoriah Waterland extern void write_dryrun_file __P((struct cfextra **extlist)); 193*5c51f124SMoriah Waterland 194*5c51f124SMoriah Waterland /* instvol.c */ 195*5c51f124SMoriah Waterland extern void regfiles_free __P((void)); 196*5c51f124SMoriah Waterland 197*5c51f124SMoriah Waterland /* lockinst.c */ 198*5c51f124SMoriah Waterland extern int lockinst __P((char *util_name, char *pkg_name, char *place)); 199*5c51f124SMoriah Waterland extern void lockupd __P((char *place)); 200*5c51f124SMoriah Waterland extern void unlockinst __P((void)); 201*5c51f124SMoriah Waterland 202*5c51f124SMoriah Waterland extern char *pathdup __P((char *s)); 203*5c51f124SMoriah Waterland extern char *pathalloc __P((int n)); 204*5c51f124SMoriah Waterland extern char *fixpath __P((char *path)); 205*5c51f124SMoriah Waterland extern char *get_info_basedir __P((void)); 206*5c51f124SMoriah Waterland extern char *get_basedir __P((void)); 207*5c51f124SMoriah Waterland extern char *get_client_basedir __P((void)); 208*5c51f124SMoriah Waterland extern int set_basedirs __P((int reloc, char *adm_basedir, 209*5c51f124SMoriah Waterland char *pkginst, int nointeract)); 210*5c51f124SMoriah Waterland extern int eval_path __P((char **server_ptr, char **client_ptr, 211*5c51f124SMoriah Waterland char **map_ptr, char *path)); 212*5c51f124SMoriah Waterland extern int get_orig_offset __P((void)); 213*5c51f124SMoriah Waterland extern char *get_inst_root __P((void)); 214*5c51f124SMoriah Waterland extern char *get_mount_point __P((short n)); 215*5c51f124SMoriah Waterland extern char *get_remote_path __P((short n)); 216*5c51f124SMoriah Waterland extern void set_env_cbdir __P((void)); 217*5c51f124SMoriah Waterland extern int set_inst_root __P((char *path)); 218*5c51f124SMoriah Waterland extern void put_path_params __P((void)); 219*5c51f124SMoriah Waterland extern int mkpath __P((char *p)); 220*5c51f124SMoriah Waterland extern void mkbasedir __P((int flag, char *path)); 221*5c51f124SMoriah Waterland extern int is_an_inst_root __P((void)); 222*5c51f124SMoriah Waterland extern int is_a_basedir __P((void)); 223*5c51f124SMoriah Waterland extern int is_a_cl_basedir __P((void)); 224*5c51f124SMoriah Waterland extern int is_relocatable __P((void)); 225*5c51f124SMoriah Waterland extern char *orig_path __P((char *path)); 226*5c51f124SMoriah Waterland extern char *orig_path_ptr __P((char *path)); 227*5c51f124SMoriah Waterland extern char *qreason __P((int caller, int retcode, int started, 228*5c51f124SMoriah Waterland int includeZonename)); 229*5c51f124SMoriah Waterland extern char *qstrdup __P((char *s)); 230*5c51f124SMoriah Waterland extern char *srcpath __P((char *d, char *p, int part, int nparts)); 231*5c51f124SMoriah Waterland extern int copyf __P((char *from, char *to, time_t mytime)); 232*5c51f124SMoriah Waterland extern int copyFile __P((int, int, char *, char *, struct stat *, long)); 233*5c51f124SMoriah Waterland extern int openLocal __P((char *a_path, int a_oflag, char *a_tmpdir)); 234*5c51f124SMoriah Waterland extern int dockdeps __P((char *depfile, int removeFlag, 235*5c51f124SMoriah Waterland boolean_t a_preinstallCheck)); 236*5c51f124SMoriah Waterland extern int finalck __P((struct cfent *ept, int attrchg, int contchg, 237*5c51f124SMoriah Waterland boolean_t a_warning)); 238*5c51f124SMoriah Waterland 239*5c51f124SMoriah Waterland /* dockdeps.c */ 240*5c51f124SMoriah Waterland extern void setUpdate __P((void)); 241*5c51f124SMoriah Waterland extern int isUpdate __P((void)); 242*5c51f124SMoriah Waterland extern void setPatchUpdate __P((void)); 243*5c51f124SMoriah Waterland extern int isPatchUpdate __P((void)); 244*5c51f124SMoriah Waterland 245*5c51f124SMoriah Waterland /* mntinfo.c */ 246*5c51f124SMoriah Waterland extern int get_mntinfo __P((int map_client, char *vfstab_file)); 247*5c51f124SMoriah Waterland extern short fsys __P((char *path)); 248*5c51f124SMoriah Waterland extern struct fstable *get_fs_entry __P((short n)); 249*5c51f124SMoriah Waterland extern int mount_client __P((void)); 250*5c51f124SMoriah Waterland extern int unmount_client __P((void)); 251*5c51f124SMoriah Waterland extern short resolved_fsys __P((char *path)); 252*5c51f124SMoriah Waterland extern char *get_server_host __P((short n)); 253*5c51f124SMoriah Waterland extern char *server_map __P((char *path, short fsys_value)); 254*5c51f124SMoriah Waterland extern int use_srvr_map __P((char *path, short *fsys_value)); 255*5c51f124SMoriah Waterland extern int use_srvr_map_n __P((short n)); 256*5c51f124SMoriah Waterland extern int is_fs_writeable __P((char *path, short *fsys_value)); 257*5c51f124SMoriah Waterland extern int is_remote_fs __P((char *path, short *fsys_value)); 258*5c51f124SMoriah Waterland extern int is_served __P((char *path, short *fsys_value)); 259*5c51f124SMoriah Waterland extern int is_mounted __P((char *path, short *fsys_value)); 260*5c51f124SMoriah Waterland extern int is_fs_writeable_n __P((short n)); 261*5c51f124SMoriah Waterland extern int is_remote_fs_n __P((short n)); 262*5c51f124SMoriah Waterland extern int is_served_n __P((short n)); 263*5c51f124SMoriah Waterland extern int is_mounted_n __P((short n)); 264*5c51f124SMoriah Waterland extern fsblkcnt_t get_blk_size_n __P((short n)); 265*5c51f124SMoriah Waterland extern fsblkcnt_t get_frag_size_n __P((short n)); 266*5c51f124SMoriah Waterland extern fsblkcnt_t get_blk_used_n __P((short n)); 267*5c51f124SMoriah Waterland extern fsblkcnt_t get_blk_free_n __P((short n)); 268*5c51f124SMoriah Waterland extern fsblkcnt_t get_inode_used_n __P((short n)); 269*5c51f124SMoriah Waterland extern fsblkcnt_t get_inode_free_n __P((short n)); 270*5c51f124SMoriah Waterland extern void set_blk_used_n __P((short n, fsblkcnt_t value)); 271*5c51f124SMoriah Waterland extern char *get_source_name_n __P((short n)); 272*5c51f124SMoriah Waterland extern char *get_fs_name_n __P((short n)); 273*5c51f124SMoriah Waterland extern int load_fsentry __P((struct fstable *fs_entry, char *name, 274*5c51f124SMoriah Waterland char *fstype, char *remote_name)); 275*5c51f124SMoriah Waterland extern int isreloc __P((char *pkginstdir)); 276*5c51f124SMoriah Waterland extern int is_local_host __P((char *hostname)); 277*5c51f124SMoriah Waterland extern void fs_tab_free __P((void)); 278*5c51f124SMoriah Waterland 279*5c51f124SMoriah Waterland /* pkgdbmerg.c */ 280*5c51f124SMoriah Waterland extern int pkgdbmerg __P((VFP_T *mapvfp, VFP_T *tmpvfp, 281*5c51f124SMoriah Waterland struct cfextra **extlist, int notify)); 282*5c51f124SMoriah Waterland extern int files_installed __P((void)); 283*5c51f124SMoriah Waterland extern void notice __P((int n)); 284*5c51f124SMoriah Waterland 285*5c51f124SMoriah Waterland /* ocfile.c */ 286*5c51f124SMoriah Waterland extern int trunc_tcfile __P((int fd)); 287*5c51f124SMoriah Waterland extern int ocfile __P((VFP_T **mapvfp, VFP_T **tmpvfp, 288*5c51f124SMoriah Waterland fsblkcnt_t map_blks)); 289*5c51f124SMoriah Waterland extern int swapcfile __P((VFP_T **a_mapvfp, VFP_T **a_tmpvfp, 290*5c51f124SMoriah Waterland char *pkginst, int dbchg)); 291*5c51f124SMoriah Waterland extern int set_cfdir __P((char *cfdir)); 292*5c51f124SMoriah Waterland extern int socfile __P((VFP_T **vfp)); 293*5c51f124SMoriah Waterland extern int relslock __P((void)); 294*5c51f124SMoriah Waterland extern int iscfile __P((void)); 295*5c51f124SMoriah Waterland extern int vcfile __P((void)); 296*5c51f124SMoriah Waterland 297*5c51f124SMoriah Waterland extern fsblkcnt_t nblk __P((fsblkcnt_t size, ulong_t bsize, 298*5c51f124SMoriah Waterland ulong_t frsize)); 299*5c51f124SMoriah Waterland extern struct cfent **procmap __P((VFP_T *vfp, int mapflag, char *ir)); 300*5c51f124SMoriah Waterland extern void repl_cfent __P((struct cfent *new, struct cfent *old)); 301*5c51f124SMoriah Waterland extern struct cfextra **pkgobjmap __P((VFP_T *vfp, int mapflag, char *ir)); 302*5c51f124SMoriah Waterland extern void pkgobjinit __P((void)); 303*5c51f124SMoriah Waterland extern int seed_pkgobjmap __P((struct cfextra *ext_entry, char *path, 304*5c51f124SMoriah Waterland char *local)); 305*5c51f124SMoriah Waterland extern int init_pkgobjspace __P((void)); 306*5c51f124SMoriah Waterland 307*5c51f124SMoriah Waterland /* eptstat.c */ 308*5c51f124SMoriah Waterland extern void pinfo_free __P((void)); 309*5c51f124SMoriah Waterland extern struct pinfo *eptstat __P((struct cfent *entry, char *pkg, char c)); 310*5c51f124SMoriah Waterland 311*5c51f124SMoriah Waterland /* echo.c */ 312*5c51f124SMoriah Waterland /*PRINTFLIKE1*/ 313*5c51f124SMoriah Waterland extern void echo __P((char *a_fmt, ...)); 314*5c51f124SMoriah Waterland /*PRINTFLIKE1*/ 315*5c51f124SMoriah Waterland extern void echoDebug __P((char *a_fmt, ...)); 316*5c51f124SMoriah Waterland extern boolean_t echoGetFlag __P((void)); 317*5c51f124SMoriah Waterland extern boolean_t echoDebugGetFlag __P((void)); 318*5c51f124SMoriah Waterland extern boolean_t echoSetFlag __P((boolean_t a_debugFlag)); 319*5c51f124SMoriah Waterland extern boolean_t echoDebugSetFlag __P((boolean_t a_debugFlag)); 320*5c51f124SMoriah Waterland 321*5c51f124SMoriah Waterland /* psvr4ck.c */ 322*5c51f124SMoriah Waterland extern void psvr4cnflct __P((void)); 323*5c51f124SMoriah Waterland extern void psvr4mail __P((char *list, char *msg, int retcode, char *pkg)); 324*5c51f124SMoriah Waterland extern void psvr4pkg __P((char **ppkg)); 325*5c51f124SMoriah Waterland 326*5c51f124SMoriah Waterland /* ptext.c */ 327*5c51f124SMoriah Waterland /*PRINTFLIKE2*/ 328*5c51f124SMoriah Waterland extern void ptext __P((FILE *fp, char *fmt, ...)); 329*5c51f124SMoriah Waterland 330*5c51f124SMoriah Waterland /* putparam.c */ 331*5c51f124SMoriah Waterland extern void putparam __P((char *param, char *value)); 332*5c51f124SMoriah Waterland extern void getuserlocale __P((void)); 333*5c51f124SMoriah Waterland extern void putuserlocale __P((void)); 334*5c51f124SMoriah Waterland extern void putConditionInfo __P((char *, char *)); 335*5c51f124SMoriah Waterland 336*5c51f124SMoriah Waterland /* setadmin.c */ 337*5c51f124SMoriah Waterland extern void setadminFile __P((char *file)); 338*5c51f124SMoriah Waterland extern char *setadminSetting __P((char *a_paramName, 339*5c51f124SMoriah Waterland char *a_paramValue)); 340*5c51f124SMoriah Waterland extern char *set_keystore_admin __P((void)); 341*5c51f124SMoriah Waterland extern boolean_t get_proxy_port_admin __P((char **, ushort_t *)); 342*5c51f124SMoriah Waterland extern boolean_t check_keystore_admin __P((char **)); 343*5c51f124SMoriah Waterland extern int web_ck_retries __P((void)); 344*5c51f124SMoriah Waterland extern int web_ck_timeout __P((void)); 345*5c51f124SMoriah Waterland extern int web_ck_authentication __P((void)); 346*5c51f124SMoriah Waterland 347*5c51f124SMoriah Waterland /* setlist.c */ 348*5c51f124SMoriah Waterland extern char *cl_iscript __P((int idx)); 349*5c51f124SMoriah Waterland extern char *cl_rscript __P((int idx)); 350*5c51f124SMoriah Waterland extern void find_CAS __P((int CAS_type, char *bin_ptr, char *inst_ptr)); 351*5c51f124SMoriah Waterland extern int setlist __P((struct cl_attr ***plist, char *slist)); 352*5c51f124SMoriah Waterland extern void addlist __P((struct cl_attr ***plist, char *item)); 353*5c51f124SMoriah Waterland extern char *cl_nam __P((int cl_idx)); 354*5c51f124SMoriah Waterland extern char *flex_device(char *device_name, int dev_ok); 355*5c51f124SMoriah Waterland extern int cl_getn __P((void)); 356*5c51f124SMoriah Waterland extern int cl_idx __P((char *cl_nam)); 357*5c51f124SMoriah Waterland extern void cl_sets __P((char *slist)); 358*5c51f124SMoriah Waterland extern void cl_setl __P((struct cl_attr **cl_lst)); 359*5c51f124SMoriah Waterland extern void cl_putl __P((char *parm_name, struct cl_attr **list)); 360*5c51f124SMoriah Waterland extern int cl_deliscript __P((int i)); 361*5c51f124SMoriah Waterland extern unsigned cl_svfy __P((int i)); 362*5c51f124SMoriah Waterland extern unsigned cl_dvfy __P((int i)); 363*5c51f124SMoriah Waterland extern unsigned cl_pthrel __P((int i)); 364*5c51f124SMoriah Waterland 365*5c51f124SMoriah Waterland /* passwd.c */ 366*5c51f124SMoriah Waterland extern int pkg_passphrase_cb __P((char *, int, int, void *)); 367*5c51f124SMoriah Waterland extern void set_passarg __P((char *)); 368*5c51f124SMoriah Waterland extern void set_prompt __P((char *)); 369*5c51f124SMoriah Waterland 370*5c51f124SMoriah Waterland /* fixpath.c */ 371*5c51f124SMoriah Waterland extern void __P(export_client_env(char *)); 372*5c51f124SMoriah Waterland extern void __P(set_partial_inst(void)); 373*5c51f124SMoriah Waterland extern int __P(is_partial_inst(void)); 374*5c51f124SMoriah Waterland extern void __P(set_depend_pkginfo_DB(boolean_t a_setting)); 375*5c51f124SMoriah Waterland extern boolean_t __P(is_depend_pkginfo_DB(void)); 376*5c51f124SMoriah Waterland extern void __P(disable_spool_create(void)); 377*5c51f124SMoriah Waterland extern int __P(is_spool_create(void)); 378*5c51f124SMoriah Waterland 379*5c51f124SMoriah Waterland /* open_package_datastream.c */ 380*5c51f124SMoriah Waterland extern boolean_t open_package_datastream(int a_argc, char **a_argv, 381*5c51f124SMoriah Waterland char *a_spoolto, char *a_device, 382*5c51f124SMoriah Waterland int *r_repeat, char **r_idsName, 383*5c51f124SMoriah Waterland char *a_tmpdir, struct pkgdev *a_pkgdev, 384*5c51f124SMoriah Waterland int a_optind); 385*5c51f124SMoriah Waterland 386*5c51f124SMoriah Waterland /* setup_temporary_directory.c */ 387*5c51f124SMoriah Waterland extern boolean_t setup_temporary_directory(char **r_dirname, 388*5c51f124SMoriah Waterland char *a_tmpdir, char *a_suffix); 389*5c51f124SMoriah Waterland 390*5c51f124SMoriah Waterland /* unpack_package_from_stream.c */ 391*5c51f124SMoriah Waterland extern boolean_t unpack_package_from_stream(char *a_idsName, 392*5c51f124SMoriah Waterland char *a_pkginst, char *a_tempDir); 393*5c51f124SMoriah Waterland 394*5c51f124SMoriah Waterland /* pkgops.c */ 395*5c51f124SMoriah Waterland 396*5c51f124SMoriah Waterland extern boolean_t pkgAddPackageToGzonlyList(char *a_pkgInst, 397*5c51f124SMoriah Waterland char *a_rootPath); 398*5c51f124SMoriah Waterland extern void pkgAddThisZonePackage(char *a_pkgInst); 399*5c51f124SMoriah Waterland extern boolean_t pkgRemovePackageFromGzonlyList(char *a_rootPath, 400*5c51f124SMoriah Waterland char *a_pkgInst); 401*5c51f124SMoriah Waterland extern FILE *pkgOpenInGzOnlyFile(char *a_rootPath); 402*5c51f124SMoriah Waterland extern void pkginfoFree(struct pkginfo **r_info); 403*5c51f124SMoriah Waterland extern boolean_t pkginfoIsPkgInstalled(struct pkginfo **r_pinfo, 404*5c51f124SMoriah Waterland char *a_pkgInst); 405*5c51f124SMoriah Waterland extern boolean_t pkgIsPkgInGzOnly(char *a_rootPath, char *a_pkgInst); 406*5c51f124SMoriah Waterland extern boolean_t pkgIsPkgInGzOnlyFP(FILE *a_fp, char *a_pkgInst); 407*5c51f124SMoriah Waterland extern boolean_t pkginfoParamTruth(FILE *a_fp, char *a_param, 408*5c51f124SMoriah Waterland char *a_value, boolean_t a_default); 409*5c51f124SMoriah Waterland extern int pkgGetPackageList(char ***r_pkgList, char **a_argv, 410*5c51f124SMoriah Waterland int a_optind, char *a_categories, 411*5c51f124SMoriah Waterland char **a_categoryList, struct pkgdev *a_pkgdev); 412*5c51f124SMoriah Waterland extern void pkgLocateHighestInst(char *r_path, int r_pathLen, 413*5c51f124SMoriah Waterland char *r_pkgInst, int r_pkgInstLen, 414*5c51f124SMoriah Waterland char *a_rootPath, char *a_pkgInst); 415*5c51f124SMoriah Waterland extern boolean_t pkgPackageIsThisZone(char *a_pkgInst); 416*5c51f124SMoriah Waterland extern boolean_t pkgMatchInherited(char *a_src, char *a_dst, 417*5c51f124SMoriah Waterland char *a_rootDir, char a_mode, time_t a_modtime, 418*5c51f124SMoriah Waterland char a_ftype, unsigned long a_cksum); 419*5c51f124SMoriah Waterland extern char *pkgGetGzOnlyPath(void); 420*5c51f124SMoriah Waterland extern boolean_t pkgTestInstalled(char *a_packageName, char *a_rootPath); 421*5c51f124SMoriah Waterland 422*5c51f124SMoriah Waterland /* depchk.c */ 423*5c51f124SMoriah Waterland 424*5c51f124SMoriah Waterland struct depckErrorRecord { 425*5c51f124SMoriah Waterland int ier_numZones; 426*5c51f124SMoriah Waterland char *ier_packageName; 427*5c51f124SMoriah Waterland char **ier_zones; 428*5c51f124SMoriah Waterland char **ier_values; 429*5c51f124SMoriah Waterland }; 430*5c51f124SMoriah Waterland 431*5c51f124SMoriah Waterland typedef struct depckErrorRecord depckErrorRecord_t; 432*5c51f124SMoriah Waterland 433*5c51f124SMoriah Waterland struct depckError { 434*5c51f124SMoriah Waterland int er_numEntries; 435*5c51f124SMoriah Waterland depckErrorRecord_t *er_theEntries; 436*5c51f124SMoriah Waterland }; 437*5c51f124SMoriah Waterland 438*5c51f124SMoriah Waterland typedef struct depckError depckError_t; 439*5c51f124SMoriah Waterland 440*5c51f124SMoriah Waterland typedef int (depcklFunc_t)(char *a_msg, char *a_pkg); 441*5c51f124SMoriah Waterland 442*5c51f124SMoriah Waterland /* 443*5c51f124SMoriah Waterland * ignore_values: 444*5c51f124SMoriah Waterland * == NULL - record one message for each instance of "name" found 445*5c51f124SMoriah Waterland * == "" - record multiple instances 446*5c51f124SMoriah Waterland * != "" - record multiple instances if value not in ignore_values 447*5c51f124SMoriah Waterland */ 448*5c51f124SMoriah Waterland 449*5c51f124SMoriah Waterland struct depckl_struct { 450*5c51f124SMoriah Waterland char *name; 451*5c51f124SMoriah Waterland char *ignore_values; 452*5c51f124SMoriah Waterland char **err_msg; 453*5c51f124SMoriah Waterland depcklFunc_t *depcklFunc; 454*5c51f124SMoriah Waterland depckError_t *record; 455*5c51f124SMoriah Waterland }; 456*5c51f124SMoriah Waterland 457*5c51f124SMoriah Waterland typedef struct depckl_struct depckl_t; 458*5c51f124SMoriah Waterland 459*5c51f124SMoriah Waterland extern int depchkReportErrors(depckl_t *depckl); 460*5c51f124SMoriah Waterland extern void depchkRecordError(depckError_t *a_erc, 461*5c51f124SMoriah Waterland char *a_pkginst, char *a_zoneName, 462*5c51f124SMoriah Waterland char *a_value); 463*5c51f124SMoriah Waterland 464*5c51f124SMoriah Waterland /* log.c */ 465*5c51f124SMoriah Waterland 466*5c51f124SMoriah Waterland /* types of log messages we recognize */ 467*5c51f124SMoriah Waterland typedef enum { 468*5c51f124SMoriah Waterland LOG_MSG_ERR, 469*5c51f124SMoriah Waterland LOG_MSG_WRN, 470*5c51f124SMoriah Waterland LOG_MSG_INFO, 471*5c51f124SMoriah Waterland LOG_MSG_DEBUG 472*5c51f124SMoriah Waterland } LogMsgType; 473*5c51f124SMoriah Waterland 474*5c51f124SMoriah Waterland /*PRINTFLIKE2*/ 475*5c51f124SMoriah Waterland extern void log_msg(LogMsgType, const char *, ...); 476*5c51f124SMoriah Waterland extern void log_set_verbose(boolean_t); 477*5c51f124SMoriah Waterland extern boolean_t log_get_verbose(void); 478*5c51f124SMoriah Waterland 479*5c51f124SMoriah Waterland /* 480*5c51f124SMoriah Waterland * typedef for the 'ckreturn' function 481*5c51f124SMoriah Waterland */ 482*5c51f124SMoriah Waterland typedef void (ckreturnFunc_t)(int a_retcode); 483*5c51f124SMoriah Waterland 484*5c51f124SMoriah Waterland /* sml.c */ 485*5c51f124SMoriah Waterland 486*5c51f124SMoriah Waterland /* null reference to SML_TAG object */ 487*5c51f124SMoriah Waterland 488*5c51f124SMoriah Waterland #define SML_TAG__NULL ((SML_TAG*)NULL) 489*5c51f124SMoriah Waterland 490*5c51f124SMoriah Waterland /* null reference to SML_TAG * object */ 491*5c51f124SMoriah Waterland 492*5c51f124SMoriah Waterland #define SML_TAG__R_NULL ((SML_TAG**)NULL) 493*5c51f124SMoriah Waterland 494*5c51f124SMoriah Waterland /* is reference to SML_TAG object valid? */ 495*5c51f124SMoriah Waterland 496*5c51f124SMoriah Waterland #define SML_TAG__ISVALID(tag) ((tag) != (SML_TAG__NULL)) 497*5c51f124SMoriah Waterland 498*5c51f124SMoriah Waterland /* is indirect reference to SML_TAG object valid? */ 499*5c51f124SMoriah Waterland 500*5c51f124SMoriah Waterland #define SML_TAG__R_ISVALID(r_tag) \ 501*5c51f124SMoriah Waterland ((r_tag) != ((SML_TAG**)(SML_TAG__NULL))) 502*5c51f124SMoriah Waterland 503*5c51f124SMoriah Waterland /* definitions for sml passed from pkginstall to pkgcond */ 504*5c51f124SMoriah Waterland 505*5c51f124SMoriah Waterland #define PKGCOND_GLOBAL_VARIABLE "SUNW_PKGCOND_GLOBAL_DATA" 506*5c51f124SMoriah Waterland #define TAG_COND_TOPLEVEL "environmentConditionInformation" 507*5c51f124SMoriah Waterland #define TAG_COND_PARENT_ZONE "parentZone" 508*5c51f124SMoriah Waterland #define TAG_COND_CURRENT_ZONE "currentZone" 509*5c51f124SMoriah Waterland #define TAG_COND_ZONE_NAME "zoneName" 510*5c51f124SMoriah Waterland #define TAG_COND_ZONE_TYPE "zoneType" 511*5c51f124SMoriah Waterland #define TAG_COND_INHERITED_FS "inheritedFileSystem" 512*5c51f124SMoriah Waterland #define TAG_COND_FS_NAME "fileSystemName" 513*5c51f124SMoriah Waterland #define TAG_VALUE_GLOBAL_ZONE "global" 514*5c51f124SMoriah Waterland #define TAG_VALUE_NONGLOBAL_ZONE "nonglobal" 515*5c51f124SMoriah Waterland 516*5c51f124SMoriah Waterland typedef struct _sml_tag_struct SML_TAG; 517*5c51f124SMoriah Waterland typedef struct _sml_parameter_struct SML_PARAM; 518*5c51f124SMoriah Waterland 519*5c51f124SMoriah Waterland struct _sml_tag_struct { 520*5c51f124SMoriah Waterland char *name; /* tag name */ 521*5c51f124SMoriah Waterland int params_num; /* # params in *params */ 522*5c51f124SMoriah Waterland SML_PARAM *params; /* tag parameters */ 523*5c51f124SMoriah Waterland int tags_num; /* # subtags in *tags */ 524*5c51f124SMoriah Waterland SML_TAG *tags; /* tag subtags */ 525*5c51f124SMoriah Waterland }; 526*5c51f124SMoriah Waterland 527*5c51f124SMoriah Waterland struct _sml_parameter_struct { 528*5c51f124SMoriah Waterland char *name; /* tag name */ 529*5c51f124SMoriah Waterland char *value; /* parameters */ 530*5c51f124SMoriah Waterland }; 531*5c51f124SMoriah Waterland 532*5c51f124SMoriah Waterland SML_TAG *smlAddTag(SML_TAG **r_tag, int a_index, 533*5c51f124SMoriah Waterland SML_TAG *a_subTag); 534*5c51f124SMoriah Waterland boolean_t smlFstatCompareEq(struct stat *statbuf, 535*5c51f124SMoriah Waterland SML_TAG *tag, char *path); 536*5c51f124SMoriah Waterland char *smlConvertTagToString(SML_TAG *tag); 537*5c51f124SMoriah Waterland /*PRINTFLIKE2*/ 538*5c51f124SMoriah Waterland void smlDbgPrintTag(SML_TAG *a_tag, char *a_format, ...); 539*5c51f124SMoriah Waterland void smlDelTag(SML_TAG *tag, SML_TAG *sub_tag); 540*5c51f124SMoriah Waterland void smlDelParam(SML_TAG *tag, char *name); 541*5c51f124SMoriah Waterland SML_TAG *smlDup(SML_TAG *tag); 542*5c51f124SMoriah Waterland boolean_t smlFindAndDelTag(SML_TAG *tag, char *findTag); 543*5c51f124SMoriah Waterland void smlFreeTag(SML_TAG *tag); 544*5c51f124SMoriah Waterland char *smlGetElementName(SML_TAG *a_tag); 545*5c51f124SMoriah Waterland int smlGetNumParams(SML_TAG *a_tag); 546*5c51f124SMoriah Waterland char *smlGetParam(SML_TAG *tag, char *name); 547*5c51f124SMoriah Waterland /*PRINTFLIKE2*/ 548*5c51f124SMoriah Waterland char *smlGetParamF(SML_TAG *tag, char *format, ...); 549*5c51f124SMoriah Waterland void smlGetParam_r(SML_TAG *tag, char *name, char *buf, 550*5c51f124SMoriah Waterland int bufLen); 551*5c51f124SMoriah Waterland char *smlGetParamByTag(SML_TAG *tag, int index, 552*5c51f124SMoriah Waterland char *tagName, char *parmName); 553*5c51f124SMoriah Waterland char *smlGetParamByTagParam(SML_TAG *tag, int index, 554*5c51f124SMoriah Waterland char *tagName, char *parmName, char *parmValue, 555*5c51f124SMoriah Waterland char *parmReturn); 556*5c51f124SMoriah Waterland char *smlGetParamName(SML_TAG *tag, int index); 557*5c51f124SMoriah Waterland SML_TAG *smlGetTag(SML_TAG *tag, int index); 558*5c51f124SMoriah Waterland SML_TAG *smlGetTagByName(SML_TAG *tag, int index, char *name); 559*5c51f124SMoriah Waterland SML_TAG *smlGetTagByTagParam(SML_TAG *tag, int index, 560*5c51f124SMoriah Waterland char *tagName, char *paramName, char *paramValue); 561*5c51f124SMoriah Waterland boolean_t smlGetVerbose(void); 562*5c51f124SMoriah Waterland int smlLoadTagFromFile(SML_TAG **r_tag, char *a_fileName); 563*5c51f124SMoriah Waterland SML_TAG *smlNewTag(char *name); 564*5c51f124SMoriah Waterland boolean_t smlParamEq(SML_TAG *tag, char *findTag, 565*5c51f124SMoriah Waterland char *findParam, char *str); 566*5c51f124SMoriah Waterland /*PRINTFLIKE4*/ 567*5c51f124SMoriah Waterland boolean_t smlParamEqF(SML_TAG *tag, char *findTag, char *findParam, 568*5c51f124SMoriah Waterland char *format, ...); 569*5c51f124SMoriah Waterland void smlPrintTag(SML_TAG *tag); 570*5c51f124SMoriah Waterland int smlReadOneTag(SML_TAG **r_tag, char *a_str); 571*5c51f124SMoriah Waterland int smlConvertStringToTag(SML_TAG **r_tag, char *str); 572*5c51f124SMoriah Waterland void smlSetFileStatInfo(SML_TAG **tag, 573*5c51f124SMoriah Waterland struct stat *statbuf, char *path); 574*5c51f124SMoriah Waterland void smlSetParam(SML_TAG *tag, char *name, char *value); 575*5c51f124SMoriah Waterland /*PRINTFLIKE3*/ 576*5c51f124SMoriah Waterland void smlSetParamF(SML_TAG *tag, char *name, char *format, ...); 577*5c51f124SMoriah Waterland void smlSetVerbose(boolean_t a_setting); 578*5c51f124SMoriah Waterland int smlWriteTagToFd(SML_TAG *tag, int fd); 579*5c51f124SMoriah Waterland int smlWriteTagToFile(SML_TAG *tag, char *filename); 580*5c51f124SMoriah Waterland /*PRINTFLIKE3*/ 581*5c51f124SMoriah Waterland void sml_strPrintf_r(char *a_buf, int a_bufLen, char *a_format, ...); 582*5c51f124SMoriah Waterland /*PRINTFLIKE1*/ 583*5c51f124SMoriah Waterland char *sml_strPrintf(char *a_format, ...); 584*5c51f124SMoriah Waterland char *sml_XmlEncodeString(char *a_plainTextString); 585*5c51f124SMoriah Waterland char *sml_XmlDecodeString(char *a_xmlEncodedString); 586*5c51f124SMoriah Waterland 587*5c51f124SMoriah Waterland #if defined(lint) && !defined(gettext) 588*5c51f124SMoriah Waterland #define gettext(x) x 589*5c51f124SMoriah Waterland #endif /* defined(lint) && !defined(gettext) */ 590*5c51f124SMoriah Waterland 591*5c51f124SMoriah Waterland #ifdef __cplusplus 592*5c51f124SMoriah Waterland } 593*5c51f124SMoriah Waterland #endif 594*5c51f124SMoriah Waterland 595*5c51f124SMoriah Waterland #endif /* __HDRS_LIBINST_H__ */ 596