Solaris Zones – SUNWhea package in a non-Global zone

Stupid, but for some reason Solaris 10 (Update 9) doesnt’ allow installation of the SUNWhea package into a non-global zone:

bash-3.00# zonename
zone2
bash-3.00# pkgadd -d /SUNWhea.pkg SUNWhea
pkgadd: ERROR: The package <SUNWhea> may only be installed by the global zone administrator
pkgadd: ERROR: unable to install package <SUNWhea>

1 package was not processed!

 

But you can hack around this:

 

bash-3.00# pkgtrans /SUNWhea.pkg /tmp all
Transferring <SUNWhea> package instance

bash-3.00# sed -e ‘s/SUNW_PKG_ALLZONES=true/SUNW_PKG_ALLZONES=false/’ /tmp/SUNWhea/pkginfo > /tmp/x ; cat /tmp/x > /tmp/SUNWhea/pkginfo

bash-3.00# pkgchk -v -d /tmp SUNWhea
Checking uninstalled directory format package <SUNWhea> from </tmp>
## Checking control scripts.
## Checking package objects.
NOTE: some pathnames are in private formats and cannot be verified
copyright
depend
ERROR: /tmp/SUNWhea/pkginfo
modtime <08/12/10 02:53:04 AM> expected <03/02/11 03:59:53 PM> actual
file size <14297> expected <14298> actual
file cksum <14139> expected <14214> actual
## Checking is complete.

1 i pkginfo 14297 14139 1281545584

bash-3.00# sed -e ‘s/1 i pkginfo.*/1 i pkginfo 14298 14214 1/’ /tmp/SUNWhea/pkgmap> /tmp/x ; cat /tmp/x > /tmp/SUNWhea/pkgmap

bash-3.00# pkgadd -d /tmp SUNWhea

Processing package instance <SUNWhea> from </tmp>

SunOS Header Files(i386) 11.10.0,REV=2005.01.21.16.34
Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
Using </> as the package base directory.
## Processing package information.
## Processing system information.
10 package pathnames are already properly installed.
## Verifying package dependencies.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

This package contains scripts which will be executed with super-user
permission during the process of installing this package.

Do you want to continue with the installation of <SUNWhea> [y,n,?] y

Installing SunOS Header Files as <SUNWhea>

## Installing part 1 of 1.
19162 blocks

Installation of <SUNWhea> was successful.
bash-3.00# pkgchk SUNWhea
bash-3.00# pkginfo SUNWhea
system      SUNWhea SunOS Header Files