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 2008 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 #ifndef _PKGLIBMSGS_H
32 #define	_PKGLIBMSGS_H
33 
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 /* srchcfile messages */
40 #define	ERR_MISSING_NEWLINE	"missing newline at end of entry"
41 #define	ERR_ILLEGAL_SEARCH_PATH	"illegal search path specified"
42 #define	ERR_CANNOT_READ_MM_NUMS	"unable to read major/minor device numbers"
43 #define	ERR_INCOMPLETE_ENTRY	"incomplete entry"
44 #define	ERR_VOLUMENO_UNEXPECTED	"volume number not expected"
45 #define	ERR_FTYPE_I_UNEXPECTED	"ftype <i> not expected"
46 #define	ERR_CANNOT_READ_CLASS_TOKEN	"unable to read class token"
47 #define	ERR_CANNOT_READ_PATHNAME_FLD	"unable to read pathname field"
48 #define	ERR_UNKNOWN_FTYPE	"unknown ftype"
49 #define	ERR_CANNOT_READ_LL_PATH	"unable to read local/link path"
50 #define	ERR_INCOMPLETE_ENTRY	"incomplete entry"
51 #define	ERR_NO_LINK_SOURCE_SPECIFIED	"no link source specified"
52 #define	ERR_CANNOT_READ_MOG	"unable to read mode/owner/group"
53 #define	ERR_CANNOT_READ_CONTENT_INFO	"unable to read content info"
54 #define	ERR_PACKAGE_NAME_TOO_LONG	"package name too long"
55 #define	ERR_NO_MEMORY	"no memory for package information"
56 #define	ERR_BAD_ENTRY_END	"bad end of entry"
57 #define	ERR_EXTRA_TOKENS	"extra token(s) on input line"
58 
59 /* pkgtrans messages */
60 #define	MSG_TRANSFER	"Transferring <%s> package instance\n"
61 #define	MSG_RENAME 	"\t... instance renamed <%s> on destination\n"
62 
63 #define	ERR_TRANSFER	"unable to complete package transfer"
64 #define	MSG_SEQUENCE	"- volume is out of sequence"
65 #define	MSG_MEM		"- no memory"
66 #define	MSG_CMDFAIL	"- process <%s> failed, exit code %d"
67 #define	MSG_POPEN	"- popen of <%s> failed, errno=%d"
68 #define	MSG_PCLOSE	"- pclose of <%s> failed, errno=%d"
69 #define	MSG_BADDEV	"- invalid or unknown device <%s>"
70 #define	MSG_GETVOL	"- unable to obtain package volume"
71 #define	MSG_NOSIZE 	"- unable to obtain maximum part size from pkgmap"
72 #define	MSG_CHDIR	"- unable to change directory to <%s>"
73 #define	MSG_SYMLINK	"- unable to create symbolic link to <%s> from <%s>"
74 #define	MSG_STATDIR	"- unable to stat <%s>"
75 #define	MSG_CHOWNDIR	"- unable to chown <%s>"
76 #define	MSG_CHMODDIR	"- unable to chmod <%s>"
77 #define	MSG_FSTYP	"- unable to determine filesystem type for <%s>"
78 #define	MSG_NOTEMP	"- unable to create or use temporary directory <%s>"
79 #define	MSG_SAMEDEV	"- source and destination represent the same device"
80 #define	MSG_NOTMPFIL	"- unable to create or use temporary file <%s>"
81 #define	MSG_NOPKGMAP	"- unable to open pkgmap for <%s>"
82 #define	MSG_BADPKGINFO	"- unable to determine contents of pkginfo file"
83 #define	MSG_NOPKGS	"- no packages were selected from <%s>"
84 #define	MSG_MKDIR	"- unable to make directory <%s>"
85 #define	MSG_NOEXISTS	"- package instance <%s> does not exist on source " \
86 			"device"
87 #define	MSG_EXISTS	"- no permission to overwrite existing path <%s>"
88 #define	MSG_DUPVERS	"- identical version of <%s> already exists on " \
89 			"destination device"
90 #define	MSG_TWODSTREAM	"- both source and destination devices cannot be a " \
91 			"datastream"
92 #define	MSG_OPEN	"- open of <%s> failed, errno=%d"
93 #define	MSG_STATVFS	"- statvfs(%s) failed, errno=%d"
94 
95 /* parameter errors */
96 #define	ERR_LEN		"length of parameter <%s> value exceeds limit"
97 #define	ERR_ASCII	"parameter <%s> must be ascii"
98 #define	ERR_ALNUM	"parameter <%s> must be alphanumeric"
99 #define	ERR_CHAR	"parameter <%s> has incorrect first character"
100 #define	ERR_UNDEF	"parameter <%s> cannot be null"
101 
102 /* volume sequence errors */
103 #define	MSG_SEQ		"Volume is out of sequence."
104 #define	MSG_CORRUPT	"Volume is corrupt or is not part of the appropriate " \
105 			"package."
106 #define	ERR_NOPKGMAP	"ERROR: unable to process <%s>"
107 #define	ERR_BADPKGINFO	"ERROR: unable to process <%s>"
108 
109 /* datastream processing errors */
110 #define	ERR_UNPACK	"attempt to process datastream failed"
111 #define	ERR_DSTREAMSEQ	"datastream sequence corruption"
112 #define	ERR_TRANSFER    "unable to complete package transfer"
113 #define	MSG_CMDFAIL	"- process <%s> failed, exit code %d"
114 #define	MSG_TOC		"- bad format in datastream table-of-contents"
115 #define	MSG_EMPTY	"- datastream table-of-contents appears to be empty"
116 #define	MSG_POPEN	"- popen of <%s> failed, errno=%d"
117 #define	MSG_OPEN	"- open of <%s> failed, errno=%d"
118 #define	MSG_PCLOSE	"- pclose of <%s> failed, errno=%d"
119 #define	MSG_PKGNAME	"- invalid package name in datastream table-of-contents"
120 #define	MSG_NOPKG	"- package <%s> not in datastream"
121 #define	MSG_STATFS	"- unable to stat filesystem, errno=%d"
122 #define	MSG_NOSPACE	"- not enough space, %ld blocks required, "\
123 			"%lld available"
124 
125 /* pkglist errors */
126 #define	ERR_MEMORY	"memory allocation failure, errno=%d"
127 #define	ERR_NOPKG	"no package associated with <%s>"
128 #define	HEADER		"The following packages are available:"
129 #define	HELP		"Please enter the package instances you wish to " \
130 			"process from the list provided (or 'all' to process " \
131 			"all packages.)"
132 
133 #define	PROMPT		"Select package(s) you wish to process (or 'all' to " \
134 			"process all packages)."
135 /* pkgmap errors */
136 #define	ERR_READLINK	"unable to read link specification."
137 #define	ERR_NOVAR	"no value defined for%s variable <%s>."
138 #define	ERR_OWNTOOLONG	"owner string is too long."
139 #define	ERR_GRPTOOLONG	"group string is too long."
140 #define	ERR_IMODE	"mode must not be parametric at install time."
141 #define	ERR_BASEINVAL	"invalid base for mode."
142 #define	ERR_MODELONG	"mode string is too long."
143 #define	ERR_MODEALPHA	"mode is not numeric."
144 #define	ERR_MODEBITS	"invalid bits set in mode."
145 
146 /* package mount errors and msgs */
147 #define	ERR_FSTYP	"unable to determine fstype for <%s>"
148 #define	ERR_NOTROOT	"You must be \"root\" when using mountable media."
149 #define	MOUNT		"/sbin/mount"
150 #define	UMOUNT		"/sbin/umount"
151 #define	FSTYP		"/usr/sbin/fstyp"
152 
153 #define	LABEL0	"Insert %%v %d of %d for <%s> package into %%p."
154 #define	LABEL1	"Insert %%v %d of %d into %%p."
155 #define	LABEL2	"Insert %%v for <%s> package into %%p."
156 #define	LABEL3	"Insert %%v into %%p."
157 
158 /* package verify errors */
159 #define	MSG_WLDDEVNO	"NOTE: <%s> created as device (%ld, %ld)."
160 
161 #define	WRN_QV_SIZE	"WARNING: quick verify of <%s>; wrong size."
162 #define	WRN_QV_MTIME	"WARNING: quick verify of <%s>; wrong mod time."
163 
164 #define	ERR_PKG_INTERNAL "Internal package library failure file %s line %d"
165 #define	ERR_UNKNOWN	"unable to determine object type"
166 #define	ERR_EXIST	"pathname does not exist"
167 #define	ERR_FTYPE	"file type <%c> expected <%c> actual"
168 #define	ERR_FTYPED	"<%s> is a door and is not being modified"
169 #define	ERR_LINK	"pathname not properly linked to <%s>"
170 #define	ERR_SLINK	"pathname not symbolically linked to <%s>"
171 #define	ERR_MTIME	"modtime <%s> expected <%s> actual"
172 #define	ERR_SIZE	"file size <%llu> expected <%llu> actual"
173 #define	ERR_CKSUM	"file cksum <%ld> expected <%ld> actual"
174 #define	ERR_NO_CKSUM	"unable to checksum, may need to re-run command as " \
175 			"user \"root\""
176 #define	ERR_MAJMIN	"major/minor device <%ld, %ld> " \
177 			"expected <%ld, %ld> actual"
178 #define	ERR_PERM	"permissions <%04lo> expected <%04lo> actual"
179 #define	ERR_GROUP	"group name <%s> expected <%s> actual"
180 #define	ERR_OWNER	"owner name <%s> expected <%s> actual"
181 #define	ERR_MODFAIL	"unable to fix modification time"
182 #define	ERR_LINKFAIL	"unable to create link to <%s>"
183 #define	ERR_LINKISDIR	"<%s> is a directory, link() not performed"
184 #define	ERR_SLINKFAIL	"unable to create symbolic link to <%s>"
185 #define	ERR_DIRFAIL	"unable to create directory"
186 #define	ERR_CDEVFAIL	"unable to create character-special device"
187 #define	ERR_BDEVFAIL	"unable to create block-special device"
188 #define	ERR_PIPEFAIL	"unable to create named pipe"
189 #define	ERR_ATTRFAIL	"unable to fix attributes"
190 #define	ERR_BADGRPID	"unable to determine group name for gid <%d>"
191 #define	ERR_BADUSRID	"unable to determine owner name for uid <%d>"
192 #define	ERR_BADGRPNM	"group name <%s> not found in group table(s)"
193 #define	ERR_BADUSRNM	"owner name <%s> not found in passwd table(s)"
194 #define	ERR_GETWD	"unable to determine current working directory"
195 #define	ERR_CHDIR	"unable to change current working directory to <%s>"
196 #define	ERR_RMDIR	"unable to remove existing directory at <%s>"
197 
198 /* others */
199 #define	ERR_ISCPIO_OPEN		"iscpio(): open(%s) failed!"
200 #define	ERR_ISCPIO_FSTAT	"iscpio(): fstat(%s) failed!"
201 #define	ERR_ISCPIO_READ		"iscpio(): read(%s) failed!"
202 #define	ERR_ISCPIO_NOCPIO	"iscpio(): <%s> is not a cpio archive!"
203 
204 #define	ERR_DUPFAIL	"%s: strdup(%s) failed.\n"
205 #define	ERR_ADDFAIL	"%s: add_cache() failed.\n"
206 #define	ERR_BADMEMB	"%s: %s in \"%s\" %s structure is invalid.\n"
207 #define	ERR_NOGRP	"dup_gr_ent(): no group entry provided.\n"
208 #define	ERR_NOPWD	"dup_pw_ent(): no passwd entry provided.\n"
209 #define	ERR_NOINIT	"%s: init_cache() failed.\n"
210 #define	ERR_MALLOC	"%s: malloc(%d) failed for %s.\n"
211 
212 #define	ERR_TOO_MANY_ARGS	"too many arguments passed to pkgexecl " \
213 				"for command <%s>"
214 #define	ERR_WAIT_FAILED	"wait for process %ld failed, status " \
215 			"<0x%08x> errno <%d> (%s)"
216 #define	ERR_FORK_FAILED	"fork() failed errno=%d (%s)"
217 #define	ERR_FREOPEN	"freopen(%s, \"%s\", %s) failed, errno=%d (%s)"
218 #define	ERR_FDOPEN	"fdopen(%d, \"%s\") failed, errno=%d (%s)"
219 #define	ERR_CLOSE	"close(%d) failed, errno=%d"
220 #define	ERR_SETGID	"setgid(%d) failed."
221 #define	ERR_SETUID	"setuid(%d) failed."
222 #define	ERR_EX_FAIL	"exec of %s failed, errno=%d"
223 
224 #define	ERR_MEM "unable to allocate memory."
225 
226 #define	MSG_BASE_USED   "Using <%s> as the package base directory."
227 
228 #ifdef __cplusplus
229 }
230 #endif
231 
232 #endif /* _PKGLIBMSGS_H */
233