src/brand/pkgcreatezone
author Brock Pytlik <brock.pytlik@oracle.com>
Wed, 27 Apr 2011 20:30:32 -0700
changeset 2310 ce10607d5332
parent 2235 1f446820dcb0
child 2315 c9b0cbb2c713
permissions -rwxr-xr-x
11684 desire option to not propagate certs to non-global zones 17522 system repository should provide basic functionality 17523 Need a functioning sysdepo 17524 system depot should auto generate its configuration based on system image 17525 system depot should respond to versions/0 17526 system depot should provide publisher configuration 17527 caching should be enabled for system depot 17528 system depot should proxy http repositories 17529 system depot should proxy https repositories 17530 pkg client needs to be aware of the system repository 17531 pkg needs to cache system publisher information 17532 pkg should retrieve publisher information from the system repository when configured 17533 pkg needs to use the system repository as a proxy for http repositories 17534 pkg needs to use the system repository as a proxy for https repositories 17535 need an image property to indicate whether to use the system repository 17536 an image shouldn't require any configured publishers 17537 notion of preferred publisher should be removed 17538 pkg should be able to merge system publisher info with locally configured publishers 17539 pkg should notify that users cannot modify system publishers in certain ways 17540 pkg publisher needs to be updated to include information about system publishers 17541 pkg will need a way to specify alternate system repository urls 17547 file repositories need to be proxied by the system repository 17594 pkg set-publisher in GZ should refresh sysdepo service 17604 converting an imageconfig object to a string causes an infinite loop 17847 pkg set-publisher shouldn't allow -P along with --search-* 17911 pkg image-create should allow an image to be created without a publisher 18200 need a manpage for the sysrepo service
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
2310
ce10607d5332 11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents: 2235
diff changeset
    38
f_a_obs=$(gettext "-a publisher=uri option is obsolete.")
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    39
f_pkg5_missing=$(gettext "pkg(5) does not seem to be present on this system.\n")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    40
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
    41
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
    42
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
    43
f_bad_publisher=$(gettext "Syntax error in publisher information.")
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    44
1091
fc73bc2d78ce 7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents: 954
diff changeset
    45
m_image=$(gettext       "       Image: Preparing at %s.")
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
    46
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
    47
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
    48
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
    49
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
    50
2310
ce10607d5332 11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents: 2235
diff changeset
    51
m_usage=$(gettext "\n        install [-h]\n        install\n                [-e extrapkg [...]]\n        install {-a archive|-d path} {-p|-u} [-s|-v]")
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    52
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    53
m_done=$(gettext      " done.")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    54
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    55
trap_cleanup() {
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    56
	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
    57
	exit $EXIT_CODE
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    58
}
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    59
2235
1f446820dcb0 17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents: 2219
diff changeset
    60
EXIT_CODE=$ZONE_SUBPROC_NOTCOMPLETE
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    61
trap trap_cleanup INT
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    62
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    63
extra_packages=""
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    64
ZONENAME=""
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    65
ZONEPATH=""
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    66
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    67
# Setup i18n output
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    68
TEXTDOMAIN="SUNW_OST_OSCMD"
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    69
export TEXTDOMAIN
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    70
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    71
PKG=/usr/bin/pkg
2310
ce10607d5332 11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents: 2235
diff changeset
    72
export PKG
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
    73
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    74
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    75
# 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
    76
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    77
[[ ! -x $PKG ]] && fail_incomplete "$f_pkg5_missing"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    78
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    79
unset install_archive
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    80
unset source_dir
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    81
unset msg
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    82
unset silent_mode
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    83
unset verbose_mode
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    84
2310
ce10607d5332 11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents: 2235
diff changeset
    85
while getopts "a:d:e:hpR:suvz:" opt; do
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    86
	case $opt in
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    87
		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
    88
			if [[ ! -f $OPTARG ]]; then
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
    89
				# 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
    90
				echo $OPTARG | egrep -s =
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    91
				if (( $? == 0 )); then
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    92
					fail_usage "$f_a_obs"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    93
				fi
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    94
			fi
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
    95
			install_archive="-a $OPTARG";;
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
    96
		d)	source_dir="-d $OPTARG";;
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    97
		e)	extra_packages="$extra_packages $OPTARG" ;;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    98
		h)	fail_usage "";;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
    99
		p)	preserve_zone="-p";;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   100
		R)	ZONEPATH="$OPTARG" ;;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   101
		s)	silent_mode=1;;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   102
		u)	unconfig_zone="-u";;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   103
		v)	verbose_mode="-v";;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   104
		z)	ZONENAME="$OPTARG" ;;
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   105
		*)	fail_usage "";;
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   106
	esac
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   107
done
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   108
shift $((OPTIND-1))
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   109
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   110
if [[ -z $ZONEPATH || -z $ZONENAME ]]; then
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   111
	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
   112
	exit $ZONE_SUBPROC_USAGE
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   113
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
   114
zone=
1f446820dcb0 17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents: 2219
diff changeset
   115
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
   116
eval $(bind_legacy_zone_globals zone)
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   117
1275
7bdf8c791f04 9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1111
diff changeset
   118
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
   119
brand_labeled=$?
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   120
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   121
# 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
   122
[[ -n "$install_archive" && -n "$source_dir" ]] &&
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   123
    fail_usage "$f_incompat_options" "-a" "-d"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   124
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   125
# 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
   126
[[ -n $silent_mode && -n $verbose_mode ]] && \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   127
    fail_usage "$f_incompat_options" "-s" "-v"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   128
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   129
# The install can't both preserve and unconfigure
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   130
[[ -n $unconfig_zone && -n $preserve_zone ]] && \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   131
    fail_usage "$f_incompat_options" "-u" "-p"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   132
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   133
# 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
   134
if [[ -n "$install_archive" || -n "$source_dir" ]]; then
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   135
	[[ -n "$extra_packages" ]] && \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   136
	    fail_usage "$f_incompat_options" "-a|-d" "-e"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   137
fi
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   138
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   139
# 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
   140
if [[ -z $install_archive && -z $source_dir ]]; then
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   141
	[[ -n $preserve_zone || -n $unconfig_zone ]] && \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   142
		fail_usage "$f_incompat_options" "default" "-p|-u"
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   143
fi
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   144
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   145
#
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   146
# 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
   147
# 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
   148
# 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
   149
# 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
   150
# 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
   151
#
1879
7dc50f542f19 14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1709
diff changeset
   152
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
   153
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   154
#
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   155
# 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
   156
# dataset.
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   157
#
2235
1f446820dcb0 17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents: 2219
diff changeset
   158
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
   159
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
   160
579
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   161
#
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   162
# If 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
   163
#
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   164
if [[ -n $install_archive || -n $source_dir ]]; then
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   165
	/usr/lib/brand/ipkg/image_install $ZONENAME $ZONEPATH \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   166
	    $install_archive $source_dir $verbose_mode $silent_mode \
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   167
	    $unconfig_zone $preserve_zone
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   168
	ii_result=$?
579
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   169
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   170
	if (( $ii_result != 0 )); then
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   171
		exit $ZONE_SUBPROC_NOTCOMPLETE
943
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   172
	fi
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   173
	exit $ZONE_SUBPROC_OK
943
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   174
fi
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   175
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   176
printf "$m_image\n" $ZONEROOT
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   177
2310
ce10607d5332 11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents: 2235
diff changeset
   178
enable_zones_services
ce10607d5332 11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents: 2235
diff changeset
   179
if [[ $? -ne 0 ]]; then
ce10607d5332 11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents: 2235
diff changeset
   180
	exit $ZONE_SUBPROC_NOTCOMPLETE
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   181
fi
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   182
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   183
#
2310
ce10607d5332 11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents: 2235
diff changeset
   184
# The image is created.
1111
26c3e2407c53 8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents: 1108
diff changeset
   185
#
2310
ce10607d5332 11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents: 2235
diff changeset
   186
LC_ALL=C $PKG image-create --zone --full \
ce10607d5332 11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents: 2235
diff changeset
   187
    --set-property use-system-repo=true \
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1493
diff changeset
   188
    $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
   189
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   190
# 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
   191
# 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
   192
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   193
PKG_IMAGE="$ZONEROOT"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   194
export PKG_IMAGE
1466
bfdf13d64d47 11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1362
diff changeset
   195
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   196
printf "$m_core\n"
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   197
pkglist=""
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   198
if [[ -n $entire_fmri ]]; then
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   199
	pkglist="$pkglist $entire_fmri"
1709
28592bd37c9d 12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents: 1615
diff changeset
   200
fi
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   201
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   202
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   203
	pkg:///SUNWcs
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   204
	pkg:///SUNWcsd
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   205
	pkg:///system/network
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   206
	pkg:///system/extended-system-utilities
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   207
	pkg:///service/management/sysidtool
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   208
	pkg:///system/management/sysidtool
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   209
	pkg:///compress/bzip2
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   210
	pkg:///compress/gzip
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   211
	pkg:///compress/zip
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   212
	pkg:///compress/unzip
2310
ce10607d5332 11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents: 2235
diff changeset
   213
	pkg:///package/pkg
ce10607d5332 11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents: 2235
diff changeset
   214
        pkg:///package/sysrepo
ce10607d5332 11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents: 2235
diff changeset
   215
        pkg:///package/sysrepo-K"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   216
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   217
#
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   218
# Get some diagnostic tools, truss, dtrace, etc.
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   219
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   220
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   221
	pkg:///developer/linker
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   222
	pkg:///developer/dtrace"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   223
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   224
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   225
# 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
   226
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   227
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   228
	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
   229
	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
   230
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   231
#
2190
07952cb65bba 12757 Add pkg:/network/dns/bind to the zones default set
Dan Price <daniel.price@oracle.com>
parents: 2179
diff changeset
   232
# 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
   233
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   234
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   235
	pkg:///shell/bash
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   236
	pkg:///editor/vim
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   237
	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
   238
	pkg:///network/ssh/ssh-key
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   239
	pkg:///service/network/ssh"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   240
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   241
#
2190
07952cb65bba 12757 Add pkg:/network/dns/bind to the zones default set
Dan Price <daniel.price@oracle.com>
parents: 2179
diff changeset
   242
# Get some name services and DNS.
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   243
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   244
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   245
	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
   246
	pkg:///network/dns/bind
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   247
	pkg:///naming/ldap"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   248
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   249
#
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   250
# 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
   251
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   252
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   253
	pkg:///system/file-system/autofs
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   254
	pkg:///system/file-system/nfs"
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   255
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   256
#
1362
4485bac2b3d8 10410 exclusive stack zones can't find a default router
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1323
diff changeset
   257
# 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
   258
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   259
pkglist="$pkglist
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   260
	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
   261
4485bac2b3d8 10410 exclusive stack zones can't find a default router
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents: 1323
diff changeset
   262
#
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   263
# 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
   264
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   265
(( $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
   266
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   267
#
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   268
# Get man(1) but not the man pages
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   269
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   270
pkglist="$pkglist \
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   271
	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
   272
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   273
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   274
# 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
   275
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   276
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
   277
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   278
#
2172
b69d745fa0f1 15259 pkgcreatezone should reference new package names
Dan Price <daniel.price@oracle.com>
parents: 2171
diff changeset
   279
# 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
   280
# 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
   281
#
2123
33e0355a44f1 17316 zones create and attach fail with must-accept license
Mark J. Nelson <Mark.J.Nelson@Oracle.COM>
parents: 1879
diff changeset
   282
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
   283
    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
   284
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   285
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
   286
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   287
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
   288
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
   289
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
   290
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
   291
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
   292
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
   293
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   294
# This was formerly done in i.manifest
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   295
repfile=$ZONEROOT/etc/svc/repository.db
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   296
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
   297
chmod 0600 $repfile
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   298
chown root:sys $repfile
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   299
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   300
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
   301
1275
7bdf8c791f04 9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1111
diff changeset
   302
#
7bdf8c791f04 9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1111
diff changeset
   303
# 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
   304
# 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
   305
# 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
   306
#
7bdf8c791f04 9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1111
diff changeset
   307
printf "$m_more_brokenness\n"
1483
2276b6786711 6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents: 1466
diff changeset
   308
/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
   309
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
   310
1526
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   311
#
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   312
# 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
   313
# 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
   314
# 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
   315
# 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
   316
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
   317
	cd /etc/gconf
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   318
	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
   319
		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
   320
			if [ -d $i ]; then
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   321
				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
   322
			else
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   323
				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
   324
				    $ZONEROOT/etc/gconf/$i
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   325
			fi
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   326
		fi
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   327
	done
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   328
fi
97adcb21266f 12742 unable to install gnome packages in labeled zones
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents: 1516
diff changeset
   329
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   330
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
   331
if (( $brand_labeled == 0 )); then
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   332
	printf "$m_postnote\n"
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   333
	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
   334
else
625950c12e71 3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents: 1483
diff changeset
   335
	# 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
   336
	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
   337
fi
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   338
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   339
exit $ZONE_SUBPROC_OK