Mercurial > illumos > illumos-gate
changeset 13240:74a59768760e
403 remove support for SVR3 packaging
Reviewed by: a.eremin@nexenta.com
Reviewed by: peter.tribble@gmail.com
Approved by: gwr@nexenta.com
line wrap: on
line diff
--- a/usr/src/cmd/svr4pkg/hdrs/libadm.h Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/hdrs/libadm.h Tue Nov 09 10:20:47 2010 -0800 @@ -262,7 +262,6 @@ extern char *pkgparam __P((char *pkg, char *param)); extern void set_PKGpaths __P((char *path)); extern char *get_PKGLOC __P((void)); -extern char *get_PKGOLD __P((void)); extern char *get_PKGADM __P((void)); extern void set_PKGADM(char *newpath); extern void set_PKGLOC(char *newpath);
--- a/usr/src/cmd/svr4pkg/hdrs/libinst.h Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/hdrs/libinst.h Tue Nov 09 10:20:47 2010 -0800 @@ -318,11 +318,6 @@ extern boolean_t echoSetFlag __P((boolean_t a_debugFlag)); extern boolean_t echoDebugSetFlag __P((boolean_t a_debugFlag)); -/* psvr4ck.c */ -extern void psvr4cnflct __P((void)); -extern void psvr4mail __P((char *list, char *msg, int retcode, char *pkg)); -extern void psvr4pkg __P((char **ppkg)); - /* ptext.c */ /*PRINTFLIKE2*/ extern void ptext __P((FILE *fp, char *fmt, ...));
--- a/usr/src/cmd/svr4pkg/hdrs/messages.h Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/hdrs/messages.h Tue Nov 09 10:20:47 2010 -0800 @@ -515,7 +515,6 @@ #define ERR_MNT_NOROOT gettext("get_mntinfo() identified <%s> as root file system instead of <%s> errno %d: %s") #define ERR_MODTIM gettext("unable to reset access/modification time of <%s>: (%d) %s") #define ERR_NEWBD gettext("%s is already installed at %s. Duplicate installation attempted at %s.") -#define ERR_NOCOPY gettext("unable to create copy of UNINSTALL script in <%s>") #define ERR_NODIR gettext("unable to create directory <%s>: (%d) %s") #define ERR_NORESPCOPY gettext("unable to copy response file <%s> to <%s>") #define ERR_NODEVICE gettext("unable to determine device to install from") @@ -718,13 +717,10 @@ #define MSG_DOREMOVE_INTERRUPTED gettext("## interrupted: package <%s> not installed") #define MSG_DOREMOVE_INTERRUPTED_B4_Z gettext("## interrupted: package <%s> not removed") #define MSG_DRYRUN_DONE gettext("Dryrun complete.") -#define MSG_EXE_INSTALL_SCRIPT gettext("## Executing INSTALL script provided by package") -#define MSG_FAIL gettext("\n## Pre-SVR4 package reports failed installation.") #define MSG_HRDLINK gettext("%s <linked pathname>") #define MSG_IMPDIR gettext("%s <implied directory>") #define MSG_INSERT_VOL gettext("Insert %v into %p.") #define MSG_INSTALLING_PKG_IN_GZ gettext("## Installing package <%s> in global zone") -#define MSG_INSTALLING_PSVR4 gettext("*** Installing Pre-SVR4 Package ***") #define MSG_INSTALL_INTERRUPT_B4_ZONES gettext("## Interrupted: package <%s> not installed in any non-global zones") #define MSG_INSTALL_PKG_IN_ZONE gettext("## Installing package <%s> in zone <%s>") #define MSG_INST_MANY gettext(" %d package pathnames are already properly installed.") @@ -737,7 +733,6 @@ #define MSG_LOG_ERROR gettext("ERROR") #define MSG_LOG_WARNING gettext("WARNING") #define MSG_LOG_DEBUG gettext("DEBUG") -#define MSG_MAIL gettext("An attempt to install the <%s> pre-SVR4 package on <%s> completed with exit status <%d>.") #define MSG_MANMOUNT gettext("Assuming mounts have been provided.") #define MSG_MORETODO gettext("\nThere are %d more packages to be removed.") #define MSG_MORE_INST gettext("\nThere are %d more packages to be installed.") @@ -818,7 +813,6 @@ #define MSG_SHIGN gettext("%s <conflicting pathname not installed>") #define MSG_SKIPPING_ZONE_NOT_RUNNABLE gettext("## Not processing zone <%s>: the zone is not running and cannot be booted") #define MSG_SLINK gettext("%s <symbolic link>") -#define MSG_SUCCEED gettext("\n## Pre-SVR4 package reports successful installation.") #define MSG_SUSPEND_ADD gettext("Installation of <%s> has been suspended.") #define MSG_SUSPEND_RM gettext("Removals of <%s> has been suspended.") #define MSG_UGID gettext("%s <installed with setuid/setgid bits reset>")
--- a/usr/src/cmd/svr4pkg/libinst/Makefile Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/libinst/Makefile Tue Nov 09 10:20:47 2010 -0800 @@ -30,7 +30,7 @@ finalck.o findscripts.o fixpath.o flex_dev.o \ isreloc.o lockinst.o mntinfo.o nblk.o \ ocfile.o pathdup.o pkgdbmerg.o procmap.o \ - pkgobjmap.o psvr4ck.o ptext.o putparam.o \ + pkgobjmap.o ptext.o putparam.o \ qreason.o qstrdup.o setadmin.o setlist.o \ srcpath.o scriptvfy.o stub.o doulimit.o \ dryrun.o listmgr.o is_local_host.o cvtpath.o \
--- a/usr/src/cmd/svr4pkg/libinst/dockdeps.c Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/libinst/dockdeps.c Tue Nov 09 10:20:47 2010 -0800 @@ -154,8 +154,7 @@ inst = fpkginst(wabbrev, alist[i], vlist[i]); if (inst && (pkginfo(&info, inst, NULL, NULL) == 0)) { pkgexist++; - if ((info.status == PI_INSTALLED) || - (info.status == PI_PRESVR4)) + if (info.status == PI_INSTALLED) pkgokay++; } } while (++i < nlist);
--- a/usr/src/cmd/svr4pkg/libinst/psvr4ck.c Mon Nov 08 21:52:02 2010 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,417 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <dirent.h> -#include <ctype.h> -#include <sys/utsname.h> -#include <locale.h> -#include <libintl.h> -#include <pkglib.h> -#include <libinst.h> -#include <libadm.h> - -#ifdef MAILCMD -#undef MAILCMD -#define MAILCMD "/bin/mail" -#endif /* MAILCMD */ -#define ERR_MAIL "unable to send electronic mail notification" -#define ERR_OVERWRITE "unable to determine overwrite list" -#define ERR_PIPE "unable to open pipe to process <%s>" -#define ASK_CONT "Do you want to continue processing this package" -#define MSG_CONFLICT "The following files are currently being used by " \ - "other packages on the system, and may be " \ - "overwritten by the installation of this pre-SVR4 " \ - "package:" -#define HLP_CONFLICT "If you choose to continue installation, it is " \ - "possible that you will overwrite files which are " \ - "part of another package that is already installed " \ - "on the system. If you want to assure that the " \ - "files are not overwritten, answer 'n' to stop the " \ - "installation process." -#define MSG_NOTVER "The media being processed is in an old (pre-SVR4) " \ - "format and it is not possible to verify that the " \ - "inserted media belongs to the <%s> package." -#define HLP_NOTVER "If you choose to continue installation, it is " \ - "possible that you will install the wrong package. " \ - "If you are sure the media being installed contains " \ - "the package you wish to install, answer 'y' to " \ - "continue the installation process." -#define MSG_CONFIRM "The media being processed is in an old (pre-SVR4) " \ - "format and appears to be part of the <%s> package." -#define HLP_CONFIRM "The installation of older-style (pre-SVR4) packages " \ - "is, in general, not as robust as installing " \ - "standard packages. Older packages may attempt " \ - "things during installation which overwrite existing " \ - "files or otherwise modify the system without your " \ - "approval. If you wish to allow installation of " \ - "identified pre-SVR4 package, answer 'y' to continue " \ - "the installation process." - -static char *Rlist[] = { - "/install/install/Rlist", - "/install/install/RLIST", - "/install/install/rlist", - NULL -}; - -static char ckcmd[] = "/usr/sbin/pkgchk -L -i %s"; - -/* - * Remove the list & both #defines below for on1095 -- JST - * Further, please note : - * This is NOT a database (Oh, yeah it looks like it, but it isn't). For that - * reason these are in alphabetical order. Any additions must maintain this - * order and must not increase the list length beyond 120. - */ -#define TREEHEIGHT 7 -#define TREEFILL 4 /* number of fill entries per side */ - -#ifdef ALLOW_EXCEPTION_PKG_LIST -static char *x_pkg[] = -{ - "AAAA1", /* fill to avoid constraint tests in loop */ - "AAAA2", - "AAAA3", - "AAAA4", - /* '+' means packages known to be non-compliant */ - "SPROcpl", /* + bugID 1133962 */ - "SPROlklnt", /* + SW Lock_Lint */ - "SPROltool", /* + SW Loop Profiling Tools */ - "SPROssbd", /* + SW ssbd component for SC 3.0 */ - "SPROtha", /* + Performance Analzyer */ - "SUNW3270c", /* + SunLink Client 3270 */ - "SUNW3270g", /* SunLink CG3270 8.0 */ - "SUNW3270t", /* + SunLink TN3270*Server */ - "SUNW86nma", /* SunNet Manager Core Tools for x86 */ - "SUNW86nmc", /* SunNet Manager Agents & Libraries for x86 */ - "SUNW86nmp", /* SunNet Manager SNMP daemon for x86 */ - "SUNWabcg", /* SunLink CG320 8.0 User's Guide */ - "SUNWbf", /* + 2.0 FDDI/S Beta */ - "SUNWbsccu", /* SunLink BSC Core Util */ - "SUNWbscdr", /* SunLink BSC Drivers */ - "SUNWcosiA", /* OSI Core Stack Kernel Files 1 */ - "SUNWcosiC", /* Stack Mgmnt Utilities 2 */ - "SUNWcosia", /* + OSI Core Stack Kernel Files */ - "SUNWcosib", /* OSI Core Stack Configuration Files */ - "SUNWcosic", /* OSI Core Stack Utilities */ - "SUNWcosid", /* OSI Core Stack Development Kit (new pakage) */ - "SUNWcosij", /* OSI Core Stack User Space Utilities */ - "SUNWdniCU", /* + SunLink DNI Core Utilities 8.0 */ - "SUNWdniKR", /* + SunLink DNI Kernel 8.0 */ - "SUNWdniMA", /* SunLink DNI Mail Agent 8.0 */ - "SUNWflex", /* + FLEX LM DEVEL PKG */ - "SUNWftama", /* OSI FTAM Configuration Files */ - "SUNWftamb", /* OSI FTAM Executable, Libraries and Man Pages */ - "SUNWhsis", /* SunConnect HSI/S */ - "SUNWjaCL", /* + Frances Ho confirms for SUNpics */ - "SUNWjncmt", /* SunNet Manager Core Tools(Japan) */ - "SUNWjnmag", /* SunNet Manager Agents & Libraries (Japan) */ - "SUNWjnmpd", /* SunNet Manager SNMP daemon(Japan) */ - "SUNWlicsw", /* + FLEXlm */ - "SUNWlit", /* STE LIC INSTALL TOOL */ - "SUNWllc2a", /* X.25 LLC2 KRNL MOD, INCLDS FL */ - "SUNWllc2b", /* X.25 USR PROG, MAN PAGES */ - "SUNWmd", /* + Suhas Patil request 1994-07-12 */ - "SUNWmhs1a", /* MHS Message Transfer Agent Configuration Files */ - "SUNWmhs1b", /* MHS Message Transfer Agent Executable and Man Pgs */ - "SUNWomgta", /* OSI Mgmnt Configuration Files */ - "SUNWomgtb", /* OSI Mgmnt Configuration Files */ - "SUNWomgtc", /* OSI Mgmnt SunNet Mgr Proxy Agent Executable Files */ - "SUNWomgtd", /* OSI Mgmnt SunNet Mgr Proxy Agent Config Files */ - "SUNWp2pnm", /* SunLink SNA Peer-to-Peer Network Management */ - "SUNWprsto", /* + Varun Mehta request 1994-07-11 */ - "SUNWrup2p", /* Sunlink SNA Peer-to-Peer Run Time Environment */ - "SUNWs3270", /* + SunLink SNA3270/RJE */ - "SUNWscmmd", /* SunLink Comm Daemon */ - "SUNWsdlc", /* SunLink IBM SDLC */ - "SUNWsm-ml", /* ShowMe Motif Libs */ - "SUNWsm-ol", /* ShowMe Online help */ - "SUNWsmCmg", - "SUNWsmap", /* SunLink Mapper */ - "SUNWsmaud", /* ShowMe Audio */ - "SUNWsmsha", /* ShowMe SharedApp */ - "SUNWsmvid", /* ShowMe Video */ - "SUNWsmwtb", /* ShowMe Whiteboard */ - "SUNWsnmag", /* + Steve Wong request 1994-02-15 */ - "SUNWsnmct", /* + Steve Wong request 1994-02-15 */ - "SUNWsnmja", /* SunNet Manager 2.2 Japanese feature */ - "SUNWsnmpd", /* SunNet Manager SNMP daemon */ - "SUNWsnp2p", /* + SunLink SNA P-to-P */ - "SUNWspii", /* 1.0 SPARCprinterII */ - "SUNWsrjec", /* + SunLink Client SNA RJE */ - "SUNWsteCL", /* + Frances Ho confirms for SUNPics */ - "SUNWsteNP", /* 2.5 NeWSprint */ - "SUNWte320", /* + TE320 8.0 */ - "SUNWtris", /* SunConnect TRI/S */ - "SUNWvtcfg", /* OSI Virtual Terminal Configuration Files */ - "SUNWvtexe", /* OSI Virtual Terminal User Program and Man Pages */ - "SUNWx25a", /* + X.25 KRNL MOD, INCLDS FLS */ - "SUNWx25b", /* + X.25 USR PROG AND LIB */ - "zzzz1", /* fill to avoid constraint tests in loop */ - "zzzz2", - "zzzz3", - "zzzz4" -}; -#endif - -/* - * Structure to hold the list of pkg names that are known to not behave - * properly when sym link destinations are not followed. - */ - -#ifdef ALLOW_EXCEPTION_PKG_LIST -static char *x_pkg_link[] = -{ - "AAAA1", /* fill to avoid constraint tests in loop */ - "AAAA2", - "AAAA3", - "AAAA4", - /* '+' means packages known to be non-compliant */ - "SUNWixfta", - "SUNWixsna", - "zzzz1", /* fill to avoid constraint tests in loop */ - "zzzz2", - "zzzz3", - "zzzz4" -}; -#endif - -/* - * This function determines if the package being added is a known old-style - * package which requires user interaction during procedure scripts. It is - * to be removed for on1095. -- JST - * It also is used for the determining if a pkg is known to have symlinks - * that need to be processed the old way. - */ - -#ifdef ALLOW_EXCEPTION_PKG_LIST -int -exception_pkg(char *pkginst, int pkg_list) -{ - int retvalue = 0; - int list_sz; - int list_cntr; /* starting point for binary search */ - register int pos; /* current position */ - register int level; /* current height in the tree */ - register int incr; /* increment for step */ - int result; /* result of strcmp */ - register char **x_ptr = x_pkg; - register char **x_ptr_link = x_pkg_link; - char *pkgend; - char *pkgname = strdup(pkginst); - - /* - * NOTE : If more structures need to be defined the following if - * statement needs to be revised to handle multiple flags - */ - - if (pkg_list) - list_sz = (sizeof (x_pkg_link) / sizeof (char *)); - else - list_sz = (sizeof (x_pkg) / sizeof (char *)); - - /* - * NOTE : shifts are used instead of integer division to save - * time. Numerous other checks are omitted also. This tree - * contains double nodes but is entirely connected and closed. - */ - - list_cntr = list_sz >> 1; - incr = list_cntr - TREEFILL; - - pkgend = strchr(pkgname, '.'); - - if (pkgend) - *pkgend = '\0'; /* terminate the instance to a name */ - - for (level = TREEHEIGHT, /* start at the top level */ - pos = list_cntr; /* ... in the middle */ - level; /* for as long as we're in the tree */ - level--, pos += (result > 0) ? incr : -incr) { - - if (pkg_list) - result = strcmp(pkgname, *(x_ptr_link + pos)); - else - result = strcmp(pkgname, *(x_ptr + pos)); - - if (result == 0) { - retvalue = 1; - break; - } - - incr = (incr & 0x0001) | (incr >> 1); /* halve it & rnd up */ - } - - free(pkgname); - - return (retvalue); -} - -#endif - -void -psvr4pkg(char **ppkg) -{ - struct dirent *drp; - DIR *dirfp; - char *pt; - int n; - char ans[MAX_INPUT], path[PATH_MAX]; - - if (*ppkg) { - (void) snprintf(path, sizeof (path), - "/install/new/usr/options/%s.name", - *ppkg); - if (access(path, 0)) { - ptext(stderr, gettext(MSG_NOTVER), *ppkg); - if (n = ckyorn(ans, NULL, NULL, gettext(HLP_NOTVER), - gettext(ASK_CONT))) - quit(n); - if (strchr("yY", *ans) == NULL) - quit(3); - } - return; - } - - if (dirfp = opendir("/install/new/usr/options")) { - while (drp = readdir(dirfp)) { - if (drp->d_name[0] == '.') - continue; - if (pt = strchr(drp->d_name, '.')) { - if (strcmp(pt, ".name") == 0) { - *pt = '\0'; - *ppkg = qstrdup(drp->d_name); - break; - } - } - } - (void) closedir(dirfp); - } - - if (*ppkg) { - ptext(stderr, gettext(MSG_CONFIRM), *ppkg); - if (n = ckyorn(ans, NULL, NULL, gettext(HLP_CONFIRM), - gettext(ASK_CONT))) - quit(n); - } else { - ptext(stderr, gettext(MSG_NOTVER), *ppkg); - if (n = ckyorn(ans, NULL, NULL, gettext(HLP_NOTVER), - gettext(ASK_CONT))) - quit(n); - } - if (strchr("yY", *ans) == NULL) - quit(3); -} - -void -psvr4cnflct(void) -{ - FILE *pp; - int n, found; - char *pt, - ans[MAX_INPUT], - cmd[PATH_MAX+sizeof (ckcmd)], - path[PATH_MAX]; - - for (n = 0; Rlist[n] != NULL; n++) { - if (access(Rlist[n], 0) == 0) - break; - } - if (Rlist[n] == NULL) - return; /* Rlist file not found on device */ - - (void) sprintf(cmd, ckcmd, Rlist[n]); - echo(gettext("## Checking for conflicts with installed packages")); - echo(gettext(" (using %s provided by pre-SVR4 package)"), Rlist[n]); - if ((pp = popen(cmd, "r")) == NULL) { - progerr(gettext(ERR_PIPE), cmd); - progerr(gettext(ERR_OVERWRITE)); - quit(99); - } - - found = 0; - while (fgets(path, PATH_MAX, pp)) { - if (!found++) - ptext(stderr, gettext(MSG_CONFLICT)); - if (pt = strpbrk(path, " \t\n")) - *pt = '\0'; - echo("\t%s", path); - } - if (pclose(pp)) { - progerr(gettext(ERR_OVERWRITE)); - quit(99); - } - - if (found) { - if (n = ckyorn(ans, NULL, NULL, gettext(HLP_CONFLICT), - gettext(ASK_CONT))) - quit(n); - if (strchr("yY", *ans) == NULL) - quit(3); - } -} - -void -psvr4mail(char *list, char *msg, int retcode, char *pkg) -{ - struct utsname utsbuf; - FILE *pp; - char cmd[BUFSIZ]; - - if (list == NULL) - return; - - while (isspace(*list)) - list++; - if (*list == '\0') - return; - - /* send e-mail notifications */ - (void) snprintf(cmd, sizeof (cmd), "%s %s", MAILCMD, list); - if ((pp = popen(cmd, "w")) == NULL) { - progerr(gettext(ERR_PIPE), MAILCMD); - progerr(gettext(ERR_MAIL)); - quit(99); - } - - (void) strcpy(utsbuf.nodename, gettext("(unknown)")); - (void) uname(&utsbuf); - ptext(pp, msg, pkg, utsbuf.nodename, retcode); - - if (pclose(pp)) { - progerr(gettext(ERR_MAIL)); - quit(99); - } -}
--- a/usr/src/cmd/svr4pkg/pkgadd/Makefile Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/pkgadd/Makefile Tue Nov 09 10:20:47 2010 -0800 @@ -28,7 +28,6 @@ OBJS= check.o \ main.o \ - presvr4.o \ quit.o ROOTLINKS= $(ROOTUSRSBIN)/pkgask
--- a/usr/src/cmd/svr4pkg/pkgadd/main.c Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/pkgadd/main.c Tue Nov 09 10:20:47 2010 -0800 @@ -86,9 +86,6 @@ * imported global variables/functions */ -/* presvr4.c */ -extern int presvr4(char **ppkg, int a_nointeract); - /* check.c */ extern int preinstall_verify(char **a_pkgList, zoneList_t a_zlst, char *a_zoneTempDir); @@ -1054,13 +1051,12 @@ /* * This function is in the libadm library; it sets: * -> get_PKGLOC() = <install_root>/var/sadm/pkg - * -> get_PKGOLD() = <install_root>/usr/options * -> get_PKGADM() = <install_root>/var/sadm/install * -> pkgdir = <install_root>/var/sadm/pkg * -> pkg_install_root = <install_root> * This controls operations of libadm functions such as: * -> pkginfofind, pkginfopen, fpkgparam, pkgparam, get_PKGLOC, - * -> get_PKGOLD, get_PKGADM, get_install_root + * -> get_PKGADM, get_install_root */ set_PKGpaths(get_inst_root()); @@ -1374,18 +1370,6 @@ echoDebug(DBG_CANNOT_GET_PKGLIST); - /* check for existence of pre-SVR4 package */ - (void) snprintf(path, sizeof (path), - "%s/install/INSTALL", pkgdev.dirname); - if (access(path, F_OK) == 0) { - pkginst = ((optind < argc) ? - argv[optind++] : NULL); - ckreturn(presvr4(&pkginst, nointeract)); - if (repeat || (optind < argc)) { - continue; - } - quit(0); - } progerr(ERR_NOPKGS, pkgdev.dirname); quit(1); /* NOTREACHED */
--- a/usr/src/cmd/svr4pkg/pkgadd/presvr4.c Mon Nov 08 21:52:02 2010 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,172 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 */ - - -/* - * system includes - */ -#include <stdio.h> -#include <signal.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <limits.h> -#include <sys/stat.h> -#include <sys/utsname.h> -#include <pkginfo.h> -#include <pkgstrct.h> -#include <pkgdev.h> -#include <pkglocs.h> -#include <locale.h> -#include <libintl.h> - -/* - * consolidation pkg command library includes - */ -#include <pkglib.h> -#include <messages.h> - -/* - * local pkg command library includes - */ -#include <install.h> -#include <libinst.h> -#include <libadm.h> - -/* - * pkgadd local includes - */ -#include "quit.h" - - -extern struct admin adm; -extern struct pkgdev pkgdev; -extern char *respfile; -extern char *tmpdir; -extern int warnflag; - -static void intf_reloc(void); - -/* - * ***************************************************************************** - * global external (public) functions - * ***************************************************************************** - */ - -int -presvr4(char **ppkg, int a_nointeract) -{ - int retcode; - char *tmpcmd, path[PATH_MAX]; - void (*tmpfunc)(); - - echo(MSG_INSTALLING_PSVR4); - if (a_nointeract) { - progerr(ERR_NOINT); - quit(1); - /* NOTREACHED */ - } - - if (respfile) { - progerr(ERR_RESPFILE); - quit(1); - /* NOTREACHED */ - } - - /* - * if we were looking for a particular package, verify - * the first media has a /usr/options file on it - * which matches - */ - psvr4pkg(ppkg); - - /* - * check to see if we can guess (via Rlist) what - * pathnames this package is likely to install; - * if we can, check these against the 'contents' - * file and warn the administrator that these - * pathnames might be modified in some manner - */ - psvr4cnflct(); - - if (chdir(tmpdir)) { - progerr(ERR_CHDIR, tmpdir); - quit(99); - /* NOTREACHED */ - } - - (void) snprintf(path, sizeof (path), "%s/install/INSTALL", - pkgdev.dirname); - - tmpcmd = tempnam(tmpdir, "INSTALL"); - if (!tmpcmd || copyf(path, tmpcmd, 0L) || chmod(tmpcmd, 0500)) { - progerr(ERR_NOCOPY, tmpdir); - quit(99); - /* NOTREACHED */ - } - - echo(MSG_EXE_INSTALL_SCRIPT); - - retcode = pkgexecl(NULL, NULL, NULL, NULL, SHELL, "-c", tmpcmd, - pkgdev.bdevice, pkgdev.dirname, NULL); - - echo(retcode ? MSG_FAIL : gettext(MSG_SUCCEED)); - - (void) unlink(tmpcmd); - (void) chdir("/"); - (void) pkgumount(&pkgdev); - - psvr4mail(adm.mail, MSG_MAIL, retcode, *ppkg ? *ppkg : MSG_NODENAME); - - /* tell quit to call intf_reloc on exit */ - - quitSetIntfReloc(&intf_reloc); - - return (retcode); -} - -/* - * ***************************************************************************** - * static internal (private) functions - * ***************************************************************************** - */ - -/* - * When quit() gains control this function will be invoked if quitSetIntfReloc() - * is called specifying this function - see presvr4() above for details. - */ - -static void -intf_reloc(void) -{ - char path[PATH_MAX]; - - (void) snprintf(path, sizeof (path), "%s/intf_reloc", PKGBIN); - (void) pkgexecl(NULL, NULL, NULL, NULL, SHELL, "-c", path, NULL); -}
--- a/usr/src/cmd/svr4pkg/pkgadd/quit.c Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/pkgadd/quit.c Tue Nov 09 10:20:47 2010 -0800 @@ -70,7 +70,6 @@ static char *zoneTempDir = (char *)NULL; static ckreturnFunc_t *ckreturnFunc = (ckreturnFunc_t *)NULL; static int trapEntered = 0; -static intfRelocFunc_t *intfRelocFunc = (intfRelocFunc_t *)NULL; static void trap(int signo); static zoneList_t zoneList = (zoneList_t)NULL; @@ -127,23 +126,6 @@ } /* - * Name: quitSetIntfReloc - * Description: set the "intf_reloc" interface to run when quit() is called - * Arguments: a_intfReloc - pointer to function to call when quit() is called - * Returns: void - * NOTE: When quit() is called, if an "intf_reloc" function is set, quit - * will call that function to perform whatever operations it needs - * to perform - typically this is needed to run "intf_reloc" when - * pre-SVR4 packages have been installed - */ - -void -quitSetIntfReloc(intfRelocFunc_t *a_intfReloc) -{ - intfRelocFunc = a_intfReloc; -} - -/* * Name: quitSetCkreturnFunc * Description: set the ckreturn() interface to call when quit() is called * Arguments: a_ckreturnFunc - pointer to function to call when quit() is @@ -350,12 +332,6 @@ echo(MSG_N_PKGS_NOT_PROCESSED, npkgs); } - /* call intf_reloc function if registered */ - - if (intfRelocFunc != (intfRelocFunc_t *)NULL) { - (intfRelocFunc)(); - } - /* if a zone list exists, unlock all zones */ if (zoneList != (zoneList_t)NULL) {
--- a/usr/src/cmd/svr4pkg/pkgadd/quit.h Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/pkgadd/quit.h Tue Nov 09 10:20:47 2010 -0800 @@ -46,14 +46,11 @@ * exported (global) functions */ -typedef void (intfRelocFunc_t)(void); - extern sighdlrFunc_t *quitGetTrapHandler(void); extern void quit(int retcode); extern void quitSetCkreturnFunc(ckreturnFunc_t *a_ckreturnFunc); extern void quitSetDwnldTmpdir(char *z_dwnldTempDir); extern void quitSetIdsName(char *a_idsName); -extern void quitSetIntfReloc(intfRelocFunc_t *a_intfReloc); extern void quitSetZoneName(char *a_zoneName); extern void quitSetZoneTmpdir(char *z_zoneTempDir); extern void quitSetZonelist(zoneList_t a_zlst);
--- a/usr/src/cmd/svr4pkg/pkginfo/pkginfo.c Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/pkginfo/pkginfo.c Tue Nov 09 10:20:47 2010 -0800 @@ -377,14 +377,7 @@ continue; } - if (Nflag && (info.status == PI_PRESVR4)) { - /* don't include preSVR4 packages */ - choice->installed = (-1); - continue; - } - - if (!iflag && ((info.status == PI_INSTALLED) || - (info.status == PI_PRESVR4))) { + if (!iflag && (info.status == PI_INSTALLED)) { /* don't include completely installed packages */ choice->installed = (-1); continue; @@ -461,8 +454,6 @@ } else if (!lflag) { if (info.catg) { (void) sscanf(info.catg, "%[^, \t\n]", category); - } else if (info.status == PI_PRESVR4) { - (void) strcpy(category, "preSVR4"); } else { (void) strcpy(category, "(unknown)"); } @@ -485,25 +476,21 @@ if (info.vendor) (void) printf(FMT, "VENDOR", info.vendor); - if (info.status == PI_PRESVR4) - (void) printf(FMT, "STATUS", "preSVR4"); - else { - for (i = 0; parmlst[i]; ++i) { - if ((pt = pkgparam(info.pkginst, parmlst[i])) != NULL && - *pt) - (void) printf(FMT, parmlst[i], pt); - } - if (info.status == PI_SPOOLED) - (void) printf(FMT, "STATUS", gettext("spooled")); - else if (info.status == PI_PARTIAL) - (void) printf(FMT, "STATUS", - gettext("partially installed")); - else if (info.status == PI_INSTALLED) - (void) printf(FMT, "STATUS", - gettext("completely installed")); - else - (void) printf(FMT, "STATUS", gettext("(unknown)")); + for (i = 0; parmlst[i]; ++i) { + if ((pt = pkgparam(info.pkginst, parmlst[i])) != NULL && *pt) + (void) printf(FMT, parmlst[i], pt); } + if (info.status == PI_SPOOLED) + (void) printf(FMT, "STATUS", gettext("spooled")); + else if (info.status == PI_PARTIAL) + (void) printf(FMT, "STATUS", + gettext("partially installed")); + else if (info.status == PI_INSTALLED) + (void) printf(FMT, "STATUS", + gettext("completely installed")); + else + (void) printf(FMT, "STATUS", gettext("(unknown)")); + (void) pkgparam(NULL, NULL); if (!lflag) { @@ -511,44 +498,37 @@ return; } - if (info.status != PI_PRESVR4) { - if (strcmp(pkgdir, get_PKGLOC())) - getinfo(dp); + if (strcmp(pkgdir, get_PKGLOC())) + getinfo(dp); - if (dp->spooled) - (void) printf( - gettext("%10s: %7ld spooled pathnames\n"), - "FILES", dp->spooled); - if (dp->installed) - (void) printf( - gettext("%10s: %7ld installed pathnames\n"), - "FILES", dp->installed); - if (dp->partial) - (void) printf( - gettext("%20d partially installed pathnames\n"), - dp->partial); - if (dp->shared) - (void) printf(gettext("%20d shared pathnames\n"), - dp->shared); - if (dp->link) - (void) printf(gettext("%20d linked files\n"), dp->link); - if (dp->dirs) - (void) printf(gettext("%20d directories\n"), dp->dirs); - if (dp->exec) - (void) printf(gettext("%20d executables\n"), dp->exec); - if (dp->setuid) - (void) printf( - gettext("%20d setuid/setgid executables\n"), - dp->setuid); - if (dp->info) - (void) printf( - gettext("%20d package information files\n"), - dp->info+1); /* pkgmap counts! */ + if (dp->spooled) + (void) printf(gettext("%10s: %7ld spooled pathnames\n"), + "FILES", dp->spooled); + if (dp->installed) + (void) printf(gettext("%10s: %7ld installed pathnames\n"), + "FILES", dp->installed); + if (dp->partial) + (void) printf(gettext("%20d partially installed pathnames\n"), + dp->partial); + if (dp->shared) + (void) printf(gettext("%20d shared pathnames\n"), dp->shared); + if (dp->link) + (void) printf(gettext("%20d linked files\n"), dp->link); + if (dp->dirs) + (void) printf(gettext("%20d directories\n"), dp->dirs); + if (dp->exec) + (void) printf(gettext("%20d executables\n"), dp->exec); + if (dp->setuid) + (void) printf(gettext("%20d setuid/setgid executables\n"), + dp->setuid); + if (dp->info) + (void) printf(gettext("%20d package information files\n"), + dp->info+1); /* pkgmap counts! */ - if (dp->tblks) - (void) printf(gettext("%20ld blocks used (approx)\n"), - dp->tblks); - } + if (dp->tblks) + (void) printf(gettext("%20ld blocks used (approx)\n"), + dp->tblks); + (void) putchar('\n'); } @@ -589,13 +569,7 @@ if (!ckcatg[0]) return (0); /* no specification implies all packages */ - if (info.status == PI_PRESVR4) { - for (i = 0; ckcatg[i]; /* void */) { - if (strcmp(ckcatg[i++], "preSVR4") == NULL) - return (0); - } - return (1); - } + if (!list) return (1); /* no category specified in pkginfo is a bug */ @@ -628,29 +602,6 @@ struct stat status; DIR *dirfp; char path[PATH_MAX]; - int n; - - if (strcmp(pkgdir, get_PKGLOC()) == NULL && - (dirfp = opendir(get_PKGOLD()))) { - while (drp = readdir(dirfp)) { - if (drp->d_name[0] == '.') - continue; - n = strlen(drp->d_name); - if ((n > 5) && - strcmp(&drp->d_name[n-5], ".name") == NULL) { - (void) snprintf(path, sizeof (path), - "%s/%s", get_PKGOLD(), drp->d_name); - if (lstat(path, &status)) - continue; - if ((status.st_mode & S_IFMT) != S_IFREG) - continue; - drp->d_name[n-5] = '\0'; - if (!pkgcnt || (selectp(drp->d_name) >= 0)) - (void) fpkg(drp->d_name); - } - } - (void) closedir(dirfp); - } if ((dirfp = opendir(pkgdir)) == NULL) return;
--- a/usr/src/cmd/svr4pkg/pkginstall/Makefile Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/pkginstall/Makefile Tue Nov 09 10:20:47 2010 -0800 @@ -36,7 +36,6 @@ merginfo.o \ pkgenv.o \ pkgvolume.o \ - predepend.o \ quit.o \ reqexec.o \ sortmap.o
--- a/usr/src/cmd/svr4pkg/pkginstall/getinst.c Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/pkginstall/getinst.c Tue Nov 09 10:20:47 2010 -0800 @@ -45,7 +45,7 @@ extern struct admin adm; extern char *pkgarch, *pkgvers, *msgtext, *pkgabrv; -extern int opresvr4, maxinst; +extern int maxinst; static char newinst[PKGSIZ]; static char *nextinst(void); @@ -128,7 +128,7 @@ (void) fprintf(stdout, "ckinstance=0\n"); } - inst = sameinst; /* can't be overwriting a pre-svr4 package */ + inst = sameinst; same_pkg++; (*updatingExisting)++; return (inst); @@ -155,9 +155,6 @@ } inst = info[samearch].pkginst; - if (info[samearch].status == PI_PRESVR4) { - opresvr4++; /* overwriting a pre-svr4 package */ - } (*updatingExisting)++; return (inst); @@ -199,16 +196,6 @@ (*updatingExisting)++; - /* see if this instance is presvr4 */ - for (i = 0; i < npkgs; i++) { - if (strcmp(inst, info[i].pkginst) == NULL) { - if (info[i].status == PI_PRESVR4) { - opresvr4++; - } - break; - } - } - return (inst); }
--- a/usr/src/cmd/svr4pkg/pkginstall/main.c Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/pkginstall/main.c Tue Nov 09 10:20:47 2010 -0800 @@ -150,7 +150,6 @@ int maxinst = 1; int nocnflct; int nosetuid; -int opresvr4 = 0; int pkgverbose = 0; int rprcflag; int warnflag = 0; @@ -2047,19 +2046,6 @@ /*NOTREACHED*/ } - if (opresvr4) { - /* - * we are overwriting a pre-svr4 package, so remove the file - * in /usr/options now - */ - (void) snprintf(path, sizeof (path), - "%s/%s.name", get_PKGOLD(), pkginst); - if (remove(path) && (errno != ENOENT)) { - progerr(ERR_OPRESVR4, path); - warnflag++; - } - } - /* * Execute preinstall script, if one was provided with the * package. We check the package to avoid running an old @@ -2229,8 +2215,6 @@ } if (!warnflag && !failflag) { - if (pt = getenv("PREDEPEND")) - predepend(pt); (void) remove(rlockfile); (void) remove(ilockfile); (void) remove(savlog);
--- a/usr/src/cmd/svr4pkg/pkginstall/predepend.c Mon Nov 08 21:52:02 2010 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 1993 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 <sys/types.h> -#include <sys/stat.h> -#include <string.h> -#include <limits.h> -#include <stdlib.h> -#include <unistd.h> -#include <pkglocs.h> -#include <locale.h> -#include <libintl.h> -#include <pkglib.h> -#include "libadm.h" - -extern char *pkgname, pkgloc[]; -extern int warnflag; - -#define ERR_RMLINK "unable to remove options file <%s>" -#define ERR_SYMLINK "unable to create symbloic link from <%s> to <%s>" -#define ERR_PREDEPEND "unable to create predepend file <%s>" - -void -predepend(char *oldpkg) -{ - FILE *fp; - char path[PATH_MAX]; - char spath[PATH_MAX]; - struct stat statbuf; - - oldpkg = strtok(oldpkg, " \t\n"); - if (oldpkg == NULL) - return; - - (void) sprintf(path, "%s/predepend", pkgloc); - if ((fp = fopen(path, "w")) == NULL) { - progerr(gettext(ERR_PREDEPEND), path); - warnflag++; - return; - } - (void) fprintf(fp, "%s\n", pkgname); - (void) fclose(fp); - - do { - (void) sprintf(spath, "%s/%s.name", get_PKGOLD(), oldpkg); - if (lstat(spath, &statbuf) == 0) { - /* options file already exists */ - if (statbuf.st_mode & S_IFLNK) { - /* remove current link */ - if (unlink(spath)) { - progerr(gettext(ERR_RMLINK), spath); - warnflag++; - } - } - } - if (symlink(path, spath)) { - progerr(gettext(ERR_SYMLINK), path, spath); - warnflag++; - } - } while (oldpkg = strtok(NULL, " \t\n")); -}
--- a/usr/src/cmd/svr4pkg/pkgremove/Makefile Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/pkgremove/Makefile Tue Nov 09 10:20:47 2010 -0800 @@ -29,7 +29,6 @@ OBJS= check.o \ delmap.o \ main.o \ - predepend.o \ quit.o \ special.o \ wsreg_pkgrm.o
--- a/usr/src/cmd/svr4pkg/pkgremove/main.c Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/pkgremove/main.c Tue Nov 09 10:20:47 2010 -0800 @@ -71,9 +71,6 @@ extern int rckdepend(void); extern int rckrunlevel(void); -/* predepend.c */ -extern void predepend(char *oldpkg); - /* delmap.c */ extern int delmap(int flag, char *pkginst, PKGserver *server, VFP_T **tfp); @@ -1098,8 +1095,6 @@ } if (!warnflag && !failflag) { - if (pt = getenv("PREDEPEND")) - predepend(pt); (void) chdir("/"); if (rrmdir(pkgloc)) warnflag++;
--- a/usr/src/cmd/svr4pkg/pkgremove/predepend.c Mon Nov 08 21:52:02 2010 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 1993 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 <limits.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <errno.h> -#include <locale.h> -#include <libintl.h> -#include <pkglocs.h> -#include "pkglib.h" -#include "libinst.h" -#include "libadm.h" - -extern int warnflag; - -#define ERR_UNLINK "unable to unlink <%s>" - -void -predepend(char *oldpkg) -{ - struct stat status; - char spath[PATH_MAX]; - - oldpkg = strtok(oldpkg, " \t\n"); - if (oldpkg == NULL) - return; - - do { - (void) sprintf(spath, "%s/%s.name", get_PKGOLD(), oldpkg); - if (lstat(spath, &status) == 0) { - if (status.st_mode & S_IFLNK) { - if (unlink(spath)) { - progerr(gettext(ERR_UNLINK), spath); - warnflag++; - } - return; - } - } - } while (oldpkg = strtok(NULL, " \t\n")); -}
--- a/usr/src/cmd/svr4pkg/pkgrm/Makefile Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/pkgrm/Makefile Tue Nov 09 10:20:47 2010 -0800 @@ -28,7 +28,6 @@ OBJS= check.o \ main.o \ - presvr4.o \ quit.o include $(SRC)/cmd/svr4pkg/Makefile.svr4pkg
--- a/usr/src/cmd/svr4pkg/pkgrm/main.c Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/pkgrm/main.c Tue Nov 09 10:20:47 2010 -0800 @@ -140,10 +140,6 @@ * imported (external) functions */ -/* presvr4.c */ - -extern int presvr4(char *pkg, int a_nointeract); - /* check.c */ extern int preremove_verify(char **a_pkgList, zoneList_t a_zlst, @@ -936,11 +932,6 @@ } } - if (pinfo->status == PI_PRESVR4) { - pkginfoFree(&pinfo); - return (presvr4(pkginst, nointeract)); - } - if (pinfo->status == PI_SPOOLED) { /* removal from a directory */ echo(INFO_RMSPOOL, pkginst);
--- a/usr/src/cmd/svr4pkg/pkgrm/presvr4.c Mon Nov 08 21:52:02 2010 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 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 <signal.h> -#include <limits.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/stat.h> /* chmod()? definition */ -#include <valtools.h> -#include <locale.h> -#include <libintl.h> -#include <pkgdev.h> -#include <pkglocs.h> -#include "install.h" -#include <pkglib.h> -#include "libadm.h" -#include "libinst.h" - -/* - * pkgadd local includes - */ - -#include "quit.h" - -extern struct admin adm; -extern struct pkgdev pkgdev; -extern char *tmpdir; -extern int started; - -static void intf_reloc(void); - -#define PATH_FLAGS P_EXIST|P_ABSOLUTE|P_BLK - -#define MSG_DEVICE "Removal of a pre-SVR4 package requires the original " \ - "medium from which the package was installed." - -#define ASK_DEVICE "Enter the alias or pathname for the device to be " \ - "used (e.g., diskette1 or /dev/diskette)" - -#define ASK_INSERT "Insert the first volume for package <%s> into %s" - -#define ERR_NOCOPY "unable to create copy of UNINSTALL script in <%s>" - -#define ERR_NOINT "-n option cannot be used when removing pre-SVR4 " \ - "packages" - -#define ERR_BADDEV "Unknown or bad device <%s> specified" - -#define MSG_MAIL "An attempt to remove the <%s> pre-SVR4 package on " \ - "<%s> completed with exit status <%d>." - -#define INFO_P4RMOK "\nPre-SVR4 package reported successful removal.\n" - -int -presvr4(char *pkg, int a_nointeract) -{ - char alias[PATH_MAX]; - char path[PATH_MAX]; - char *tmpcmd; - int n, retcode; - void (*tmpfunc)(); - - echo(gettext("*** Removing Pre-SVR4 Package ***")); - if (a_nointeract != 0) { - progerr(gettext(ERR_NOINT)); - quit(1); - } - - /* should accept device alias?? */ - - echo(gettext(MSG_DEVICE)); - for (;;) { - if (n = ckstr(alias, NULL, PATH_MAX, NULL, NULL, NULL, - gettext(ASK_DEVICE))) - return (n); - - if (devtype(alias, &pkgdev)) - continue; - if (!pkgdev.mount || !pkgdev.bdevice) { - logerr(gettext(ERR_BADDEV), alias); - continue; - } - break; - } - pkgdev.mount = pkgdev.dirname = "/install"; - pkgdev.rdonly = 1; - - if (n = pkgmount(&pkgdev, pkg, 1, 0, 1)) - quit(n); - - psvr4pkg(&pkg); - - /* - * check to see if we can guess (via Rlist) what - * pathnames this package is likely to remove; - * if we can, check these against the 'contents' - * file and warn the administrator that these - * pathnames might be modified in some manner - */ - psvr4cnflct(); - - if (chdir(tmpdir)) { - progerr(gettext("unable to change directory to <%s>"), tmpdir); - quit(99); - } - - (void) snprintf(path, sizeof (path), "%s/install/UNINSTALL", - "/install"); - tmpcmd = tempnam(tmpdir, "UNINSTALL"); - if (!tmpcmd || copyf(path, tmpcmd, 0) || chmod(tmpcmd, 0500)) { - progerr(gettext(ERR_NOCOPY), tmpdir); - quit(99); - } - - started++; - - echo(gettext("## Executing package UNINSTALL script")); - - retcode = pkgexecl(NULL, NULL, NULL, NULL, SHELL, "-c", tmpcmd, NULL); - - (void) unlink(tmpcmd); - if (retcode) { - echo(gettext("\nPre-SVR4 package reported failed removal.\n")); - } else { - echo(gettext(INFO_P4RMOK)); - } - - psvr4mail(adm.mail, gettext(MSG_MAIL), retcode, pkg); - (void) pkgumount(&pkgdev); - - /* tell quit to call intf_reloc on exit */ - - quitSetIntfReloc(&intf_reloc); - - return (retcode); -} - -/* - * ***************************************************************************** - * static internal (private) functions - * ***************************************************************************** - */ - -/* - * When quit() gains control this function will be invoked if quitSetIntfReloc() - * is called specifying this function - see presvr4() above for details. - */ - -static void -intf_reloc(void) -{ - char path[PATH_MAX]; - - (void) snprintf(path, sizeof (path), "%s/intf_reloc", PKGBIN); - (void) pkgexecl(NULL, NULL, NULL, NULL, SHELL, "-c", path, NULL); -}
--- a/usr/src/cmd/svr4pkg/pkgrm/quit.c Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/pkgrm/quit.c Tue Nov 09 10:20:47 2010 -0800 @@ -64,7 +64,6 @@ */ static ckreturnFunc_t *ckreturnFunc = (ckreturnFunc_t *)NULL; -static intfRelocFunc_t *intfRelocFunc = (intfRelocFunc_t *)NULL; static char *zoneTempDir = (char *)NULL; static void trap(int signo); static zoneList_t zoneList = (zoneList_t)NULL; @@ -103,23 +102,6 @@ } /* - * Name: quitSetIntfReloc - * Description: set the "intf_reloc" interface to run when quit() is called - * Arguments: a_intfReloc - pointer to function to call when quit() is called - * Returns: void - * NOTE: When quit() is called, if an "intf_reloc" function is set, quit - * will call that function to perform whatever operations it needs - * to perform - typically this is needed to run "intf_reloc" when - * pre-SVR4 packages have been removed - */ - -void -quitSetIntfReloc(intfRelocFunc_t *a_intfReloc) -{ - intfRelocFunc = a_intfReloc; -} - -/* * Name: quitSetCkreturnFunc * Description: set the ckreturn() interface to call when quit() is called * Arguments: a_ckreturnFunc - pointer to function to call when quit() is @@ -281,12 +263,6 @@ echo(MSG_N_PKGS_NOT_PROCESSED, npkgs); } - /* call intf_reloc function if registered */ - - if (intfRelocFunc != (intfRelocFunc_t *)NULL) { - (intfRelocFunc)(); - } - /* if a zone list exists, unlock all zones */ if (zoneList != (zoneList_t)NULL) {
--- a/usr/src/cmd/svr4pkg/pkgrm/quit.h Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/cmd/svr4pkg/pkgrm/quit.h Tue Nov 09 10:20:47 2010 -0800 @@ -49,14 +49,11 @@ * exported (global) functions */ -typedef void (intfRelocFunc_t)(void); - extern void quit(int retcode); extern void quitSetCkreturnFunc(ckreturnFunc_t *a_ckreturnFunc); extern void quitSetZoneName(char *a_zoneName); extern void quitSetZoneTmpdir(char *z_zoneTempDir); extern sighdlrFunc_t *quitGetTrapHandler(void); -extern void quitSetIntfReloc(intfRelocFunc_t *a_intfReloc); #ifdef __cplusplus }
--- a/usr/src/head/pkglocs.h Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/head/pkglocs.h Tue Nov 09 10:20:47 2010 -0800 @@ -26,13 +26,10 @@ #ifndef _PKGLOCS_H #define _PKGLOCS_H -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ - #ifdef __cplusplus extern "C" { #endif -#define PKGOLD "/usr/options" #define PKGLOC "/var/sadm/pkg" #define PKGADM "/var/sadm/install" #define PKGBIN "/usr/sadm/install/bin"
--- a/usr/src/lib/libadm/common/mapfile-vers Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/lib/libadm/common/mapfile-vers Tue Nov 09 10:20:47 2010 -0800 @@ -129,7 +129,6 @@ get_install_root; get_PKGADM; get_PKGLOC; - get_PKGOLD; getvol; _getvol; listdev;
--- a/usr/src/lib/libadm/common/pkginfo.c Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/lib/libadm/common/pkginfo.c Tue Nov 09 10:20:47 2010 -0800 @@ -28,7 +28,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ /*LINTLIBRARY*/ /* 5-20-92 added newroot functions */ @@ -50,9 +49,7 @@ #include "libadm.h" static void initpkg(struct pkginfo *); -static char *svr4inst(char *); static int rdconfig(struct pkginfo *, char *, char *); -static int svr4info(struct pkginfo *, char *, char *); static int ckinfo(char *, char *, char *); static int ckinst(char *, char *, char *, char *, char *); static int verscmp(char *, char *); @@ -199,9 +196,6 @@ int count; if ((fp = pkginfopen(pkgdir, pkginst)) == NULL) { - if ((errno == ENOENT) && strcmp(pkgdir, get_PKGLOC()) == 0) - return (svr4info(info, pkginst, ckvers)); - errno = EACCES; return (-1); } @@ -271,74 +265,6 @@ } static int -svr4info(struct pkginfo *info, char *pkginst, char *ckvers) -{ - static DIR *pdirfp; - struct stat64 status; - FILE *fp; - char *pt, path[128], line[128]; - char temp[PKGSIZ+1]; - - if (strcmp(pkginst, "all")) { - if (pdirfp) { - (void) closedir(pdirfp); - pdirfp = NULL; - } - /* determine pkginst - remove '.*' extension, if any */ - (void) strncpy(temp, pkginst, PKGSIZ); - if (((pt = strchr(temp, '.')) != NULL) && strcmp(pt, ".*") == 0) - *pt = '\0'; - } - - /* look in /usr/options direcotry for 'name' file */ - (void) sprintf(path, "%s/%s.name", get_PKGOLD(), temp); - if (lstat64(path, &status)) { - errno = (errno == ENOENT) ? ESRCH : EACCES; - return (-1); - } - if ((status.st_mode & S_IFMT) != S_IFREG) { - errno = ESRCH; - return (-1); - } - if ((fp = fopen(path, "r")) == NULL) { - errno = (errno == ENOENT) ? ESRCH : EACCES; - return (-1); - } - - /* /usr/options/xxx.name exists */ - (void) fgets(line, 128, fp); - (void) fclose(fp); - if (pt = strchr(line, '\n')) - *pt = '\0'; /* remove trailing newline */ - if (pt = strchr(line, ':')) - *pt++ = '\0'; /* assumed version specification */ - - if (info) { - info->name = strdup(line); - info->pkginst = strdup(temp); - if (!info->name || !info->pkginst) { - errno = ENOMEM; - return (-1); - } - info->status = PI_PRESVR4; - info->version = NULL; - } - - if (pt) { - /* eat leading space off of version spec */ - while (isspace((unsigned char)*pt)) - pt++; - } - if (ckvers && verscmp(ckvers, pt)) { - errno = ESRCH; - return (-1); - } - if (info && *pt) - info->version = strdup(pt); - return (0); -} - -static int ckinst(char *pkginst, char *pkgarch, char *pkgvers, char *ckarch, char *ckvers) { if (ckarch && archcmp(ckarch, pkgarch)) @@ -372,7 +298,6 @@ (void) closedir(pdirfp); pdirfp = NULL; } - (void) svr4inst(NULL); /* close any files used here */ return (NULL); } @@ -406,67 +331,12 @@ 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); } -/*ARGSUSED*/ - -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); -} static int verscmp(char *request, char *actual)
--- a/usr/src/lib/libadm/common/pkgnmchk.c Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/lib/libadm/common/pkgnmchk.c Tue Nov 09 10:20:47 2010 -0800 @@ -28,12 +28,12 @@ * All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ /*LINTLIBRARY*/ #include <string.h> #include <ctype.h> #include <sys/types.h> +#include <note.h> #include "libadm.h" static char *rsvrd[] = { @@ -46,14 +46,13 @@ #define NMBRK ".*" #define WILD1 ".*" #define WILD2 "*" -#define WILD3 ".name" #define ABI_NAMELNGTH 9 #define NON_ABI_NAMELNGTH 32 static int abi_namelngth = 0; static int -valname(char *pkg, int wild, int presvr4flg) +valname(char *pkg, int wild) { int count, i, n; char *pt; @@ -71,14 +70,12 @@ } /* - * check for valid extensions; we must do this - * first since we need to look for SVR3 ".name" + * check for valid extensions; we used to do this + * first since we needed to look for SVR3 ".name" * before we validate the package abbreviation */ if (pt = strpbrk(pkg, NMBRK)) { - if (presvr4flg && (strcmp(pt, WILD3) == 0)) - return (0); /* SVR3 packages have no validation */ - else if ((strcmp(pt, WILD1) == 0) || (strcmp(pt, WILD2) == 0)) { + if ((strcmp(pt, WILD1) == 0) || (strcmp(pt, WILD2) == 0)) { /* wildcard specification */ if (!wild) return (1); @@ -98,8 +95,7 @@ /* check for valid package name */ count = 0; - if (!isalnum((unsigned char)*pkg) || - (!presvr4flg && !isalpha((unsigned char)*pkg))) + if (!isalpha((unsigned char)*pkg)) return (-1); while (*pkg && !strchr(NMBRK, *pkg)) { if (!isalnum((unsigned char)*pkg) && !strpbrk(pkg, "-+")) @@ -121,6 +117,8 @@ int pkgnmchk(char *pkg, char *spec, int presvr4flg) { + _NOTE(ARGUNUSED(presvr4flg)); + /* pkg is assumed to be non-NULL upon entry */ /* @@ -131,28 +129,23 @@ * "x*" pkg must be valid and must be an instance of "x" */ - if (valname(pkg, ((spec == NULL) ? 1 : 0), presvr4flg)) + if (valname(pkg, ((spec == NULL) ? 1 : 0))) return (1); /* invalid or reserved name */ if ((spec == NULL) || (strcmp(spec, "all") == 0)) return (0); while (*pkg == *spec) { - if ((strcmp(spec, WILD1) == 0) || (strcmp(spec, WILD2) == 0) || - (strcmp(spec, WILD3) == 0)) + if ((strcmp(spec, WILD1) == 0) || (strcmp(spec, WILD2) == 0)) break; /* wildcard spec, so stop right here */ else if (*pkg++ == '\0') return (0); /* identical match */ spec++; } - if ((strcmp(spec, WILD1) == 0) || (strcmp(spec, WILD2) == 0) || - (strcmp(spec, WILD3) == 0)) { + if ((strcmp(spec, WILD1) == 0) || (strcmp(spec, WILD2) == 0)) if ((pkg[0] == '\0') || (pkg[0] == '.')) return (0); - } - if ((spec[0] == '\0') && (strcmp(pkg, WILD3) == 0)) - return (0); /* compare pkg.name to pkg */ return (1); }
--- a/usr/src/lib/libadm/common/pkgparam.c Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/lib/libadm/common/pkgparam.c Tue Nov 09 10:20:47 2010 -0800 @@ -26,7 +26,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ /*LINTLIBRARY*/ /* 5-20-92 newroot support added */ @@ -55,7 +54,6 @@ char *pkgdir = NULL; char *pkgfile = NULL; -static char Adm_pkgold[PATH_MAX] = { 0 }; /* added for newroot */ static char Adm_pkgloc[PATH_MAX] = { 0 }; /* added for newroot */ static char Adm_pkgadm[PATH_MAX] = { 0 }; /* added for newroot */ @@ -393,16 +391,13 @@ { if (path && *path) { (void) sprintf(Adm_pkgloc, "%s%s", path, PKGLOC); - (void) sprintf(Adm_pkgold, "%s%s", path, PKGOLD); (void) sprintf(Adm_pkgadm, "%s%s", path, PKGADM); set_install_root(path); } else { (void) sprintf(Adm_pkgloc, "%s", PKGLOC); - (void) sprintf(Adm_pkgold, "%s", PKGOLD); (void) sprintf(Adm_pkgadm, "%s", PKGADM); } canonize_name(Adm_pkgloc); - canonize_name(Adm_pkgold); canonize_name(Adm_pkgadm); pkgdir = Adm_pkgloc; } @@ -417,15 +412,6 @@ } char * -get_PKGOLD(void) -{ - if (Adm_pkgold[0] == NULL) - return (PKGOLD); - else - return (Adm_pkgold); -} - -char * get_PKGADM(void) { if (Adm_pkgadm[0] == NULL)
--- a/usr/src/lib/libadm/inc/libadm.h Mon Nov 08 21:52:02 2010 -0800 +++ b/usr/src/lib/libadm/inc/libadm.h Tue Nov 09 10:20:47 2010 -0800 @@ -32,8 +32,6 @@ #ifndef _LIBADM_H #define _LIBADM_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <valtools.h> #include <stdio.h> #include <pkginfo.h> @@ -99,7 +97,6 @@ extern char *fpkgparam(FILE *, char *); extern char *get_PKGADM(void); extern char *get_PKGLOC(void); -extern char *get_PKGOLD(void); extern int getinput(char *); extern char *getfullblkname(char *); extern char *getfullrawname(char *);