コード例 #1
0
ファイル: main.c プロジェクト: drscream/illumos-joyent
void
quit(int retcode)
{
	(void) signal(SIGINT, SIG_IGN);
	(void) signal(SIGHUP, SIG_IGN);
	(void) ds_close(1);
	(void) pkghead(NULL);
	exit(retcode);
}
コード例 #2
0
ファイル: main.c プロジェクト: AlfredArouna/illumos-gate
void
quit(int retcode)
{
	PKG_ERR	*err;

	err = pkgerr_new();
	(void) signal(SIGINT, SIG_IGN);
	(void) signal(SIGHUP, SIG_IGN);
	(void) ds_close(1);
	(void) pkghead(NULL);
	if (keystore != NULL) {
		(void) close_keystore(err, keystore, NULL);
		pkgerr_free(err);
	}
	exit(retcode);
}
コード例 #3
0
ファイル: pkginfo.c プロジェクト: Sunshine-OS/pkg-gate
int
main(int argc, char **argv)
{
	int	c;

	pkgdir = NULL;
	setErrstr(NULL);

	/* initialize locale mechanism */

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

	/* determine 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);

	/* establish installation root directory */

	if (!set_inst_root(getenv("PKG_INSTALL_ROOT"))) {
		progerr(gettext(ERR_ROOT_SET));
		exit(1);
	}

	while ((c = getopt(argc, argv, "LNR:xv:a:d:qrpilc:?")) != EOF) {
		switch (c) {
		    case 'v':
			ckvers = optarg;
			break;

		    case 'a':
			ckarch = optarg;
			break;

		    case 'd':
			/* -d could specify stream or mountable device */
			device = flex_device(optarg, 1);
			break;

		    case 'q':
			qflag++;
			break;

		    case 'i':
			iflag = 1;
			if (pflag > 0)
				usage();
			pflag = 0;
			break;

		    case 'p':
			pflag = 1;
			if (iflag > 0)
				usage();
			iflag = 0;
			break;

		    case 'N':
			Nflag++;
			break;

		    case 'L':
			if (xflag || lflag || rflag) {
				progerr(gettext(ERR_INCOMP0));
				usage();
			}
			Lflag++;
			break;

		    case 'l':
			if (xflag || rflag) {
				progerr(gettext(ERR_INCOMP1));
				usage();
			}
			lflag++;
			break;

		    case 'x':
			/* bug # 1081606 */
			if (lflag || rflag) {
				progerr(gettext(ERR_INCOMP2));
				usage();
			}
			xflag++;
			break;

		    case 'r':
			if (lflag || xflag || Lflag) {
				progerr(gettext(ERR_INCOMP0));
				usage();
			}
			rflag++;
			break;

		    case 'c':
			ckcatg[ncatg++] = strtok(optarg, " \t\n, ");
			while (ckcatg[ncatg] = strtok(NULL, " \t\n, "))
				ncatg++;
			break;

		/* added for newroot functions */
		    case 'R':
			if (!set_inst_root(optarg)) {
				progerr(gettext(ERR_ROOT_CMD));
				exit(1);
			}
			break;

		    default:
			usage();
		}
	}

	/*
	 * implement the newroot option
	 */
	set_PKGpaths(get_inst_root());	/* set up /var... directories */

	/*
	 * Open the install DB, if one exists.
	 */

	pkg = &argv[optind];
	pkgcnt = (argc - optind);

	if (pkg[0] && strcmp(pkg[0], "all") == 0) {
		pkgcnt = 0;
		pkg[0] = NULL;
	}

	if (pkgdir == NULL)
		pkgdir = get_PKGLOC(); 	/* we need this later */

	/* convert device appropriately */
	if (pkghead(device))
		exit(1);

	/*
	 * If we are to inspect a spooled package we are only interested in
	 * the pkginfo file in the spooled pkg so we skip any Reg 4 DB
	 * lookups and use the old algorithm. We have a spooled pkg if
	 * device is not NULL.
	 */


	look_for_installed();

	if (lflag && strcmp(pkgdir, get_PKGLOC()) == 0) {
		/* look at contents file */
		(void) snprintf(contents, sizeof (contents),
		    "%s/contents", get_PKGADM());
		rdcontents();

	}

	/*
	 * If we are to inspect a spooled package we are only interested in
	 * the pkginfo file in the spooled pkg so we skip any Reg 4 DB
	 * lookups and use the old algorithm. We have a spooled pkg if
	 * device is not NULL.
	 */

	report();

	(void) pkghead(NULL);
	exit(errflg ? 1 : 0);
	/*NOTREACHED*/
#ifdef lint
	return (0);
#endif	/* lint */
}