main.c revision 5c51f1241dbbdf2656d0e10011981411ed0c9673
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#include <locale.h>
#include <libintl.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pkgtrans.h>
#include <pkglib.h>
#include <pkglocs.h>
#include <libadm.h>
#include <libinst.h>
static int options;
static void usage(void);
#define PASSWD_CMDLINE \
"## WARNING: USING <%s> MAKES PASSWORD " \
"VISIBLE TO ALL USERS."
#define PASSPHRASE_PROMPT "Enter keystore password:"
#define KEYSTORE_OPEN "Retrieving signing certificates from keystore <%s>"
#define PARAM_LEN "Parameter <%s> too long"
int
{
int c;
void (*func)();
extern char *optarg;
extern int optind;
char *keystore_alias = NULL;
char *keystore_file = NULL;
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
#define TEXT_DOMAIN "SYS_TEST"
#endif
(void) textdomain(TEXT_DOMAIN);
(void) set_prog_name(argv[0]);
switch (c) {
case 'n':
break;
case 'i':
options |= PT_INFO_ONLY;
break;
case 'o':
options |= PT_OVERWRITE;
break;
case 's':
options |= PT_ODTSTREAM;
break;
case 'g':
/* this should eventually be a PT_ option */
create_sig = B_TRUE;
break;
case 'k':
break;
case 'a':
break;
case 'P':
/*
* passwords on the command line are highly
* insecure. complain.
*/
}
break;
default:
usage();
return (1);
}
}
#ifndef SUNOS41
#endif
usage();
return (1);
}
if (create_sig) {
sec_init();
err = pkgerr_new();
/* figure out which keystore to use */
if (keystore_file == NULL) {
if (geteuid() == 0) {
/* we are superuser, so use their keystore */
} else {
/*
* not superuser, but no home dir, so
* use superuser's keystore
*/
} else {
"$HOME");
quit(1);
}
}
}
}
/* open keystore for reading */
quit(1);
}
} else {
/* no signature, so don't use a keystore */
}
if (create_sig) {
/* close keystore */
quit(1);
}
}
/*NOTREACHED*/
}
void
{
err = pkgerr_new();
(void) ds_close(1);
}
}
static void
{
quit(3);
}
quit(1);
}
static void
usage(void)
{
gettext("usage: %s [-ionsg] [-k keystore] " \
"[-a alias] [-P password] srcdev dstdev [pkg [pkg...]]\n"),
get_prog_name());
}