From 6e1ae2a33c618c4c2b14aec7d2f21743ddea5837 Mon Sep 17 00:00:00 2001 From: Gary Pennington Date: Wed, 30 Jun 2010 03:42:01 -0700 Subject: 6939693 zones no longer needs the inherit-pkg-dir property --- usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c | 18 +-- usr/src/cmd/svr4pkg/libinst/pkgops.c | 190 +------------------------------- usr/src/cmd/svr4pkg/libinst/putparam.c | 29 +---- 3 files changed, 4 insertions(+), 233 deletions(-) (limited to 'usr/src/cmd/svr4pkg/libinst') diff --git a/usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c b/usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c index 4c0af8810d..ef1bdb07e1 100644 --- a/usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c +++ b/usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -972,20 +971,7 @@ merg(struct cfextra *el_ent, struct cfent *cf_ent) * set later. */ - /* - * for type f/v files, if the file is in an area that is - * inherited from the global zone, that area is read only - * and the object cannot be changed - ignore any settings - * in the current package database that may be present for - * any existing object because they are irrelevant - since - * the object is in a read-only area shared from the global - * zone, accept that file's actual attributes as being correct. - */ - - if (z_path_is_inherited(el_ent->cf_ent.path, - el_ent->cf_ent.ftype, get_inst_root()) == B_TRUE) { - echoDebug(DBG_PKGDBMRG_INHERITED, el_ent->cf_ent.path); - } else if (cf_ent->cinfo.size != el_ent->cf_ent.cinfo.size) { + if (cf_ent->cinfo.size != el_ent->cf_ent.cinfo.size) { changed++; el_ent->mstat.contchg = 1; } else if (cf_ent->cinfo.modtime != diff --git a/usr/src/cmd/svr4pkg/libinst/pkgops.c b/usr/src/cmd/svr4pkg/libinst/pkgops.c index 3bb4d90650..b88e673379 100644 --- a/usr/src/cmd/svr4pkg/libinst/pkgops.c +++ b/usr/src/cmd/svr4pkg/libinst/pkgops.c @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -887,186 +886,6 @@ pkgGetPackageList(char ***r_pkgList, char **a_argv, int a_optind, } } -/* - * Name: pkgMatchInherited - * Description: given a pointer to a "source" and a "destination" for an object, - * along with other attributes of the object, determine if the - * object is already installed and is current. - * Arguments: a_src - pointer to string representing the "source" file to - * verify - this would be the current temporary location of - * the file that would be installed - * a_dst - pointer to string representing the "destination" file to - * verify - this would be the ultimate destination for the - * file if installed - * a_rootDir - pointer to string representing the "root directory" - * where the package is being installed - * a_mode - final "mode" file should have when installed - * a_modtime - final "modtime" file should have when installed - * a_ftype - contents "type" of file (f/e/v/s/l) - * a_cksum - final "checksum" file should have when installed - * Returns: boolean_t - * B_TRUE - the specified source file MATCHES the file - * located at the specified destination - * B_FALSE - the specified source files does NOT match - * the file located at the specified destination - */ - -boolean_t -pkgMatchInherited(char *a_src, char *a_dst, char *a_rootDir, - char a_mode, time_t a_modtime, char a_ftype, unsigned long a_cksum) -{ - char cwd[PATH_MAX+1] = {'\0'}; - char dstpath[PATH_MAX+1]; - int cksumerr; - int n; - struct stat statbufDst; - struct stat statbufSrc; - unsigned long dstcksum; - unsigned long srcksum; - - /* entry assertions */ - - assert(a_src != (char *)NULL); - assert(*a_src != '\0'); - assert(a_dst != (char *)NULL); - assert(*a_dst != '\0'); - - /* normalize root directory */ - - if ((a_rootDir == (char *)NULL) || (*a_rootDir == '\0')) { - a_rootDir = "/"; - } - - /* entry debugging */ - - echoDebug(DBG_PKGOPS_MATCHINHERIT_ENTRY); - echoDebug(DBG_PKGOPS_MATCHINHERIT_ARGS, a_src, a_dst, a_rootDir, - a_mode, a_modtime, a_ftype, a_cksum); - - /* save current working directory - resolvepath can change it */ - - (void) getcwd(cwd, sizeof (cwd)); - - n = resolvepath(a_dst, dstpath, sizeof (dstpath)); - if (n <= 0) { - if (errno != ENOENT) { - progerr(ERR_RESOLVEPATH, a_dst, strerror(errno)); - } - (void) chdir(cwd); - return (B_FALSE); - } - dstpath[n++] = '\0'; /* make sure string is terminated */ - - /* return false if path is not in inherited file system space */ - - if (!z_path_is_inherited(dstpath, a_ftype, a_rootDir)) { - return (B_FALSE); - } - - /* - * path is in inherited file system space: verify existence - */ - - /* return false if source file cannot be stat()ed */ - - if (stat(a_src, &statbufSrc) != 0) { - progerr(ERR_STAT, a_src, strerror(errno)); - return (B_FALSE); - } - - /* return false if destination file cannot be stat()ed */ - - if (stat(dstpath, &statbufDst) != 0) { - progerr(ERR_STAT, dstpath, strerror(errno)); - return (B_FALSE); - } - - /* - * if this is an editable or volatile file, then the only - * thing to guarantee is that the file exists - the file - * attributes do not need to match - */ - - /* editable file only needs to exist */ - - if (a_ftype == 'e') { - echoDebug(DBG_PKGOPS_EDITABLE_EXISTS, dstpath); - return (B_TRUE); - } - - /* volatile file only needs to exist */ - - if (a_ftype == 'v') { - echoDebug(DBG_PKGOPS_VOLATILE_EXISTS, dstpath); - return (B_TRUE); - } - - /* - * verify modtime if file is not modifiable after install - */ - - /* return false if source and destination have different mod times */ - - if (statbufSrc.st_mtim.tv_sec != statbufDst.st_mtim.tv_sec) { - echoDebug(DBG_PKGOPS_MOD_MISMATCH, a_src, - statbufSrc.st_mtim.tv_sec, dstpath, - statbufDst.st_mtim.tv_sec); - return (B_FALSE); - } - - /* return false if destination does not have required mod time */ - - if (statbufDst.st_mtim.tv_sec != a_modtime) { - echoDebug(DBG_PKGOPS_MOD_MISMATCH, dstpath, - statbufDst.st_mtim.tv_sec, "source", a_modtime); - return (B_FALSE); - } - - /* - * verify checksums of both files - */ - - /* generate checksum of installed file */ - - cksumerr = 0; - dstcksum = compute_checksum(&cksumerr, dstpath); - if (cksumerr != 0) { - progerr(ERR_CANNOT_CKSUM_FILE, dstpath, strerror(errno)); - return (B_FALSE); - } - - /* return false if destination does not match recorded checksum */ - - if (dstcksum != a_cksum) { - echoDebug(DBG_PKGOPS_CKSUM_MISMATCH, dstpath, dstcksum, - "source", a_cksum); - return (B_FALSE); - } - - /* generate checksum of file to install */ - - cksumerr = 0; - srcksum = compute_checksum(&cksumerr, a_src); - if (cksumerr != 0) { - progerr(ERR_CANNOT_CKSUM_FILE, a_src, strerror(errno)); - return (B_FALSE); - } - - /* return false if source to install does not match recorded checksum */ - - if (srcksum != dstcksum) { - echoDebug(DBG_PKGOPS_CKSUM_MISMATCH, a_src, srcksum, dstpath, - dstcksum); - return (B_FALSE); - } - - /* src/dest identical - return true */ - - echoDebug(DBG_PKGOPS_IS_INHERITED, dstpath, ""); - - return (B_TRUE); -} - /* * return string representing path to "global zone only file" */ @@ -1156,13 +975,6 @@ pkgPackageIsThisZone(char *a_pkgInst) assert(a_pkgInst != (char *)NULL); assert(*a_pkgInst != '\0'); - /* if no inherited file systems, there can be no match */ - - if (numThisZonePackages == 0) { - echoDebug(DBG_PKGOPS_NOT_THISZONE, a_pkgInst); - return (B_FALSE); - } - /* * see if this package is in the "this zone only" list */ diff --git a/usr/src/cmd/svr4pkg/libinst/putparam.c b/usr/src/cmd/svr4pkg/libinst/putparam.c index 532e29bf53..e53d94881f 100644 --- a/usr/src/cmd/svr4pkg/libinst/putparam.c +++ b/usr/src/cmd/svr4pkg/libinst/putparam.c @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -194,7 +193,6 @@ putuserlocale(void) void putConditionInfo(char *a_parentZoneName, char *a_parentZoneType) { - char **pp; char *p; char *pa; SML_TAG *tag = SML_TAG__NULL; @@ -209,7 +207,6 @@ putConditionInfo(char *a_parentZoneName, char *a_parentZoneType) * * zoneType=/> * zoneType=/> - * /> * */ @@ -267,30 +264,6 @@ putConditionInfo(char *a_parentZoneName, char *a_parentZoneType) (void) smlAddTag(&tag, -1, ntag); free(ntag); - /* - * describe any inherited file systems: - * /> - */ - - pp = z_get_inherited_file_systems(); - if (pp != (char **)NULL) { - int n; - for (n = 0; pp[n] != (char *)NULL; n++) { - /* allocate tag for inherited file system info */ - - ntag = smlNewTag(TAG_COND_INHERITED_FS); - - /* inherited file system */ - - smlSetParam(ntag, TAG_COND_FS_NAME, pp[n]); - - /* add to top level tag */ - - (void) smlAddTag(&tag, -1, ntag); - free(ntag); - } - } - /* * done filling in tag - convert to string and place in environment */ -- cgit v1.2.3