示例#1
0
文件: pkginfo.c 项目: andreiw/polaris
int
fpkginfo(struct pkginfo *info, char *pkginst)
{

	if (info == NULL) {
		errno = EINVAL;
		return (-1);
	}

	initpkg(info);

	if (pkginst == NULL)
		return (0);
	else if (pkgnmchk(pkginst, "all", 1)) {
		errno = EINVAL; /* not an instance identifier */
		return (-1);
	}
	if (pkgdir == NULL)
		pkgdir = get_PKGLOC();

	if (rdconfig(info, pkginst, NULL)) {
		initpkg(info);
		return (-1);
	}
	return (0);
}
示例#2
0
/*VARARGS*/
char *
fpkginst(char *pkg, ...)
{
	static char pkginst[PKGSIZ+1];
	static DIR *pdirfp;
	struct dirent *dp;
	char	*ckarch, *ckvers;
	va_list	ap;

	va_start(ap, pkg);

	if (pkg == NULL) {
		/* request to close or rewind the file */
		if (pdirfp) {
			(void) closedir(pdirfp);
			pdirfp = NULL;
		}
		return (NULL);
	}

	ckarch = va_arg(ap, char *);
	ckvers = va_arg(ap, char *);
	va_end(ap);

	if (!pkgdir)
		pkgdir = get_PKGLOC();

	if (!pdirfp && ((pdirfp = opendir(pkgdir)) == NULL)) {
		errno = EACCES;
		return (NULL);
	}

	while ((dp = readdir64(pdirfp)) != NULL) {
		if (dp->d_name[0] == '.')
			continue;

		if (pkgnmchk(dp->d_name, pkg, 0))
			continue; /* ignore invalid SVR4 package names */

		if (ckinfo(dp->d_name, ckarch, ckvers))
			continue;

		/*
		 * Leave directory open in case user requests another
		 * instance.
		 */
		(void) strcpy(pkginst, dp->d_name);
		return (pkginst);
	}

	errno = ESRCH;
	/* close any file we might have open */
	(void) closedir(pdirfp);
	pdirfp = NULL;
	return (NULL);
}
示例#3
0
static int
selectp(char *p)
{
	register int i;

	for (i = 0; i < pkgcnt; ++i) {
		if (pkg[i] && pkgnmchk(p, pkg[i], 1) == 0)
			return (i);
	}
	return (-1);
}
示例#4
0
文件: pkginfo.c 项目: andreiw/polaris
/*VARARGS*/
int
pkginfo(struct pkginfo *info, char *pkginst, ...)
{
	char	*ckarch, *ckvers;
	int	check;
	va_list ap;

	va_start(ap, pkginst);
	if (info == NULL) {
		errno = EINVAL;
		return (-1);
	}
	if (pkginst == NULL) {
		info->pkginst = NULL;
		(void) fpkginfo(info, NULL);
		(void) fpkginst(NULL);
		return (0);
	}
	ckarch = va_arg(ap, char *);
	ckvers = va_arg(ap, char *);
	va_end(ap);

	check = 0;
	if (pkgnmchk(pkginst, "all", 1)) {
		/* wild card specification */
		pkginst = fpkginst(pkginst, ckarch, ckvers);
		if (pkginst == NULL)
			return (-1);
	} else {
		/* request to check indicated instance */
		if (ckarch || ckvers)
			check++;
	}

	info->pkginst = NULL;
	if (fpkginfo(info, pkginst))
		return (-1);

	if (check) {
		/*
		 * verify that the provided instance matches
		 * any arch & vers specs that were provided
		 */
		if (ckinst(pkginst, info->arch, info->version, ckarch,
		    ckvers)) {
			errno = ESRCH;
			return (-1);
		}
	}
	return (0);
}
示例#5
0
int
main(int argc, char *argv[])
{
	(void) setlocale(LC_ALL, "");

#if !defined(TEXT_DOMAIN)	/* Should be defined by cc -D */
#define	TEXT_DOMAIN "SYS_TEST"
#endif
	(void) textdomain(TEXT_DOMAIN);

	while (--argc > 0) {
		if (pkgnmchk(argv[argc], (char *)0, 1))
			exit(1);
	}
	return (0);
}
示例#6
0
int
main(int argc, char *argv[])
{
#if !defined(TEXT_DOMAIN)	/* Should be defined by cc -D */
#define	TEXT_DOMAIN "SYS_TEST"
#endif
	(void) textdomain(TEXT_DOMAIN);

	while (--argc > 0) {
		if (pkgnmchk(argv[argc], (char *)0, 1))
			exit(1);
	}
	exit(0);
	/*NOTREACHED*/
#ifdef lint
	return (0);
#endif	/* lint */
}
示例#7
0
文件: pkginfo.c 项目: andreiw/polaris
static char *
svr4inst(char *pkg)
{
	static char pkginst[PKGSIZ];
	static DIR *pdirfp;
	struct dirent64 *dp;
	struct stat64	status;	/* file status buffer */
	char	*pt;
	char	path[PATH_MAX];

	if (pkg == NULL) {
		if (pdirfp) {
			(void) closedir(pdirfp);
			pdirfp = NULL;
		}
		return (NULL);
	}

	if (!pdirfp && ((pdirfp = opendir(get_PKGOLD())) == NULL))
		return (NULL);

	while ((dp = readdir64(pdirfp)) != NULL) {
		if (dp->d_name[0] == '.')
			continue;
		pt = strchr(dp->d_name, '.');
		if (pt && strcmp(pt, ".name") == 0) {
			/* the pkgnmchk function works on .name extensions */
			if (pkgnmchk(dp->d_name, pkg, 1))
				continue;
			(void) sprintf(path, "%s/%s", get_PKGOLD(), dp->d_name);
			if (lstat64(path, &status))
				continue;
			if ((status.st_mode & S_IFMT) != S_IFREG)
				continue;
			*pt = '\0';
			(void) strcpy(pkginst, dp->d_name);
			return (pkginst);
		}
	}
	(void) closedir(pdirfp);
	pdirfp = NULL;
	return (NULL);
}
示例#8
0
文件: pkginfo.c 项目: andreiw/polaris
/*VARARGS*/
char *
fpkginst(char *pkg, ...)
{
	static char pkginst[PKGSIZ+1];
	static DIR *pdirfp;
	struct dirent64 *dp;
	char	*pt, *ckarch, *ckvers;
	va_list	ap;

	va_start(ap, pkg);

	if (pkg == NULL) {
		/* request to close or rewind the file */
		if (pdirfp) {
			(void) closedir(pdirfp);
			pdirfp = NULL;
		}
		(void) svr4inst(NULL); /* close any files used here */
		return (NULL);
	}

	ckarch = va_arg(ap, char *);
	ckvers = va_arg(ap, char *);
	va_end(ap);

	if (!pkgdir)
		pkgdir = get_PKGLOC();

	if (!pdirfp && ((pdirfp = opendir(pkgdir)) == NULL)) {
		errno = EACCES;
		return (NULL);
	}

	while ((dp = readdir64(pdirfp)) != NULL) {
		if (dp->d_name[0] == '.')
			continue;

		if (pkgnmchk(dp->d_name, pkg, 0))
			continue; /* ignore invalid SVR4 package names */

		if (ckinfo(dp->d_name, ckarch, ckvers))
			continue;

		/*
		 * Leave directory open in case user requests another
		 * instance.
		 */
		(void) strcpy(pkginst, dp->d_name);
		return (pkginst);
	}

	/*
	 * If we are searching the directory which contains info about
	 * installed packages, check the pre-svr4 directory for an instance
	 * and be sure it matches any version specification provided to us
	 */
	if (strcmp(pkgdir, get_PKGLOC()) == 0 && (ckarch == NULL)) {
		/* search for pre-SVR4 instance */
		if (pt = svr4inst(pkg))
			return (pt);
	}
	errno = ESRCH;
	/* close any file we might have open */
	(void) closedir(pdirfp);
	pdirfp = NULL;
	return (NULL);
}
示例#9
0
/*
 * This function confirms the presence of pkgmap and pkginfo and verifies
 * that the mandatory parameters are available in the environment.
 */
int
pkgenv(char *pkginst, char *p_pkginfo, char *p_pkgmap)
{
	FILE	*fp;
	char 	*value,
		path[PATH_MAX],
		param[MAX_PKG_PARAM_LENGTH];
	int	errflg;

	errflg = 0;
	if (access(p_pkgmap, 0)) {
		progerr(gettext(ERR_PKGMAP), p_pkgmap);
		return (1);
	}
	if ((fp = fopen(p_pkginfo, "r")) == NULL) {
		progerr(gettext(ERR_PKGINFO), p_pkginfo);
		return (1);
	}
	param[0] = '\0';
	while (value = fpkgparam(fp, param)) {
		if (strcmp("PATH", param))
			putparam(param, value);
		free(value);
		param[0] = '\0';
	}
	(void) fclose(fp);
	/*
	 * verify that required parameters are now present in
	 * the environment
	 */
	if ((pkgabrv = getenv("PKG")) == NULL) {
		progerr(gettext(ERR_NOPARAM), "PKG", path);
		errflg++;
	}
	if (pkgnmchk(pkgabrv, NULL, 0) || strchr(pkgabrv, '.')) {
		progerr(gettext(ERR_PKGBAD), pkgabrv);
		errflg++;
	}
	(void) snprintf(pkgwild, sizeof (pkgwild), "%s.*", pkgabrv);
	if ((pkgname = getenv("NAME")) == NULL) {
		progerr(gettext(ERR_NOPARAM), "NAME", path);
		errflg++;
	}
	if ((pkgarch = getenv("ARCH")) == NULL) {
		progerr(gettext(ERR_NOPARAM), "ARCH", path);
		errflg++;
	}
	if ((pkgvers = getenv("VERSION")) == NULL) {
		progerr(gettext(ERR_NOPARAM), "VERSION", path);
		errflg++;
	}
	if (getenv("CATEGORY") == NULL) {
		progerr(gettext(ERR_NOPARAM), "CATEGORY", path);
		errflg++;
	}
	/*
	 * verify consistency between PKG parameter and pkginst that
	 * was determined from the directory structure
	 */
	(void) snprintf(param, sizeof (param), "%s.*", pkgabrv);
	if (pkgnmchk(pkginst, param, 0)) {
		progerr(gettext(ERR_PKGMTCH), pkgabrv, pkginst);
		errflg++;
	}
	return (errflg);
}
示例#10
0
int
selpkg(char *p)
{
	static char *selected;
	char buf[80];
	char *root;
	register int i;

	if (p == NULL) {
		if (selected == NULL) {
			if (pkgcnt) {
				for (i = 0; i < pkgcnt; ++i) {
					/* bugid 1227628 */
					root = get_inst_root();
					if (root)
						(void) snprintf(buf,
						sizeof (buf),
						"%s/var/sadm/pkg/%s/pkginfo",
						root, pkg[i]);
					else
						(void) snprintf(buf,
						sizeof (buf),
						"/var/sadm/pkg/%s/pkginfo",
						pkg[i]);

					if (access(buf, F_OK))
						logerr(gettext(WRN_NOPKG),
							pkg[i]);
					else
						logerr(gettext(EMPTY_PKG),
							pkg[i]);
				}
			}
		} else {
			for (i = 0; i < pkgcnt; ++i) {
				if (selected[i] == NULL) {
					root = get_inst_root();
					if (root)
						(void) snprintf(buf,
						sizeof (buf),
						"%s/var/sadm/pkg/%s/pkginfo",
						root, pkg[i]);
					else
						(void) snprintf(buf,
						sizeof (buf),
						"/var/sadm/pkg/%s/pkginfo",
						pkg[i]);

					if (access(buf, F_OK))
						logerr(gettext(WRN_NOPKG),
							pkg[i]);
					else
						logerr(gettext(EMPTY_PKG),
							pkg[i]);
				}
			}
		}
		return (0); /* return value not important */
	} else if (pkgcnt == 0)
		return (1);
	else if (selected == NULL) {
		selected =
		    (char *)calloc((unsigned)(pkgcnt+1), sizeof (char));
		if (selected == NULL) {
			progerr(gettext(ERR_NOMEM), errno);
			exit(99);
			/*NOTREACHED*/
		}
	}

	for (i = 0; i < pkgcnt; ++i) {
		if (pkgnmchk(p, pkg[i], 0) == 0) {
			if (selected != NULL)
				selected[i] = 'b';
			return (1);
		}
	}
	return (0);
}
示例#11
0
文件: main.c 项目: belenix/belenixold
int
main(int argc, char *argv[])
{
	struct utsname utsbuf;
	struct statvfs64 svfsb;
	struct cfent	**eptlist;
	FILE	*fp;
	VFP_T	*vfp;
	int	i, c, n, eptnum, found,
		part, nparts, npkgs, objects;
	char	buf[MAX_PKG_PARAM_LENGTH];
	char	temp[MAX_PKG_PARAM_LENGTH];
	char	param[MAX_PKG_PARAM_LENGTH];
	char	*pt, *value, *pkginst, *tmpdir, *abi_sym_ptr,
		**cmdparam;
	char	*pkgname;
	char	*pkgvers;
	char	*pkgarch;
	char	*pkgcat;
	void	(*func)();
	time_t	clock;
	fsblkcnt_t	bsize = 0;
	fsblkcnt_t	frsize = 0;
	struct cl_attr	**allclass = NULL;
	struct cl_attr	**order;

	/* initialize locale environment */

	(void) setlocale(LC_ALL, "");

#if !defined(TEXT_DOMAIN)	/* Should be defined by cc -D */
#define	TEXT_DOMAIN "SYS_TEST"
#endif
	(void) textdomain(TEXT_DOMAIN);

	/* initialize program name */

	(void) set_prog_name(argv[0]);

	/* tell spmi zones interface how to access package output functions */

	z_set_output_functions(echo, echoDebug, progerr);

	func = sigset(SIGINT, trap);
	if (func != SIG_DFL)
		func = sigset(SIGINT, func);
	func = sigset(SIGHUP, trap);
	setmapmode(MAPBUILD);	/* variable binding */
	if (func != SIG_DFL)
		func = sigset(SIGHUP, func);

	environ = NULL;
	while ((c = getopt(argc, argv, "osnp:l:r:b:d:f:a:v:?")) != EOF) {
		switch (c) {
		    case 'n':
			nflag++;
			break;

		    case 's':
			sflag++;
			break;

		    case 'o':
			overwrite++;
			break;

		    case 'p':
			putparam("PSTAMP", optarg);
			break;

		    case 'l':
			llimit = atol(optarg);
			break;

		    case 'r':
			pt = strtok(optarg, " \t\n, ");
			n = 0;
			do {
				rootlist[n++] = flex_device(pt, 0);
				if (n >= NROOT) {
					progerr(gettext(ERR_NROOT), NROOT);
					quit(1);
				}
			} while (pt = strtok(NULL, " \t\n, "));
			rootlist[n] = NULL;
			break;

		    case 'b':
			basedir = optarg;
			break;

		    case 'f':
			protofile = optarg;
			break;

		    case 'd':
			device = flex_device(optarg, 1);
			break;

		    case 'a':
			putparam("ARCH", optarg);
			break;

		    case 'v':
			putparam("VERSION", optarg);
			break;

		    default:
			usage();
		}
	}

	/*
	 * Store command line variable assignments for later
	 * incorporation into the environment.
	 */
	cmdparam = &argv[optind];

	/* Skip past equates. */
	while (argv[optind] && strchr(argv[optind], '='))
		optind++;

	/* Confirm that the instance name is valid */
	if ((pkginst = argv[optind]) != NULL) {
		if (pkgnmchk(pkginst, "all", 0)) {
			progerr(gettext(ERR_PKGINST), pkginst);
			quit(1);
		}
		argv[optind++] = NULL;
	}
	if (optind != argc)
		usage();

	tmpdir = getenv("TMPDIR");
	if (tmpdir == NULL)
		tmpdir = P_tmpdir;

	/* bug id 4244631, not ABI compliant */
	abi_sym_ptr = getenv("PKG_NONABI_SYMLINKS");
	if (abi_sym_ptr && (strncasecmp(abi_sym_ptr, "TRUE", 4) == 0)) {
		set_nonABI_symlinks();
	}

	if (device == NULL) {
		device = devattr(SPOOLDEV, "pathname");
		if (device == NULL) {
			progerr(gettext(ERR_DEVICE), SPOOLDEV);
			exit(99);
		}
	}

	if (protofile == NULL) {
		if (access("prototype", 0) == 0)
			protofile = "prototype";
		else if (access("Prototype", 0) == 0)
			protofile = "Prototype";
		else {
			progerr(gettext(ERR_PROTOTYPE));
			quit(1);
		}
	}

	if (devtype(device, &pkgdev)) {
		progerr(gettext(ERR_BADDEV), device);
		quit(1);
	}
	if (pkgdev.norewind) {
		/* initialize datastream */
		progerr(gettext(ERR_DSTREAM), device);
		quit(1);
	}
	if (pkgdev.mount) {
		if (n = pkgmount(&pkgdev, NULL, 0, 0, 1))
			quit(n);
	}

	/*
	 * convert prototype file to a pkgmap, while locating
	 * package objects in the current environment
	 */
	t_pkgmap = tempnam(tmpdir, "tmpmap");
	if (t_pkgmap == NULL) {
		progerr(gettext(ERR_TEMP), errno);
		exit(99);
	}

	(void) fprintf(stderr, gettext(MSG_PROTOTYPE));
	if (n = mkpkgmap(t_pkgmap, protofile, cmdparam)) {
		progerr(gettext(ERR_BUILD));
		quit(1);
	}

	setmapmode(MAPNONE);	/* All appropriate variables are now bound */

	if (vfpOpen(&vfp, t_pkgmap, "r", VFP_NEEDNOW) != 0) {
		progerr(gettext(ERR_TEMP), errno);
		quit(99);
	}

	eptlist = procmap(vfp, 0, NULL);

	if (eptlist == NULL) {
		quit(1);
	}

	(void) vfpClose(&vfp);

	/* Validate the zone attributes in pkginfo, before creation */
	if (!valid_zone_attr(eptlist)) {
		progerr(ERR_PKGINFO_INVALID_OPTION_COMB);
		quit(1);
	}

	(void) fprintf(stderr, gettext(MSG_PKGINFO));
	pt = NULL;
	for (i = 0; eptlist[i]; i++) {
		ckmissing(eptlist[i]->path, eptlist[i]->ftype);
		if (eptlist[i]->ftype != 'i')
			continue;
		if (strcmp(eptlist[i]->path, "pkginfo") == 0)
			svept = eptlist[i];
	}
	if (svept == NULL) {
		progerr(gettext(ERR_NOPKGINFO));
		quit(99);
	}
	eptnum = i;

	/*
	 * process all parameters from the pkginfo file
	 * and place them in the execution environment
	 */

	if ((fp = fopen(svept->ainfo.local, "r")) == NULL) {
		progerr(gettext(ERR_RDPKGINFO), svept->ainfo.local);
		quit(99);
	}
	param[0] = '\0';
	while (value = fpkgparam(fp, param)) {
		if (getenv(param) == NULL)
			putparam(param, value);
		free((void *)value);
		param[0] = '\0';
	}
	(void) fclose(fp);

	/* add command line variables */
	while (*cmdparam && (value = strchr(*cmdparam, '=')) != NULL) {
		*value = NULL;	/* terminate the parameter */
		value++;	/* value is now the value (not '=') */
		putparam(*cmdparam++, value);  /* store it in environ */
	}

	/* make sure parameters are valid */
	(void) time(&clock);
	if (pt = getenv("PKG")) {
		if (pkgnmchk(pt, NULL, 0) || strchr(pt, '.')) {
			progerr(gettext(ERR_PKGABRV), pt);
			quit(1);
		}
		if (pkginst == NULL)
			pkginst = pt;
	} else {
		progerr(gettext(ERR_NOPARAM), "PKG", svept->path);
		quit(1);
	}
	/*
	 * verify consistency between PKG parameter and pkginst
	 */
	(void) snprintf(param, sizeof (param), "%s.*", pt);
	if (pkgnmchk(pkginst, param, 0)) {
		progerr(gettext(ERR_PKGMTCH), pt, pkginst);
		quit(1);
	}

	/*
	 * *********************************************************************
	 * this feature is removed starting with Solaris 10 - there is no built
	 * in list of packages that should be run "the old way"
	 * *********************************************************************
	 */

#ifdef	ALLOW_EXCEPTION_PKG_LIST
	/* Until 2.9, set it from the execption list */
	if (exception_pkg(pkginst, LINK))
		set_nonABI_symlinks();
#endif

	if ((pkgname = getenv("NAME")) == NULL) {
		progerr(gettext(ERR_NOPARAM), "NAME", svept->path);
		quit(1);
	}
	if (ckparam("NAME", pkgname))
		quit(1);
	if ((pkgvers = getenv("VERSION")) == NULL) {
		/* XXX - I18n */
		/* LINTED do not use cftime(); use strftime instead */
		(void) cftime(buf, "\045m/\045d/\045Y", &clock);
		(void) snprintf(temp, sizeof (temp),
			gettext("Dev Release %s"), buf);
		putparam("VERSION", temp);
		pkgvers = getenv("VERSION");
		logerr(gettext(WRN_SETPARAM), "VERSION", temp);
	}
	if (ckparam("VERSION", pkgvers))
		quit(1);
	if ((pkgarch = getenv("ARCH")) == NULL) {
		(void) uname(&utsbuf);
		putparam("ARCH", utsbuf.machine);
		pkgarch = getenv("ARCH");
		logerr(gettext(WRN_SETPARAM), "ARCH", utsbuf.machine);
	}
	if (ckparam("ARCH", pkgarch))
		quit(1);
	if (getenv("PSTAMP") == NULL) {
		/* use octal value of '%' to fight sccs expansion */
		/* XXX - I18n */
		/* LINTED do not use cftime(); use strftime instead */
		(void) cftime(buf, "\045Y\045m\045d\045H\045M\045S", &clock);
		(void) uname(&utsbuf);
		(void) snprintf(temp, sizeof (temp), "%s%s",
			utsbuf.nodename, buf);
		putparam("PSTAMP", temp);
		logerr(gettext(WRN_SETPARAM), "PSTAMP", temp);
	}
	if ((pkgcat = getenv("CATEGORY")) == NULL) {
		progerr(gettext(ERR_NOPARAM), "CATEGORY", svept->path);
		quit(1);
	}
	if (ckparam("CATEGORY", pkgcat))
		quit(1);

	/*
	 * warn user of classes listed in package which do
	 * not appear in CLASSES variable in pkginfo file
	 */
	objects = 0;
	for (i = 0; eptlist[i]; i++) {
		if (eptlist[i]->ftype != 'i') {
			objects++;
			addlist(&allclass, eptlist[i]->pkg_class);
		}
	}

	if ((pt = getenv("CLASSES")) == NULL) {
		if (allclass && *allclass) {
			cl_setl(allclass);
			cl_putl("CLASSES", allclass);
			logerr(gettext(WRN_SETPARAM), "CLASSES",
			    getenv("CLASSES"));
		}
	} else {
		cl_sets(qstrdup(pt));
		if (allclass && *allclass) {
			for (i = 0; allclass[i]; i++) {
				found = 0;
				if (cl_idx(allclass[i]->name) != -1) {
					found++;
					break;
				}
				if (!found) {
					logerr(gettext(WRN_CLASSES),
					    (char *)allclass[i]);
				}
			}
		}
	}

	(void) fprintf(stderr, gettext(MSG_VOLUMIZE), objects);
	order = (struct cl_attr **)0;
	if (pt = getenv("ORDER")) {
		pt = qstrdup(pt);
		(void) setlist(&order, pt);
		cl_putl("ORDER", order);
	}

	/* stat the intended output filesystem to get blocking information */
	if (pkgdev.dirname == NULL) {
		progerr(gettext(ERR_WHATVFS), device);
		quit(99);
	}
	if (statvfs64(pkgdev.dirname, &svfsb)) {
		progerr(gettext(ERR_STATVFS), pkgdev.dirname);
		quit(99);
	}

	if (bsize == 0) {
		bsize = svfsb.f_bsize;
	}
	if (frsize == 0) {
		frsize = svfsb.f_frsize;
	}
	if (limit == 0)
		/*
		 * bavail is in terms of fragment size blocks - change
		 * to 512 byte blocks
		 */
		limit = (((long)frsize > 0) ?
			howmany(frsize, DEV_BSIZE) :
			howmany(bsize, DEV_BSIZE)) * svfsb.f_bavail;
	if (ilimit == 0) {
		ilimit = (svfsb.f_favail > 0) ?
		    svfsb.f_favail : svfsb.f_ffree;
	}

	nparts = splpkgmap(eptlist, eptnum, (char **)order, bsize, frsize,
	    &limit, &ilimit, &llimit);

	if (nparts <= 0) {
		progerr(gettext(ERR_SPLIT));
		quit(1);
	}

	if (nflag) {
		for (i = 0; eptlist[i]; i++)
			(void) ppkgmap(eptlist[i], stdout);
		exit(0);
		/*NOTREACHED*/
	}

	(void) snprintf(pkgloc, sizeof (pkgloc), "%s/%s",
			pkgdev.dirname, pkginst);
	if (!isdir(pkgloc) && !overwrite) {
		progerr(gettext(ERR_OVERWRITE), pkgloc);
		quit(1);
	}

	/* output all environment install parameters */
	t_pkginfo = tempnam(tmpdir, "pkginfo");
	if ((fp = fopen(t_pkginfo, "w")) == NULL) {
		progerr(gettext(ERR_TEMP), errno);
		exit(99);
	}
	for (i = 0; environ[i]; i++) {
		if (isupper(*environ[i])) {
			(void) fputs(environ[i], fp);
			(void) fputc('\n', fp);
		}
	}
	(void) fclose(fp);

	started++;
	(void) rrmdir(pkgloc);
	if (mkdir(pkgloc, 0755)) {
		progerr(gettext(ERR_MKDIR), pkgloc);
		quit(1);
	}

	/* determine how many packages already reside on the medium */
	pkgdir = pkgdev.dirname;
	npkgs = 0;
	while (pt = fpkginst("all", NULL, NULL))
		npkgs++;
	(void) fpkginst(NULL); /* free resource usage */

	if (nparts > 1) {
		if (pkgdev.mount && npkgs) {
			progerr(gettext(ERR_ONEVOL));
			quit(1);
		}
	}

	/*
	 *  update pkgmap entry for pkginfo file, since it may
	 *  have changed due to command line or failure to
	 *  specify all neccessary parameters
	 */
	for (i = 0; eptlist[i]; i++) {
		if (eptlist[i]->ftype != 'i')
			continue;
		if (strcmp(eptlist[i]->path, "pkginfo") == 0) {
			svept = eptlist[i];
			svept->ftype = '?';
			svept->ainfo.local = t_pkginfo;
			(void) cverify(0, &svept->ftype, t_pkginfo,
				&svept->cinfo, 1);
			svept->ftype = 'i';
			break;
		}
	}

	if (nparts > 1)
		(void) fprintf(stderr, gettext(MSG_PACKAGEM), nparts);
	else
		(void) fprintf(stderr, gettext(MSG_PACKAGE1));

	for (part = 1; part <= nparts; part++) {
		if ((part > 1) && pkgdev.mount) {
			if (pkgumount(&pkgdev)) {
				progerr(gettext(ERR_UMOUNT), pkgdev.mount);
				quit(99);
			}
			if (n = pkgmount(&pkgdev, NULL, part, nparts, 1))
				quit(n);
			(void) rrmdir(pkgloc);
			if (mkdir(pkgloc, 0555)) {
				progerr(gettext(ERR_MKDIR), pkgloc);
				quit(99);
			}
		}
		outvol(eptlist, eptnum, part, nparts);

		/* Validate (as much as possible) the control scripts. */
		if (part == 1) {
			char inst_path[PATH_MAX];

			(void) fprintf(stderr, gettext(MSG_VALSCRIPTS));
			(void) snprintf(inst_path, sizeof (inst_path),
					"%s/install", pkgloc);
			checkscripts(inst_path, 0);
		}
	}

	quit(0);
	/*NOTREACHED*/
}