/*
* 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 2006 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 <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <valtools.h>
#include <locale.h>
#include <libintl.h>
#include <pkginfo.h>
#include "install.h"
#include <pkglib.h>
#include "libadm.h"
#include "libinst.h"
#include "pkginstall.h"
#include "messages.h"
extern int maxinst;
static char *nextinst(void);
/*
* This returns the correct package instance based on how many packages are
* already installed. If there are none (npkgs == 0), it just returns the
* package abbreviation. Otherwise, it interacts with the user (or reads the
* admin file) to determine if we should overwrite an instance which is
* already installed, or possibly install a new instance of this package
*/
char *
{
char *inst;
char *sameinst;
int i;
int nsamearch;
int samearch;
/* entry debugging info */
same_pkg = 0;
/*
* If this is the first instance of the package, it's called the by
* the package abbreviation.
*/
if (npkgs == 0) {
return (pkgabrv);
}
/*
* this package is already installed; determine how to handle the
* new instance of the package to install
*/
/*
* new instance is required, or quit if not new
*/
if (a_preinstallCheck == B_FALSE) {
} else {
}
quit(4);
}
/*
* package already installed and new instance not required
* see if updating the same instance of the package
*/
for (i = 0; i < npkgs; i++) {
samearch = i;
nsamearch++;
}
}
}
if (sameinst) {
/* same instance of package */
if (a_preinstallCheck == B_FALSE) {
} else {
}
same_pkg++;
(*updatingExisting)++;
return (inst);
}
/* not the same instance of the package */
if (npkgs == 1) {
samearch = 0; /* use only package we know about */
} else if (nsamearch != 1) {
/*
* more than one instance of the same ARCH is already
* installed on this machine
*/
if (a_preinstallCheck == B_FALSE) {
} else {
"install-ovewrite=true\n");
}
quit(4);
}
(*updatingExisting)++;
return (inst);
}
/* too many instances */
if (a_preinstallCheck == B_FALSE) {
} else {
"install-too-many-instances=true\n");
}
quit(4);
}
return (inst);
}
if (a_preinstallCheck == B_FALSE) {
if (echoGetFlag() == B_FALSE) {
quit(5);
}
} else {
}
return (inst);
}
(*updatingExisting)++;
return (inst);
}
/*
* This informs the caller whether the package in question is the same
* version and architecture as an installed package of the same name.
*/
int
is_samepkg(void) {
return (same_pkg);
}
static char *
nextinst(void)
{
int n;
n = 2; /* requirements say start at 2 */
"%s.%d", pkgabrv, n++);
}
return (newinst);
}
static char *
{
char *inst;
int i;
int n;
/*
* the user may choose to install a completely new
* instance of this package
*/
if (n != 0) {
quit(n);
}
return ("new");
}
}
for (i = 0; i < npkgs; i++) {
progerr("no memory");
quit(99);
}
}
if (npkgs == 1) {
quit(n);
quit(3);
} else {
quit(n);
}
return (newinst);
}