From b1e7e97d3b60469b243b3b2e22c7d8cbd11c7c90 Mon Sep 17 00:00:00 2001 From: Andy Fiddaman Date: Thu, 8 Nov 2018 16:34:12 +0000 Subject: [PATCH] =?utf8?q?9969=20svccfg:=20honour=20PKG=5FINSTALL=5FROOT?= =?utf8?q?=20when=20building=20hash=20filename=20Reviewed=20by:=20Toomas?= =?utf8?q?=20Soome=20=20Reviewed=20by:=20Gerg=C5=91=20Mih?= =?utf8?q?=C3=A1ly=20Doma=20=20Reviewed=20by:=20Peter?= =?utf8?q?=20Tribble=20=20Approved=20by:=20Dan=20?= =?utf8?q?McDonald=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- usr/src/cmd/svc/common/manifest_hash.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/usr/src/cmd/svc/common/manifest_hash.c b/usr/src/cmd/svc/common/manifest_hash.c index 20f49b11ca..683f701361 100644 --- a/usr/src/cmd/svc/common/manifest_hash.c +++ b/usr/src/cmd/svc/common/manifest_hash.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. */ @@ -245,6 +246,8 @@ mhash_store_entry(scf_handle_t *hndl, const char *name, const char *fname, scf_transaction_entry_t *fe = NULL; scf_error_t err; int ret, result = 0; + char *base; + size_t base_sz = 0; int i; @@ -366,9 +369,17 @@ mhash_store_entry(scf_handle_t *hndl, const char *name, const char *fname, goto out; } + /* + * Remove any PKG_INSTALL_ROOT from the manifest filename so that it + * points to the correct location following installation. + */ + base = getenv("PKG_INSTALL_ROOT"); + if (base != NULL && strncmp(fname, base, strlen(base)) == 0) + base_sz = strlen(base); + ret = scf_value_set_opaque(val, hash, MHASH_SIZE); assert(ret == SCF_SUCCESS); - ret = scf_value_set_astring(fval, fname); + ret = scf_value_set_astring(fval, fname + base_sz); assert(ret == SCF_SUCCESS); if (apply_late == APPLY_LATE) { scf_value_set_boolean(aval, 1); -- 2.11.4.GIT