xref: /illumos-gate/usr/src/cmd/svr4pkg/hdrs/install.h (revision ed093b41a93e8563e6e1e5dae0768dda2a7bcc27)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright (c) 2017 Peter Tribble.
24  */
25 
26 /*
27  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
32 /* All Rights Reserved */
33 
34 #ifndef __INSTALL_H
35 #define	__INSTALL_H
36 
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 #include <sys/types.h>
43 #include <limits.h>
44 #include <pkgstrct.h>
45 
46 /* Settings for procedure scripts */
47 #define	PROC_USER	"root"
48 #define	PROC_GRP	"other"
49 #define	PROC_STDIN	"/dev/null"
50 #define	PROC_XSTDIN	"/dev/tty"
51 #define	PROC_STDOUT	"/dev/tty"
52 
53 /* Settings for class action scripts */
54 #define	CAS_USER	"root"
55 #define	CAS_GRP		"other"
56 #define	CAS_STDIN	"/dev/null"
57 #define	CAS_STDOUT	"/dev/tty"
58 
59 /* Settings for non-privileged scripts */
60 #define	CHK_USER	"install"	/* default user i.d. to use */
61 #define	CHK_USER_ALT	"noaccess"	/* alternate non-priv user */
62 #define	CHK_USER_ROOT	"root"		/* root user */
63 #define	CHK_USER_NON	"root"		/* user for non-compliant pkg's */
64 #define	CHK_GRP		"other"
65 #define	CHK_STDIN	"/dev/null"
66 #define	CHK_STDOUT	"/dev/tty"
67 
68 /* Settings for admin "rscriptalt" option */
69 #define	RSCRIPTALT		rscriptalt
70 #define	RSCRIPTALT_KEYWORD	"rscriptalt"
71 #define	RSCRIPTALT_ROOT		"root"
72 #define	RSCRIPTALT_NOACCESS	"noaccess"
73 
74 #define	OAMBASE	"/usr/sadm/sysadm"
75 #define	MAILCMD	"/usr/bin/mail"
76 #define	DATSTRM	"datastream"
77 #define	SHELL	"/sbin/sh"
78 #define	PKGINFO	"pkginfo"
79 #define	PKGMAP	"pkgmap"
80 #define	LIVE_CONT	"__live_cont__"
81 #define	RELOC "reloc"
82 #define	ROOT "root"
83 
84 /* Additional cfent/cfextra codes. */
85 #define	BADFSYS	(short)(-1) /* an fsys is needed */
86 #define	BADINDEX    (-1)    /* pkg class idx not yet set */
87 
88 /* This holds admin file data. */
89 struct admin {
90 	char	*mail;
91 	char	*instance;
92 	char	*partial;
93 	char	*runlevel;
94 	char	*idepend;
95 	char	*rdepend;
96 	char	*space;
97 	char	*setuid;
98 	char	*conflict;
99 	char	*action;
100 	char	*basedir;
101 	char	*rscriptalt;
102 };
103 
104 /*
105  * This table details the status of all filesystems available to the target
106  * host.
107  */
108 struct fstable {
109 	char	*name;	/* name of filesystem, (mount point) */
110 	int	namlen;	/* The length of the name (mountpoint) */
111 	fsblkcnt_t bsize;	/* fundamental file system block size */
112 	fsblkcnt_t frsize;	/* file system fragment size */
113 	fsblkcnt_t bfree;	/* total # of free blocks */
114 	fsblkcnt_t bused;	/* total # of used blocks */
115 	fsblkcnt_t ffree;	/* total # of free file nodes */
116 	fsblkcnt_t fused;	/* total # of used file nodes */
117 	char	*fstype;	/* type of filesystem - nfs, lo, ... */
118 	char	*remote_name;	/* client's mounted filesystem */
119 	unsigned	writeable:1;	/* access permission */
120 	unsigned	write_tested:1;	/* access permission fully tested */
121 	unsigned	remote:1;	/* on a remote filesystem */
122 	unsigned	mounted:1;	/* actually mounted right now */
123 	unsigned	srvr_map:1;	/* use server_map() */
124 	unsigned	cl_mounted:1;	/* mounted in client space */
125 	unsigned	mnt_failed:1;	/* attempt to loopback mount failed */
126 	unsigned	served:1;	/* filesystem comes from a server */
127 };
128 
129 #define	ADM(x, y)	((adm.x != NULL) && (y != NULL) && \
130 			    strcmp(adm.x, y) == 0)
131 #define	ADMSET(x)	(adm.x != NULL)
132 #define	PARAMETRIC(x) (x[0] == '$')
133 #define	RELATIVE(x)	(x[0] != '/')
134 
135 #if defined(lint) && !defined(gettext)
136 #define	gettext(x)	x
137 #endif	/* defined(lint) && !defined(gettext) */
138 
139 #ifdef __cplusplus
140 }
141 #endif
142 
143 #endif	/* __INSTALL_H */
144