src/brand/pkgcreatezone
author Mike Gerdts <mike.gerdts@oracle.com>
Fri, 11 Feb 2011 14:04:06 -0800
changeset 2235 1f446820dcb0
parent 2219 60ad60f7592c
child 2310 ce10607d5332
permissions -rwxr-xr-x
17791 ipkg brand needs to be in sync with revised dataset layout 17654 check for zonepath in GZ ROOT assumes root pool named rpool
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
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    38
f_a_obs=$(gettext "-a publisher=uri option is obsolete, use -P instead.")
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    39
f_pkg5_missing=$(gettext "pkg(5) does not seem to be present on this system.\n")
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    40
f_no_pref_publisher=$(gettext "Unable to get global zone preferred publisher information, and none was supplied.\nYou must specify one using the -P option.")
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    41
f_key_file=$(gettext "Key file not allowed without -P")
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    42
f_cert_file=$(gettext "Cert file not allowed without -P")
954
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")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    44
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
    45
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
    46
f_bad_publisher=$(gettext "Syntax error in publisher information.")
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    47
f_no_entire_in_pref=$(gettext "Unable to locate the incorporation '%s' in the preferred publisher '%s'.\nUse -P to supply a publisher which contains this package.\n")
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    48
f_key_prop=$(gettext "Unable to propagate key %s to %s")
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    49
f_cert_prop=$(gettext "Unable to propagate cert %s to %s")
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    50
f_get_secinfo=$(gettext "Failed to get key/cert information for publisher %s")
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    51
f_nosuch_key=$(gettext "Failed to find key %s")
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    52
f_nosuch_cert=$(gettext "Failed to find cert %s")
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    53
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    54
m_publisher=$(gettext   "   Publisher: Using %s (%s).")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    55
m_cache=$(gettext       "       Cache: Using %s.")
1091
fc73bc2d78ce 7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents: 954
diff changeset
    56
m_image=$(gettext       "       Image: Preparing at %s.")
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    57
m_incorp=$(gettext      "Sanity Check: Looking for 'entire' incorporation.\n")
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    58
m_key_prop=$(gettext    " Credentials: Propagating %s\n")
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    59
m_cert_prop=$(gettext   " Credentials: Propagating %s\n")
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
    60
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
    61
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
    62
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
    63
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
    64
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    65
m_usage=$(gettext "\n        install [-h]\n        install [-c certificate_file] [-k key_file] [-P publisher=uri]\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
    66
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    67
m_done=$(gettext      " done.")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    68
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    69
trap_cleanup() {
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    70
	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
    71
	exit $EXIT_CODE
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    72
}
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    73
2235
1f446820dcb0 17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents: 2219
diff changeset
    74
EXIT_CODE=$ZONE_SUBPROC_NOTCOMPLETE
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    75
trap trap_cleanup INT
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    76
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    77
extra_packages=""
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    78
ZONENAME=""
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    79
ZONEPATH=""
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
    80
pub_and_origins=""
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
    81
pub_and_mirrors=""
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    82
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    83
# Setup i18n output
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    84
TEXTDOMAIN="SUNW_OST_OSCMD"
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    85
export TEXTDOMAIN
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    86
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    87
KEYDIR=/var/pkg/ssl
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    88
PKG=/usr/bin/pkg
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    89
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    90
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    91
# Just in case.  This should probably be removed later.
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    92
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    93
[[ ! -x $PKG ]] && fail_incomplete "$f_pkg5_missing"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    94
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    95
certfile="None"
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    96
keyfile="None"
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    97
unset install_archive
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    98
unset source_dir
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    99
unset msg
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   100
unset silent_mode
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   101
unset verbose_mode
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   102
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   103
while getopts "a:c:d:e:hk:P:pR:suvz:" opt; do
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   104
	case $opt in
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   105
		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
   106
			if [[ ! -f $OPTARG ]]; then
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   107
				# 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
   108
				echo $OPTARG | egrep -s =
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   109
				if (( $? == 0 )); then
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   110
					fail_usage "$f_a_obs"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   111
				fi
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   112
			fi
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   113
			install_archive="-a $OPTARG";;
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   114
		c)	certfile="$OPTARG" ;;
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   115
		d)	source_dir="-d $OPTARG";;
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   116
		e)	extra_packages="$extra_packages $OPTARG" ;;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   117
		h)	fail_usage "";;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   118
		k)	keyfile="$OPTARG" ;;
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   119
		P)	pub_and_origins="$OPTARG" ;;
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   120
		p)	preserve_zone="-p";;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   121
		R)	ZONEPATH="$OPTARG" ;;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   122
		s)	silent_mode=1;;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   123
		u)	unconfig_zone="-u";;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   124
		v)	verbose_mode="-v";;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   125
		z)	ZONENAME="$OPTARG" ;;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   126
		*)	fail_usage "";;
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   127
	esac
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   128
done
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   129
shift $((OPTIND-1))
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   130
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   131
if [[ -z $ZONEPATH || -z $ZONENAME ]]; then
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   132
	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
   133
	exit $ZONE_SUBPROC_USAGE
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   134
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
   135
zone=
1f446820dcb0 17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents: 2219
diff changeset
   136
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
   137
eval $(bind_legacy_zone_globals zone)
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   138
1275
7bdf8c791f04 9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1111
diff changeset
   139
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
   140
brand_labeled=$?
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   141
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   142
secinfo=""
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   143
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   144
# 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
   145
[[ -n "$install_archive" && -n "$source_dir" ]] &&
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   146
    fail_usage "$f_incompat_options" "-a" "-d"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   147
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   148
# 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
   149
[[ -n $silent_mode && -n $verbose_mode ]] && \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   150
    fail_usage "$f_incompat_options" "-s" "-v"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   151
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   152
# The install can't both preserve and unconfigure
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   153
[[ -n $unconfig_zone && -n $preserve_zone ]] && \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   154
    fail_usage "$f_incompat_options" "-u" "-p"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   155
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   156
# 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
   157
if [[ -n "$install_archive" || -n "$source_dir" ]]; then
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   158
	[[ -n $pub_and_origins ]] && fail_usage "$f_incompat_options" \
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   159
	    "-a|-d" "-P"
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   160
	[[ -n "$extra_packages" ]] && \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   161
	    fail_usage "$f_incompat_options" "-a|-d" "-e"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   162
	[[ "$certfile" != "None" ]] && \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   163
	    fail_usage "$f_incompat_options" "-a|-d" "-c"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   164
	[[ "$keyfile" != "None" ]] && \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   165
	    fail_usage "$f_incompat_options" "-a|-d" "-k"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   166
fi
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   167
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   168
# 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
   169
if [[ -z $install_archive && -z $source_dir ]]; then
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   170
	[[ -n $preserve_zone || -n $unconfig_zone ]] && \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   171
		fail_usage "$f_incompat_options" "default" "-p|-u"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   172
fi
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   173
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   174
#
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   175
# If the user didn't give us a publisher, and there's a preferred publisher set
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   176
# for the system, set that as the default.
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   177
#
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   178
propagate_secinfo=
1466
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   179
propagate_extra=
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   180
if [[ -z $pub_and_origins ]]; then
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   181
	if [[ $keyfile != "None" ]]; then
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   182
		fail_usage "$f_key_file"
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   183
	fi
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   184
	if [[ $certfile != "None" ]]; then
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   185
		fail_usage "$f_cert_file"
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   186
	fi
1466
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   187
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   188
	# Look for a preferred online origin.
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   189
	tpub_and_origins=$(get_publisher_urls preferred origin)
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   190
	[[ $? -eq 0 && -n $tpub_and_origins ]] && \
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   191
	    pub_and_origins="$tpub_and_origins"
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   192
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   193
	# Get preferred mirror information as well if the above succeeded.
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   194
	if [[ -n "$tpub_and_origins" ]]; then
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   195
		tpub_and_mirrors=$(get_publisher_urls preferred mirror)
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   196
		[[ $? -eq 0 && -n $tpub_and_mirrors ]] && \
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   197
		    pub_and_mirrors="$tpub_and_mirrors"
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   198
	fi
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   199
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   200
	# Note that later we need to propagate key & cert.
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   201
	propagate_secinfo=1
1466
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   202
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   203
	#
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   204
	# since the user didn't specify a publisher, propagate all the
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   205
	# publishers that don't have a key.
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   206
	#
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   207
	propagate_extra=1
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   208
fi
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   209
[[ -z $pub_and_origins ]] && fail_usage "$f_no_pref_publisher"
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   210
1466
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   211
# find the remaining publishers in the global zone
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   212
publishers_extra_origins=""
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   213
publishers_extra_mirrors=""
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   214
1466
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   215
if [[ -n $propagate_extra ]]; then
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   216
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   217
	# If cert and key information are ever allowed at the origin or
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   218
	# mirror level, then this will have to be changed.
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   219
	get_publisher_urls non-preferred origin | \
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   220
	    while IFS="=" read pub pub_urls; do
2219
60ad60f7592c 2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents: 2210
diff changeset
   221
		if [[ "$pub_urls" != "None" ]]; then
60ad60f7592c 2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents: 2210
diff changeset
   222
			# skip extra publishers that need a key/cert
60ad60f7592c 2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents: 2210
diff changeset
   223
			[[ "`get_pub_secinfo $pub`" != "None None" ]] && \
60ad60f7592c 2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents: 2210
diff changeset
   224
			    continue
60ad60f7592c 2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents: 2210
diff changeset
   225
		else
60ad60f7592c 2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents: 2210
diff changeset
   226
			pub_urls=""
60ad60f7592c 2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents: 2210
diff changeset
   227
		fi
1466
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   228
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   229
		if [[ -z "$publishers_extra_origins" ]]; then
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   230
			publishers_extra_origins="$pub=$pub_urls"
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   231
		else
2150
1f1a0297186a 17112 pkgcreatezone adds extra publishers in reverse order
Dan Price <daniel.price@oracle.com>
parents: 2148
diff changeset
   232
			publishers_extra_origins=$(printf "%s\n%s" \
1f1a0297186a 17112 pkgcreatezone adds extra publishers in reverse order
Dan Price <daniel.price@oracle.com>
parents: 2148
diff changeset
   233
			    "$publishers_extra_origins" \
1f1a0297186a 17112 pkgcreatezone adds extra publishers in reverse order
Dan Price <daniel.price@oracle.com>
parents: 2148
diff changeset
   234
			    "$pub=$pub_urls")
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   235
		fi
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   236
	done
1466
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   237
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   238
	get_publisher_urls non-preferred mirror | \
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   239
	    while IFS="=" read pub pub_urls; do
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   240
		# skip extra publishers that need a key/cert
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   241
		[[ "`get_pub_secinfo $pub`" != "None None" ]] && \
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   242
		    continue
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   243
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   244
		if [[ -z "$publishers_extra_mirrors" ]]; then
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   245
			publishers_extra_mirrors="$pub=$pub_urls"
1466
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   246
		else
2150
1f1a0297186a 17112 pkgcreatezone adds extra publishers in reverse order
Dan Price <daniel.price@oracle.com>
parents: 2148
diff changeset
   247
			publishers_extra_mirrors=$(printf "%s\n%s" \
1f1a0297186a 17112 pkgcreatezone adds extra publishers in reverse order
Dan Price <daniel.price@oracle.com>
parents: 2148
diff changeset
   248
			    "$publishers_extra_mirrors" \
1f1a0297186a 17112 pkgcreatezone adds extra publishers in reverse order
Dan Price <daniel.price@oracle.com>
parents: 2148
diff changeset
   249
			    "$pub=$pub_urls")
1466
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   250
		fi
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   251
	done
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   252
fi
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   253
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   254
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   255
# Crack pub=url into two pieces.
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   256
#
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   257
echo $pub_and_origins | IFS="=" read publisher pub_origins
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   258
if [[ -z $publisher || -z $pub_origins ]]; then
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   259
	fail_usage "$f_bad_publisher"
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   260
fi
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   261
echo $pub_and_mirrors | IFS="=" read ignored pub_mirrors
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   262
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   263
if [[ -n $propagate_secinfo ]]; then
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   264
	#
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   265
	# Get the global zone's cert and key (if any) so that we can propagate
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   266
	# them into the new image.
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   267
	#
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   268
	get_pub_secinfo $publisher | read keyfile certfile
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   269
	if [[ $? -ne 0 ]]; then
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   270
		fail_usage "$f_get_secinfo" $publisher
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   271
	fi
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   272
fi
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   273
#
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   274
# Do some sanity checks on key and cert.
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   275
#
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   276
[[ $keyfile != "None" && ! -f $keyfile ]] && \
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   277
    fail_usage "$f_nosuch_key" $keyfile
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   278
[[ $certfile != "None" && ! -f $certfile ]] && \
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   279
    fail_usage "$f_nosuch_cert" $certfile
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   280
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   281
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   282
# 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
   283
# 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
   284
# 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
   285
# 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
   286
# 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
   287
#
1879
7dc50f542f19 14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1709
diff changeset
   288
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
   289
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   290
#
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   291
# 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
   292
# dataset.
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   293
#
2235
1f446820dcb0 17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents: 2219
diff changeset
   294
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
   295
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
   296
579
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   297
#
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   298
# 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
   299
#
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   300
if [[ -n $install_archive || -n $source_dir ]]; then
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   301
	/usr/lib/brand/ipkg/image_install $ZONENAME $ZONEPATH \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   302
	    $install_archive $source_dir $verbose_mode $silent_mode \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   303
	    $unconfig_zone $preserve_zone
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   304
	ii_result=$?
579
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   305
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   306
	if (( $ii_result != 0 )); then
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   307
		exit $ZONE_SUBPROC_NOTCOMPLETE
943
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   308
	fi
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   309
	exit $ZONE_SUBPROC_OK
943
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   310
fi
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   311
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   312
# Display preferred publisher origin and mirror information.
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   313
printf "$m_publisher\n" $publisher "$pub_origins $pub_mirrors"
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   314
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   315
# Display extra publisher origin and mirror information.  This does mean that
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   316
# the extras have to be displayed twice to show mirror information.
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   317
if [[ -n "$publishers_extra_origins" ]]; then
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   318
	echo "$publishers_extra_origins" | while IFS="=" read pub pub_urls; do
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   319
		printf "$m_publisher\n" $pub "$pub_urls"
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   320
	done
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   321
	if [[ -n "$publishers_extra_mirrors" ]]; then
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   322
		echo "$publishers_extra_mirrors" | while IFS="=" read pub pub_urls; do
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   323
			printf "$m_publisher\n" $pub "$pub_urls"
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   324
		done
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   325
	fi
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   326
fi
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   327
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   328
printf "$m_image\n" $ZONEROOT
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   329
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   330
#
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   331
# We copy the credentials from the global zone into the new image
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   332
# we're about to create.
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   333
#
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   334
if [[ $keyfile != "None" ]]; then
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   335
	newkeylocation="$KEYDIR/$(basename $keyfile)"
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   336
	secinfo="$secinfo -k $newkeylocation"
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   337
	printf "$m_key_prop\n" $(basename $keyfile)
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   338
	mkdir -p -m 755 $ZONEROOT/$KEYDIR || fail_fatal "$f_key_prop"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   339
	cp $keyfile $ZONEROOT/$newkeylocation || fail_fatal "$f_key_prop"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   340
	chmod 644 $ZONEROOT/$newkeylocation
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   341
	chown -h root:root $ZONEROOT/$newkeylocation
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   342
fi
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   343
if [[ $certfile != "None" ]]; then
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   344
	newcertlocation="$KEYDIR/$(basename $certfile)"
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   345
	secinfo="$secinfo -c $newcertlocation"
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   346
	printf "$m_cert_prop\n" $(basename $certfile)
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   347
	mkdir -p -m 755 $ZONEROOT/$KEYDIR || fail_fatal "$f_cert_prop"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   348
	cp $certfile $ZONEROOT/$newcertlocation || fail_fatal "$f_cert_prop"
2179
d5e39d973fdd 17653 zone install fails with pkg.oracle.com/solaris/support set
Tim Foster <tim.s.foster@oracle.com>
parents: 2175
diff changeset
   349
	chmod 644 $ZONEROOT/$newcertlocation
d5e39d973fdd 17653 zone install fails with pkg.oracle.com/solaris/support set
Tim Foster <tim.s.foster@oracle.com>
parents: 2175
diff changeset
   350
	chown -h root:root $ZONEROOT/$newcertlocation
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   351
fi
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   352
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   353
#
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   354
# Regrettably, since we already copied the key information into place,
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   355
# we must pass the -f (force) option to image-create, since it thinks that
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   356
# something must be wrong, as the image exists.
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   357
#
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   358
pub_first_origin=""
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   359
pub_add_origins=""
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   360
for origin in $pub_origins; do
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   361
	if [[ -z "$pub_first_origin" ]]; then
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   362
		# The first origin is semi-special in that the publisher
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   363
		# argument to image-create requires it to be specified
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   364
		# by itself and then any additional origins after that.
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   365
		# Technically, image-create doesn't care if you specify
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   366
		# the first one again using -g, but there's no point in
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   367
		# doing so.
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   368
		pub_first_origin=$origin
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   369
		continue
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   370
	fi
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   371
	pub_add_origins="${pub_add_origins}-g $origin "
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   372
done
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   373
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   374
pub_add_mirrors=""
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   375
for mirror in $pub_mirrors; do
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   376
	pub_add_mirrors="${pub_add_mirrors}-m $mirror "
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   377
done
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   378
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   379
#
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   380
# The image is created with --no-refresh so that all of the publisher
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   381
# configuration can be put into place first before attempting to retrieve
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   382
# and build catalog information.  This substantially reduces the amount of
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   383
# time needed to create a zone.
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   384
#
1879
7dc50f542f19 14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1709
diff changeset
   385
LC_ALL=C $PKG image-create -f --no-refresh --zone --full \
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   386
    -p $publisher=$pub_first_origin $pub_add_origins $pub_add_mirrors $secinfo \
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   387
    $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
   388
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   389
# Retrieve publisher attributes and update our new publisher
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   390
attrs=$(get_publisher_attr_args $publisher "origin")
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   391
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   392
# 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
   393
# on the newly created zone rather than the global zone
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   394
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   395
PKG_IMAGE="$ZONEROOT"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   396
export PKG_IMAGE
1466
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   397
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   398
# --no-refresh is used here so that update operations can be
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   399
# coalesced.
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   400
# Update our new publisher
1879
7dc50f542f19 14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1709
diff changeset
   401
LC_ALL=C $PKG set-publisher --no-refresh $attrs $publisher \
7dc50f542f19 14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1709
diff changeset
   402
    || fail_incomplete "$f_img"
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   403
1466
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   404
# add extra publishers
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   405
# If cert and key information are ever allowed at the origin or
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   406
# mirror level, then this will have to be changed.
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   407
if [[ -n "$publishers_extra_origins" ]]; then
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   408
	echo "$publishers_extra_origins" | while IFS="=" read pub pub_urls; do
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   409
		pub_prefix=$pub
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   410
		pub_add_origins=""
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   411
		for origin in $pub_urls; do
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   412
			pub_add_origins="${pub_add_origins}-g $origin "
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   413
		done
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   414
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   415
		# Retrieve publisher attributes. Since we are retrieving
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   416
		# these attributes from the GLOBAL zone, we must reset
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   417
		# PKG_IMAGE temporarily
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   418
		SAVE_PKG_IMAGE=$PKG_IMAGE
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   419
		PKG_IMAGE=$GZ_IMAGE
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   420
		export PKG_IMAGE
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   421
		attrs=$(get_publisher_attr_args $pub_prefix "origin")
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   422
		# Now restore the save PKG_IMAGE value
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   423
		PKG_IMAGE=$SAVE_PKG_IMAGE
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   424
		export PKG_IMAGE
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   425
		# --no-refresh is used here so that update operations can be
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   426
		# coalesced.
1879
7dc50f542f19 14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1709
diff changeset
   427
		LC_ALL=C $PKG set-publisher --no-refresh $attrs \
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   428
                    ${pub_add_origins}${pub_prefix} || fail_incomplete "$f_img"
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   429
	done
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   430
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   431
	if [[ -n "$publishers_extra_mirrors" ]]; then
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   432
		echo "$publishers_extra_mirrors" | \
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   433
		    while IFS="=" read pub pub_urls; do
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   434
			pub_prefix=$pub
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   435
			pub_add_mirrors=""
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   436
			for mirror in $pub_urls; do
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   437
				pub_add_mirrors="${pub_add_mirrors}-m $mirror "
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   438
			done
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   439
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   440
			# Retrieve publisher attributes. Since we are retrieving
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   441
			# these attributes from the GLOBAL zone, we must reset
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   442
			# PKG_IMAGE temporarily
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   443
			SAVE_PKG_IMAGE=$PKG_IMAGE
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   444
			PKG_IMAGE=$GZ_IMAGE
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   445
			export PKG_IMAGE
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   446
			attrs=$(get_publisher_attr_args $pub_prefix "mirror")
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   447
			PKG_IMAGE=$SAVE_PKG_IMAGE
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   448
			export PKG_IMAGE
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   449
			# --no-refresh is used here so that update operations
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   450
			# can be coalesced.
1879
7dc50f542f19 14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1709
diff changeset
   451
			LC_ALL=C $PKG set-publisher --no-refresh $attrs \
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   452
			    ${pub_add_mirrors}${pub_prefix} || \
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   453
			    fail_incomplete "$f_img"
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   454
		done
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   455
	fi
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   456
fi
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   457
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   458
# Now that all of the publisher configurations are in place, attempt a refresh.
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   459
# If this fails, assume the image is incomplete.
1879
7dc50f542f19 14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1709
diff changeset
   460
LC_ALL=C $PKG refresh || fail_incomplete "$f_img"
1466
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   461
2148
5625d3707d5b 17424 zone cache usage needs adjustment for new image format
Shawn Walker <shawn.walker@oracle.com>
parents: 2123
diff changeset
   462
if [[ -f /var/pkg/pkg5.image && -d /var/pkg/publisher ]]; then
5625d3707d5b 17424 zone cache usage needs adjustment for new image format
Shawn Walker <shawn.walker@oracle.com>
parents: 2123
diff changeset
   463
	PKG_CACHEROOT=/var/pkg/publisher
5625d3707d5b 17424 zone cache usage needs adjustment for new image format
Shawn Walker <shawn.walker@oracle.com>
parents: 2123
diff changeset
   464
	export PKG_CACHEROOT
5625d3707d5b 17424 zone cache usage needs adjustment for new image format
Shawn Walker <shawn.walker@oracle.com>
parents: 2123
diff changeset
   465
	printf "$m_cache\n" $PKG_CACHEROOT
554
fe196874250d 3508 zone install should utilize/populate global zone d/l cache
Dan Price <dp@eng.sun.com>
parents: 547
diff changeset
   466
fi
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   467
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   468
#
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   469
# If we found an "entire" incorporation in the current image, then
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   470
# check to see if the user's choice of preferred publisher contains the
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   471
# version of the 'entire' incorporation needed.  This helps us to prevent
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   472
# mishaps in the event the user selected some weirdo publisher as their
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   473
# preferred one, or passed a preferred pub on the command line which doesn't
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   474
# have a suitable 'entire' in it.
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   475
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   476
# n.b. it would be nice to do this before we provision the zfs dataset, etc.
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   477
# but since the publisher specified by the user might not be known to
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   478
# the system, we can't do this test without first configuring the image.
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   479
#
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   480
if [[ -n $entire_fmri ]]; then
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   481
	printf "$m_incorp\n"
1879
7dc50f542f19 14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1709
diff changeset
   482
	LC_ALL=C $PKG list -af pkg://$publisher/$entire_fmri > /dev/null 2>&1
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   483
	if [[ $? -ne 0 ]]; then
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   484
		fail_fatal "$f_no_entire_in_pref" $entire_fmri $publisher
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   485
	fi
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   486
fi
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   487
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   488
printf "$m_core\n"
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   489
pkglist=""
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   490
if [[ -n $entire_fmri ]]; then
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   491
	pkglist="$pkglist $entire_fmri"
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   492
fi
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   493
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   494
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   495
	pkg:///SUNWcs
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   496
	pkg:///SUNWcsd
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   497
	pkg:///system/network
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   498
	pkg:///system/extended-system-utilities
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   499
	pkg:///service/management/sysidtool
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   500
	pkg:///system/management/sysidtool
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   501
	pkg:///compress/bzip2
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   502
	pkg:///compress/gzip
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   503
	pkg:///compress/zip
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   504
	pkg:///compress/unzip
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   505
	pkg:///package/pkg"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   506
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   507
#
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   508
# Get some diagnostic tools, truss, dtrace, etc.
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   509
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   510
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   511
	pkg:///developer/linker
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   512
	pkg:///developer/dtrace"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   513
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   514
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   515
# 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
   516
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   517
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   518
	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
   519
	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
   520
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   521
#
2190
07952cb65bba 12757 Add pkg:/network/dns/bind to the zones default set
Dan Price <daniel.price@oracle.com>
parents: 2179
diff changeset
   522
# 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
   523
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   524
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   525
	pkg:///shell/bash
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   526
	pkg:///editor/vim
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   527
	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
   528
	pkg:///network/ssh/ssh-key
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   529
	pkg:///service/network/ssh"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   530
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   531
#
2190
07952cb65bba 12757 Add pkg:/network/dns/bind to the zones default set
Dan Price <daniel.price@oracle.com>
parents: 2179
diff changeset
   532
# Get some name services and DNS.
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   533
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   534
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   535
	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
   536
	pkg:///network/dns/bind
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   537
	pkg:///naming/ldap"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   538
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   539
#
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   540
# 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
   541
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   542
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   543
	pkg:///system/file-system/autofs
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   544
	pkg:///system/file-system/nfs"
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   545
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   546
#
1362
4485bac2b3d8 10410 exclusive stack zones can't find a default router
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1323
diff changeset
   547
# 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
   548
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   549
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   550
	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
   551
4485bac2b3d8 10410 exclusive stack zones can't find a default router
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1323
diff changeset
   552
#
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   553
# 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
   554
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   555
(( $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
   556
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   557
#
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   558
# Get man(1) but not the man pages
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   559
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   560
pkglist="$pkglist \
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   561
	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
   562
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   563
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   564
# 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
   565
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   566
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
   567
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   568
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   569
# 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
   570
# 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
   571
#
2123
33e0355a44f1 17316 zones create and attach fail with must-accept license
Mark J. Nelson <Mark.J.Nelson@Oracle.COM>
parents: 1879
diff changeset
   572
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
   573
    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
   574
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   575
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
   576
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   577
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
   578
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
   579
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
   580
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
   581
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
   582
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
   583
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   584
# This was formerly done in i.manifest
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   585
repfile=$ZONEROOT/etc/svc/repository.db
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   586
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
   587
chmod 0600 $repfile
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   588
chown root:sys $repfile
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   589
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   590
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
   591
1275
7bdf8c791f04 9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1111
diff changeset
   592
#
7bdf8c791f04 9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1111
diff changeset
   593
# Make sure sysidtools run; we manually poke in the SSH action
7bdf8c791f04 9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1111
diff changeset
   594
# so that we get an SSH key.  Yes, this is seriously borken.
7bdf8c791f04 9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1111
diff changeset
   595
# See http://defect.opensolaris.org/bz/show_bug.cgi?id=741
7bdf8c791f04 9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1111
diff changeset
   596
#
7bdf8c791f04 9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1111
diff changeset
   597
printf "$m_more_brokenness\n"
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   598
/usr/sbin/sysidconfig -b $ZONEROOT -a /lib/svc/method/sshd
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   599
touch $ZONEROOT/etc/.UNCONFIGURED
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   600
1526
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   601
#
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   602
# 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
   603
# 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
   604
# 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
   605
# 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
   606
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
   607
	cd /etc/gconf
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   608
	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
   609
		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
   610
			if [ -d $i ]; then
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   611
				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
   612
			else
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   613
				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
   614
				    $ZONEROOT/etc/gconf/$i
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   615
			fi
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   616
		fi
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   617
	done
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   618
fi
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   619
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   620
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
   621
if (( $brand_labeled == 0 )); then
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   622
	printf "$m_postnote\n"
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   623
	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
   624
else
625950c12e71 3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents: 1483
diff changeset
   625
	# 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
   626
	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
   627
fi
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   628
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   629
exit $ZONE_SUBPROC_OK