src/brand/pkgcreatezone
author Edward Pilatowicz <edward.pilatowicz@oracle.com>
Sat, 07 May 2011 00:25:10 -0700
changeset 2339 aa5954c06b9d
parent 2338 63a4d56416c6
child 2344 b12ba91586e6
permissions -rwxr-xr-x
16148 need linked image support for zones, phase 1 16568 zoneadm install can create out of sync zones if entire has been removed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     1
#!/bin/ksh -p
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     2
#
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     3
# CDDL HEADER START
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     4
#
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     8
#
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    12
# and limitations under the License.
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    13
#
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    19
#
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    20
# CDDL HEADER END
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    21
#
1879
7dc50f542f19 14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1709
diff changeset
    22
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    23
#
2171
cf06895223e5 16983 ipkg brand install script needs change wrt. to SUNWman package
Dan Price <daniel.price@oracle.com>
parents: 2150
diff changeset
    24
# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    25
#
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    26
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    27
#
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    28
# Resetting GZ_IMAGE to something besides slash allows for simplified
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    29
# debugging of various global zone image configurations-- simply make
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    30
# an image somewhere with the appropriate interesting parameters.
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    31
#
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    32
GZ_IMAGE=${GZ_IMAGE:-/}
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    33
PKG_IMAGE=$GZ_IMAGE
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    34
export PKG_IMAGE
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    35
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
    36
. /usr/lib/brand/ipkg/common.ksh
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    37
2339
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
    38
# Allows developers to override some things like PATH and PYTHONPATH
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
    39
. /usr/lib/brand/ipkg/developerenv.ksh
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
    40
2338
63a4d56416c6 18240 zone proxy needed
johansen <johansen@opensolaris.org>
parents: 2334
diff changeset
    41
f_a_obs=$(gettext "-a publisher=uri option is obsolete.")
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    42
f_pkg5_missing=$(gettext "pkg(5) does not seem to be present on this system.\n")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    43
f_img=$(gettext "failed to create image\n")
2339
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
    44
f_imglink=$(gettext "failed to link image to global zone\n")
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    45
f_pkg=$(gettext "failed to install package\n")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    46
f_interrupted=$(gettext "Installation cancelled due to interrupt.\n")
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    47
f_bad_publisher=$(gettext "Syntax error in publisher information.")
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    48
1091
fc73bc2d78ce 7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents: 954
diff changeset
    49
m_image=$(gettext       "       Image: Preparing at %s.")
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
    50
m_core=$(gettext	"  Installing: Packages (output follows)\n")
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
    51
m_smf=$(gettext		" Postinstall: Copying SMF seed repository ...")
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    52
m_more_brokenness=$(gettext " Postinstall: Applying workarounds.")
2171
cf06895223e5 16983 ipkg brand install script needs change wrt. to SUNWman package
Dan Price <daniel.price@oracle.com>
parents: 2150
diff changeset
    53
m_mannote=$(gettext     "        Note: Man pages can be obtained by installing pkg:/system/manual")
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    54
2338
63a4d56416c6 18240 zone proxy needed
johansen <johansen@opensolaris.org>
parents: 2334
diff changeset
    55
m_usage=$(gettext "\n        install [-h]\n        install\n                [-e extrapkg [...]]\n        install {-a archive|-d path} {-p|-u} [-s|-v]")
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    56
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    57
m_done=$(gettext      " done.")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    58
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    59
trap_cleanup() {
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    60
	print "$f_interrupted"
2235
1f446820dcb0 17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents: 2219
diff changeset
    61
	exit $EXIT_CODE
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    62
}
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    63
2235
1f446820dcb0 17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents: 2219
diff changeset
    64
EXIT_CODE=$ZONE_SUBPROC_NOTCOMPLETE
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    65
trap trap_cleanup INT
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    66
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    67
extra_packages=""
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    68
ZONENAME=""
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    69
ZONEPATH=""
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    70
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    71
# Setup i18n output
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    72
TEXTDOMAIN="SUNW_OST_OSCMD"
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    73
export TEXTDOMAIN
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    74
2339
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
    75
PKG=pkg
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    76
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    77
unset install_archive
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    78
unset source_dir
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    79
unset msg
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    80
unset silent_mode
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    81
unset verbose_mode
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    82
2338
63a4d56416c6 18240 zone proxy needed
johansen <johansen@opensolaris.org>
parents: 2334
diff changeset
    83
while getopts "a:d:e:hpR:suvz:" opt; do
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    84
	case $opt in
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    85
		a)	# We're expecting a path to an archive
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    86
			if [[ ! -f $OPTARG ]]; then
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
    87
				# If old style 'pub=uri' parameter then error.
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    88
				echo $OPTARG | egrep -s =
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    89
				if (( $? == 0 )); then
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    90
					fail_usage "$f_a_obs"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    91
				fi
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    92
			fi
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
    93
			install_archive="-a $OPTARG";;
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
    94
		d)	source_dir="-d $OPTARG";;
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    95
		e)	extra_packages="$extra_packages $OPTARG" ;;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    96
		h)	fail_usage "";;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    97
		p)	preserve_zone="-p";;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    98
		R)	ZONEPATH="$OPTARG" ;;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    99
		s)	silent_mode=1;;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   100
		u)	unconfig_zone="-u";;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   101
		v)	verbose_mode="-v";;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   102
		z)	ZONENAME="$OPTARG" ;;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   103
		*)	fail_usage "";;
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   104
	esac
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   105
done
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   106
shift $((OPTIND-1))
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   107
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   108
if [[ -z $ZONEPATH || -z $ZONENAME ]]; then
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   109
	print -u2 "Brand error: No zone path or name"
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   110
	exit $ZONE_SUBPROC_USAGE
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   111
fi
2235
1f446820dcb0 17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents: 2219
diff changeset
   112
zone=
1f446820dcb0 17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents: 2219
diff changeset
   113
init_zone zone "$ZONENAME" "$ZONEPATH"
1f446820dcb0 17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents: 2219
diff changeset
   114
eval $(bind_legacy_zone_globals zone)
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   115
1275
7bdf8c791f04 9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1111
diff changeset
   116
is_brand_labeled
1493
625950c12e71 3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents: 1483
diff changeset
   117
brand_labeled=$?
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   118
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   119
# An image install can't use both -a AND -d...
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   120
[[ -n "$install_archive" && -n "$source_dir" ]] &&
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   121
    fail_usage "$f_incompat_options" "-a" "-d"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   122
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   123
# The install can't be both verbose AND silent...
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   124
[[ -n $silent_mode && -n $verbose_mode ]] && \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   125
    fail_usage "$f_incompat_options" "-s" "-v"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   126
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   127
# The install can't both preserve and unconfigure
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   128
[[ -n $unconfig_zone && -n $preserve_zone ]] && \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   129
    fail_usage "$f_incompat_options" "-u" "-p"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   130
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   131
# IPS options aren't allowed when installing from a system image.
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   132
if [[ -n "$install_archive" || -n "$source_dir" ]]; then
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   133
	[[ -n "$extra_packages" ]] && \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   134
	    fail_usage "$f_incompat_options" "-a|-d" "-e"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   135
fi
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   136
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   137
# p2v options aren't allowed when installing from a repo.
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   138
if [[ -z $install_archive && -z $source_dir ]]; then
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   139
	[[ -n $preserve_zone || -n $unconfig_zone ]] && \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   140
		fail_usage "$f_incompat_options" "default" "-p|-u"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   141
fi
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   142
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   143
#
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   144
# Look for the 'entire' incorporation's FMRI in the current image; due to users
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   145
# doing weird machinations with their publishers, we strip off the publisher
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   146
# from the FMRI if it is present.
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   147
# It's ok to not find entire in the current image, since this means the user
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   148
# can install pre-release development bits for testing purposes.
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   149
#
1879
7dc50f542f19 14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1709
diff changeset
   150
entire_fmri=$(get_entire_incorp)
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   151
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   152
#
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   153
# Before installing the zone, set up ZFS dataset hierarchy for the zone root
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   154
# dataset.
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   155
#
2235
1f446820dcb0 17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents: 2219
diff changeset
   156
create_active_ds zone || fail_fatal "$f_no_ds"
1f446820dcb0 17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents: 2219
diff changeset
   157
mount_active_be -c zone || fail_fatal "$f_no_ds"
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   158
579
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   159
#
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   160
# If we're installing from an image, branch off to that installer.
579
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   161
#
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   162
if [[ -n $install_archive || -n $source_dir ]]; then
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   163
	/usr/lib/brand/ipkg/image_install $ZONENAME $ZONEPATH \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   164
	    $install_archive $source_dir $verbose_mode $silent_mode \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   165
	    $unconfig_zone $preserve_zone
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   166
	ii_result=$?
579
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   167
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   168
	if (( $ii_result != 0 )); then
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   169
		exit $ZONE_SUBPROC_NOTCOMPLETE
943
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   170
	fi
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   171
	exit $ZONE_SUBPROC_OK
943
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   172
fi
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   173
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   174
printf "$m_image\n" $ZONEROOT
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   175
2338
63a4d56416c6 18240 zone proxy needed
johansen <johansen@opensolaris.org>
parents: 2334
diff changeset
   176
enable_zones_services
63a4d56416c6 18240 zone proxy needed
johansen <johansen@opensolaris.org>
parents: 2334
diff changeset
   177
if [[ $? -ne 0 ]]; then
63a4d56416c6 18240 zone proxy needed
johansen <johansen@opensolaris.org>
parents: 2334
diff changeset
   178
	exit $ZONE_SUBPROC_NOTCOMPLETE
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   179
fi
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   180
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   181
#
2338
63a4d56416c6 18240 zone proxy needed
johansen <johansen@opensolaris.org>
parents: 2334
diff changeset
   182
# The image is created.
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   183
#
2338
63a4d56416c6 18240 zone proxy needed
johansen <johansen@opensolaris.org>
parents: 2334
diff changeset
   184
LC_ALL=C $PKG image-create --zone --full \
63a4d56416c6 18240 zone proxy needed
johansen <johansen@opensolaris.org>
parents: 2334
diff changeset
   185
    --set-property use-system-repo=true \
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   186
    $ZONEROOT || fail_incomplete "$f_img"
438
69202d962ff6 2736 IPS branded zones should install the entire encorporation
Danek Duvall <danek.duvall@sun.com>
parents: 371
diff changeset
   187
2339
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   188
# Link this image to the parent image.
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   189
printf "$m_image_link\n" $GZ_IMAGE
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   190
LC_ALL=C $PKG attach-linked -q -f --no-refresh --no-index --linked-md-only \
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   191
    -c zone:$ZONENAME $ZONEROOT || fail_incomplete "$f_imglink"
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   192
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   193
# Change the value of PKG_IMAGE so that future PKG operation will work
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   194
# on the newly created zone rather than the global zone
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   195
PKG_IMAGE="$ZONEROOT"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   196
export PKG_IMAGE
1466
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   197
2339
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   198
if [[ -f /var/pkg/pkg5.image && -d /var/pkg/publisher ]]; then
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   199
	# respect PKG_CACHEROOT if the caller has it set.
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   200
	[ -z "$PKG_CACHEROOT" ] && PKG_CACHEROOT=/var/pkg/publisher
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   201
	export PKG_CACHEROOT
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   202
	printf "$m_cache\n" $PKG_CACHEROOT
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   203
fi
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   204
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   205
printf "$m_core\n"
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   206
pkglist=""
2339
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   207
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   208
#
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   209
# 'entire' is essentially optional-- if you don't have it in your global
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   210
# zone, you are probably an OS developer, and therefore you probably don't
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   211
# want it in your non-global zone.  We follow the preference we find in
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   212
# the global zone.
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   213
if [[ -n $entire_fmri ]]; then
2339
aa5954c06b9d 16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents: 2338
diff changeset
   214
	pkglist="$pkglist pkg:///entire"
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   215
fi
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   216
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   217
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   218
	pkg:///SUNWcs
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   219
	pkg:///SUNWcsd
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   220
	pkg:///system/network
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   221
	pkg:///system/extended-system-utilities
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   222
	pkg:///service/management/sysidtool
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   223
	pkg:///system/management/sysidtool
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   224
	pkg:///compress/bzip2
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   225
	pkg:///compress/gzip
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   226
	pkg:///compress/zip
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   227
	pkg:///compress/unzip
2338
63a4d56416c6 18240 zone proxy needed
johansen <johansen@opensolaris.org>
parents: 2334
diff changeset
   228
	pkg:///package/pkg
63a4d56416c6 18240 zone proxy needed
johansen <johansen@opensolaris.org>
parents: 2334
diff changeset
   229
        pkg:///package/pkg/system-repository"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   230
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   231
#
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   232
# Get some diagnostic tools, truss, dtrace, etc.
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   233
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   234
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   235
	pkg:///developer/linker
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   236
	pkg:///developer/dtrace"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   237
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   238
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   239
# Needed for 'whois', 'snoop' I think; also provides rup, rmt, rsh etc.
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   240
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   241
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   242
	pkg:///service/network/network-clients
2210
4fdfe0367a9c 17720 ipkg brand pkgcreatezone should install ping package
Dan Price <daniel.price@oracle.com>
parents: 2190
diff changeset
   243
	pkg:///network/ping"
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   244
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   245
#
2190
07952cb65bba 12757 Add pkg:/network/dns/bind to the zones default set
Dan Price <daniel.price@oracle.com>
parents: 2179
diff changeset
   246
# Get at least one sensible shell, vim, ssh, ssh key utils, sshd.
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   247
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   248
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   249
	pkg:///shell/bash
2334
9992c899e3a3 18243 zones should install vim-core instead of vim in build 165 and later
Danek Duvall <danek.duvall@oracle.com>
parents: 2321
diff changeset
   250
	pkg:///editor/vim/vim-core
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   251
	pkg:///network/ssh
2190
07952cb65bba 12757 Add pkg:/network/dns/bind to the zones default set
Dan Price <daniel.price@oracle.com>
parents: 2179
diff changeset
   252
	pkg:///network/ssh/ssh-key
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   253
	pkg:///service/network/ssh"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   254
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   255
#
2190
07952cb65bba 12757 Add pkg:/network/dns/bind to the zones default set
Dan Price <daniel.price@oracle.com>
parents: 2179
diff changeset
   256
# Get some name services and DNS.
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   257
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   258
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   259
	pkg:///system/network/nis
2190
07952cb65bba 12757 Add pkg:/network/dns/bind to the zones default set
Dan Price <daniel.price@oracle.com>
parents: 2179
diff changeset
   260
	pkg:///network/dns/bind
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   261
	pkg:///naming/ldap"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   262
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   263
#
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   264
# Get nfs client and autofs; it's a pain not to have them.
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   265
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   266
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   267
	pkg:///system/file-system/autofs
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   268
	pkg:///system/file-system/nfs"
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   269
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   270
#
1362
4485bac2b3d8 10410 exclusive stack zones can't find a default router
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1323
diff changeset
   271
# Get routing daemons.  They're required for useful exclusive stack zones.
4485bac2b3d8 10410 exclusive stack zones can't find a default router
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1323
diff changeset
   272
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   273
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   274
	pkg:///system/network/routing"
1362
4485bac2b3d8 10410 exclusive stack zones can't find a default router
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1323
diff changeset
   275
4485bac2b3d8 10410 exclusive stack zones can't find a default router
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1323
diff changeset
   276
#
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   277
# Get packages for TX zones if appropriate.
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   278
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   279
(( $brand_labeled == 1 )) && pkglist="$pkglist pkg:///system/trusted/trusted-nonglobal"
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   280
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   281
#
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   282
# Get man(1) but not the man pages
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   283
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   284
pkglist="$pkglist \
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   285
	pkg:///text/doctools"
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   286
2321
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   287
# 
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   288
# packages needed for sysconfig in zone
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   289
#
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   290
pkglist="$pkglist \
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   291
	pkg:///system/install
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   292
	pkg:///system/install/configuration
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   293
	pkg:///system/library/install
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   294
	pkg:///security/sudo"
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   295
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   296
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   297
# Add in any extra packages requested by the user.
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   298
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   299
pkglist="$pkglist $extra_packages"
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   300
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   301
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   302
# Do the install; we just refreshed after image-create, so skip that.  We
1091
fc73bc2d78ce 7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents: 954
diff changeset
   303
# also skip indexing here, as that is also what the LiveCD does.
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   304
#
2123
33e0355a44f1 17316 zones create and attach fail with must-accept license
Mark J. Nelson <Mark.J.Nelson@Oracle.COM>
parents: 1879
diff changeset
   305
LC_ALL=C $PKG install --accept --no-index --no-refresh $pkglist || \
33e0355a44f1 17316 zones create and attach fail with must-accept license
Mark J. Nelson <Mark.J.Nelson@Oracle.COM>
parents: 1879
diff changeset
   306
    pkg_err_check "$f_pkg"
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   307
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   308
printf "\n$m_mannote\n"
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   309
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   310
printf "$m_smf"
2175
58dc93ac193c 17600 SMF profile symlink creation in pkgcreatezone is broken by early mfst import
Dan Price <daniel.price@oracle.com>
parents: 2172
diff changeset
   311
PROFILEDIR=etc/svc/profile
58dc93ac193c 17600 SMF profile symlink creation in pkgcreatezone is broken by early mfst import
Dan Price <daniel.price@oracle.com>
parents: 2172
diff changeset
   312
ln -s ns_files.xml $ZONEROOT/$PROFILEDIR/name_service.xml
58dc93ac193c 17600 SMF profile symlink creation in pkgcreatezone is broken by early mfst import
Dan Price <daniel.price@oracle.com>
parents: 2172
diff changeset
   313
ln -s generic_limited_net.xml $ZONEROOT/$PROFILEDIR/generic.xml
58dc93ac193c 17600 SMF profile symlink creation in pkgcreatezone is broken by early mfst import
Dan Price <daniel.price@oracle.com>
parents: 2172
diff changeset
   314
ln -s inetd_generic.xml $ZONEROOT/$PROFILEDIR/inetd_services.xml
58dc93ac193c 17600 SMF profile symlink creation in pkgcreatezone is broken by early mfst import
Dan Price <daniel.price@oracle.com>
parents: 2172
diff changeset
   315
ln -s platform_none.xml $ZONEROOT/$PROFILEDIR/platform.xml
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   316
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   317
# This was formerly done in i.manifest
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   318
repfile=$ZONEROOT/etc/svc/repository.db
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   319
cp $ZONEROOT/lib/svc/seed/nonglobal.db $repfile
371
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   320
chmod 0600 $repfile
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   321
chown root:sys $repfile
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   322
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   323
printf "$m_done\n"
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   324
1275
7bdf8c791f04 9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1111
diff changeset
   325
#
2321
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   326
# If unconfig service exists and is online then copy in enable_sci.xml
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   327
# sysconfig file to trigger config cycle on boot of zone.
1275
7bdf8c791f04 9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1111
diff changeset
   328
#
2321
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   329
SC_ONLINE=$(svcprop -p restarter/state \
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   330
    svc:/milestone/unconfig:default 2> /dev/null)
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   331
if (( $? == 0 )) && [[ $SC_ONLINE == "online" ]]; then
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   332
	cp /usr/share/auto_install/sc_profiles/enable_sci.xml \
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   333
	    $ZONEROOT/etc/svc/profile/site
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   334
else
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   335
	#
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   336
	# Make sure sysidtools run; we manually poke in the SSH action
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   337
	# so that we get an SSH key.  Yes, this is seriously borken.
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   338
	# See http://defect.opensolaris.org/bz/show_bug.cgi?id=741
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   339
	#
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   340
	printf "$m_more_brokenness\n"
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   341
	/usr/sbin/sysidconfig -b $ZONEROOT -a /lib/svc/method/sshd
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   342
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   343
	touch $ZONEROOT/etc/.UNCONFIGURED
5741d6cd0988 17995 Add packages required by SC to pkgcreatezone
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents: 2315
diff changeset
   344
fi
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   345
1526
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   346
#
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   347
# Labeled zones need to be able to modify /etc/gconf files, when gnome
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   348
# packages are installed in the zone.  Set up links in the zone to the
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   349
# global zone files -- this will provide default versions from the global
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   350
# zone, which can be modified by the zone, breaking the link.
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   351
if (( $brand_labeled == 1 )); then
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   352
	cd /etc/gconf
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   353
	for i in $(find .); do
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   354
		if [ ! -e $ZONEROOT/etc/gconf/$i ]; then
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   355
			if [ -d $i ]; then
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   356
				mkdir $ZONEROOT/etc/gconf/$i
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   357
			else
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   358
				ln -s /etc/gconf-global/$i \
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   359
				    $ZONEROOT/etc/gconf/$i
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   360
			fi
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   361
		fi
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   362
	done
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   363
fi
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   364
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   365
printf "$m_complete\n\n" ${SECONDS}
1493
625950c12e71 3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents: 1483
diff changeset
   366
if (( $brand_labeled == 0 )); then
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   367
	printf "$m_postnote\n"
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   368
	printf "$m_postnote2\n"
1493
625950c12e71 3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents: 1483
diff changeset
   369
else
625950c12e71 3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents: 1483
diff changeset
   370
	# Umount the dataset on the root.
625950c12e71 3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents: 1483
diff changeset
   371
	umount $ZONEROOT || printf "$f_zfs_unmount" "$ZONEPATH/root"
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   372
fi
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   373
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   374
exit $ZONE_SUBPROC_OK