src/brand/pkgcreatezone
author David.Comay@Sun.COM
Wed, 06 May 2009 22:14:43 -0700
changeset 1108 14533641d138
parent 1091 fc73bc2d78ce
child 1111 26c3e2407c53
permissions -rwxr-xr-x
8031 IPS changes to address trusted zone installation breakage 8332 Wrong permissions on git perl include files in SUNWgit package 8404 webstack ui package incorrectly depends on SUNWphp52d 8435 nmap package missing dependency on SUNWpysqlite 8467 SUNWapch22 is missing a dependency on SUNWapu13-ldap => crash 8546 Korean characters are garbaged on java 8626 resync repository to snv_111b 8643 upgrading causes usr/sfw/man to disappear
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
#
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    22
#
943
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
    23
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    24
# Use is subject to license terms.
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
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
    27
. /usr/lib/brand/ipkg/common.ksh
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    28
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    29
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
    30
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.\n")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    31
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
    32
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
    33
f_interrupted=$(gettext "Installation cancelled due to interrupt.\n")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    34
f_bad_publisher=$(gettext "Syntax error in publisher information.\n")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    35
f_no_entire=$(gettext "Unable to find 'entire' incorporation in the global zone image.\n")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    36
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")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    37
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    38
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    39
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
    40
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
    41
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
    42
m_incorp=$(gettext      "Sanity Check: Looking for 'entire' incorporation.\n")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    43
m_core=$(gettext        "  Installing: Core System (output follows)\n")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    44
m_more=$(gettext        "  Installing: Additional Packages (output follows)\n")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    45
m_smf=$(gettext	        " Postinstall: Copying SMF seed repository ...")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    46
m_more_brokenness=$(gettext " Postinstall: Applying workarounds.")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    47
m_mannote=$(gettext     "        Note: Man pages can be obtained by installing SUNWman")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    48
m_complete=$(gettext    "        Done: Installation completed in %s seconds.")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    49
m_postnote=$(gettext    "  Next Steps: Boot the zone, then log into the zone console")
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    50
m_postnote2=$(gettext "             (zlogin -C) to complete the configuration process")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    51
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    52
m_usage=$(gettext    "$0: [-h] [-P publisher=uri] [-e extrapkg [...]]")
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    53
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    54
m_done=$(gettext      " done.")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    55
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
    56
is_system_labeled() {
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
    57
	sys_labeled=0
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
    58
	[ ! -x /bin/plabel ] && return
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
    59
	/bin/plabel > /dev/null 2>&1
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
    60
	[[ $? -eq 0 ]] && sys_labeled=1
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
    61
}
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
    62
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    63
trap_cleanup() {
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    64
	print "$f_interrupted"
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    65
	exit $int_code
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    66
}
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    67
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    68
int_code=$ZONE_SUBPROC_NOTCOMPLETE
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    69
trap trap_cleanup INT
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
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
extra_packages=""
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    72
zonename=""
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    73
zonepath=""
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    74
pub_and_url=""
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    75
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    76
# Setup i18n output
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    77
TEXTDOMAIN="SUNW_OST_OSCMD"
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    78
export TEXTDOMAIN
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    79
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    80
PKG=/usr/bin/pkg
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    81
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    82
# 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
    83
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    84
[[ ! -x $PKG ]] && fail_incomplete "$f_pkg5_missing"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    85
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    86
while getopts "a:P:z:R:h:e:" opt; do
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    87
	case $opt in
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    88
		h)	fail_usage "$m_usage";;
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    89
		R)	zonepath="$OPTARG" ;;
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    90
		z)	zonename="$OPTARG" ;;
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    91
		a)	pub_and_url="$OPTARG";
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    92
			print -u2 \
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    93
			    "WARNING: -a is deprecated.  Use -P instead." ;;
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    94
		P)	pub_and_url="$OPTARG" ;;
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    95
		e)	extra_packages="$extra_packages $OPTARG" ;;
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
    96
		*)	fail_usage "$m_usage";;
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    97
	esac
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    98
done
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    99
shift $((OPTIND-1))
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   100
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   101
if [[ -z $zonepath || -z $zonename ]]; then
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   102
	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
   103
	exit $ZONE_SUBPROC_USAGE
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   104
fi
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   105
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   106
is_system_labeled
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   107
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   108
zoneroot=$zonepath/root
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   109
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   110
#
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   111
# 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
   112
# 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
   113
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   114
if [[ -z $pub_and_url ]]; then
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   115
	#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   116
	# We look for a preferred online origin.
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   117
	#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   118
	tpub_and_url=`LC_ALL=C $PKG -R / publisher -PH | \
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   119
	    awk '$2 == "origin" && $3 == "online" \
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   120
	    {printf "%s=%s\n", $1, $4; exit 0;}'`
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   121
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   122
	[[ $? -eq 0 && -n $tpub_and_url ]] && pub_and_url="$tpub_and_url"
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   123
fi
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   124
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   125
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   126
# In the unlikely event that we were not able to get the system's
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   127
# preferred publisher, and that the user didn't give us a publisher, we
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   128
# prompt the user to provide it.
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   129
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   130
[[ -z $pub_and_url ]] && fail_usage "$f_no_pref_publisher"
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   131
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   132
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   133
# 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
   134
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   135
echo $pub_and_url | IFS== read publisher publisherurl
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   136
if [[ -z $publisher || -z $publisherurl ]]; then
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   137
	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
   138
fi
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   139
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   140
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   141
# 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
   142
# 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
   143
# from the FMRI if it is present.
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   144
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   145
raw_entire_fmri=$($PKG list -Hv entire | nawk '{print $1}')
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   146
entire_fmri=$(echo $raw_entire_fmri | sed 's@^pkg://[^/]*/@@')
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   147
entire_fmri=$(echo $entire_fmri | sed 's@^pkg:/@@')
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   148
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   149
if [[ -z $entire_fmri ]]; then
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   150
	fail_incomplete "$f_no_entire"
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   151
fi
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   152
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   153
#
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   154
# 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
   155
# dataset.
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   156
#
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   157
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   158
get_current_gzbe
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   159
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   160
# Find the zone's current dataset.  This should have been created by zoneadm.
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   161
get_zonepath_ds $zonepath
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   162
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   163
# Check that zone is not in the ROOT dataset.
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   164
fail_zonepath_in_rootds $ZONEPATH_DS
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   165
579
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   166
#
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   167
# From here on, errors should cause the zone to be incomplete.
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   168
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   169
int_code=$ZONE_SUBPROC_FATAL
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   170
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   171
#
579
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   172
# We need to tolerate errors while creating the datasets and making the
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   173
# mountpoint, since these could already exist from some other BE.
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   174
#
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   175
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   176
/usr/sbin/zfs list -H -o name $ZONEPATH_DS/ROOT >/dev/null 2>&1
943
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   177
if (( $? != 0 )); then
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   178
	/usr/sbin/zfs create -o mountpoint=legacy -o zoned=on $ZONEPATH_DS/ROOT
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   179
	if (( $? != 0 )); then
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   180
		fail_fatal "$f_zfs_create"
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   181
	fi
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   182
fi
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   183
579
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   184
BENAME=zbe
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   185
BENUM=0
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   186
# Try 100 different names before giving up.
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   187
while [ $BENUM -lt 100 ]; do
943
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   188
       	/usr/sbin/zfs create -o $PROP_ACTIVE=on -o $PROP_PARENT=$CURRENT_GZBE \
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   189
	    -o canmount=noauto $ZONEPATH_DS/ROOT/$BENAME >/dev/null 2>&1
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   190
	if (( $? == 0 )); then
e04a1ccbeac8 7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents: 579
diff changeset
   191
		break
579
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   192
	fi
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   193
        BENUM=`expr $BENUM + 1`
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   194
	BENAME="zbe-$BENUM"
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   195
done
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   196
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   197
if [ $BENUM -ge 100 ]; then
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   198
	fail_fatal "$f_zfs_create"
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   199
fi
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   200
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   201
if [ ! -d $zoneroot ]; then
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   202
	/usr/bin/mkdir $zoneroot
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   203
fi
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   204
d6ab4f57f07d 3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents: 554
diff changeset
   205
/usr/sbin/mount -F zfs $ZONEPATH_DS/ROOT/$BENAME $zoneroot || \
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   206
	fail_incomplete "$f_zfs_mount"
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   207
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   208
#
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   209
# Done setting up the zone's datasets.
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   210
#
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   211
printf "$m_publisher" $publisher $publisherurl
1091
fc73bc2d78ce 7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents: 954
diff changeset
   212
printf "\n$m_image\n" $zoneroot
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   213
$PKG image-create --zone --full -p "$pub_and_url" $zoneroot || \
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   214
	fail_incomplete "$f_img"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   215
438
69202d962ff6 2736 IPS branded zones should install the entire encorporation
Danek Duvall <danek.duvall@sun.com>
parents: 371
diff changeset
   216
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   217
PKG_IMAGE="$zoneroot"
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   218
export PKG_IMAGE
554
fe196874250d 3508 zone install should utilize/populate global zone d/l cache
Dan Price <dp@eng.sun.com>
parents: 547
diff changeset
   219
if [ -d /var/pkg/download ]; then
fe196874250d 3508 zone install should utilize/populate global zone d/l cache
Dan Price <dp@eng.sun.com>
parents: 547
diff changeset
   220
	PKG_CACHEDIR=/var/pkg/download
fe196874250d 3508 zone install should utilize/populate global zone d/l cache
Dan Price <dp@eng.sun.com>
parents: 547
diff changeset
   221
	export PKG_CACHEDIR
fe196874250d 3508 zone install should utilize/populate global zone d/l cache
Dan Price <dp@eng.sun.com>
parents: 547
diff changeset
   222
	printf "$m_cache\n" $PKG_CACHEDIR
fe196874250d 3508 zone install should utilize/populate global zone d/l cache
Dan Price <dp@eng.sun.com>
parents: 547
diff changeset
   223
fi
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   224
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   225
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   226
# Check to see if the user's choice of preferred publisher contains the
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   227
# 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
   228
# 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
   229
# 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
   230
# 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
   231
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   232
# 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
   233
# 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
   234
# 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
   235
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   236
printf "$m_incorp\n"
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   237
$PKG list -a pkg://$publisher/$entire_fmri > /dev/null 2>&1
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   238
if [[ $? -ne 0 ]]; then
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   239
	fail_fatal "$f_no_entire_in_pref" $entire_fmri $publisher
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   240
fi
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   241
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   242
printf "$m_core\n"
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   243
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   244
# We have to take baby steps here: first, by installing entire, to
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   245
# constrain everything.  Then, SUNWcsd, to lay down device files which
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   246
# are subsequently needed by driver actions.  Then SUNWcs to lay down
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   247
# /etc/passwd, /etc/group, etc so that subsequent user and group actions
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   248
# work.  This can all hopefully go away once "primordial" actions
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   249
# arrive.
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   250
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   251
$PKG install -q --no-refresh --no-index $entire_fmri || fail_fatal "$f_pkg"
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   252
$PKG install -q --no-refresh --no-index SUNWcsd || fail_fatal "$f_pkg"
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   253
$PKG install --no-refresh --no-index SUNWcs || fail_fatal "$f_pkg"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   254
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   255
printf "$m_more\n"
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   256
pkglist=""
344
4c887185d780 528 pkg list -u gives confusing output
Dan Price <dp@eng.sun.com>
parents: 329
diff changeset
   257
pkglist="$pkglist SUNWcnetr SUNWesu SUNWadmr SUNWadmap SUNWbzip SUNWgzip"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   258
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   259
#
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   260
# Workaround: For now, SUNWipkg has no dependency on python, so we supply it.
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   261
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   262
pkglist="$pkglist SUNWPython SUNWipkg"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   263
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   264
#
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   265
# Get some diagnostic tools, truss, dtrace, etc.
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   266
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   267
pkglist="$pkglist SUNWtoo SUNWdtrc SUNWrcmdc SUNWbip"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   268
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   269
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   270
# Get at least one sensible shell, and vi
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   271
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   272
pkglist="$pkglist SUNWbash SUNWvim"
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   273
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   274
#
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   275
# Get ssh and sshd.
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   276
#
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   277
pkglist="$pkglist SUNWsshcu SUNWssh SUNWsshd"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   278
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   279
#
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   280
# Get some name services.
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   281
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   282
pkglist="$pkglist SUNWnis SUNWlldap"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   283
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   284
#
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   285
# 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
   286
#
344
4c887185d780 528 pkg list -u gives confusing output
Dan Price <dp@eng.sun.com>
parents: 329
diff changeset
   287
pkglist="$pkglist SUNWnfsc SUNWatfs"
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   288
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   289
#
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   290
# 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
   291
#
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   292
if [ $sys_labeled -ne 0 ]; then
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   293
	#
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   294
	# Get opengl initialization
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   295
	#
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   296
	pkglist="$pkglist SUNWxwplr"
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   297
	#
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   298
	# Get D-Bus
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   299
	#
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   300
	pkglist="$pkglist SUNWdbus"
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   301
fi
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   302
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   303
#
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   304
# Get man(1) but not the man pages
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   305
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   306
pkglist="$pkglist SUNWdoc"
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   307
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   308
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   309
# 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
   310
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   311
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
   312
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   313
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   314
# Do the install; we just refreshed on 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
   315
# 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
   316
#
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   317
$PKG install --no-index --no-refresh $pkglist || fail_fatal "$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
   318
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   319
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
   320
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   321
printf "$m_smf"
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   322
ln -s ns_files.xml $zoneroot/var/svc/profile/name_service.xml
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   323
ln -s generic_limited_net.xml $zoneroot/var/svc/profile/generic.xml
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   324
ln -s inetd_generic.xml $zoneroot/var/svc/profile/inetd_services.xml
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   325
ln -s platform_none.xml $zoneroot/var/svc/profile/platform.xml
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   326
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   327
# This was formerly done in i.manifest
371
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   328
repfile=$zoneroot/etc/svc/repository.db
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   329
cp $zoneroot/lib/svc/seed/nonglobal.db $repfile
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   330
chmod 0600 $repfile
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   331
chown root:sys $repfile
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   332
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   333
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
   334
528
697d894dca64 681 root as a role and "jack" user scheme doesn't work with IPS zones
Dave Miner <dminer@opensolaris.org>
parents: 438
diff changeset
   335
# Clean up root as a role and jack if needed
697d894dca64 681 root as a role and "jack" user scheme doesn't work with IPS zones
Dave Miner <dminer@opensolaris.org>
parents: 438
diff changeset
   336
if grep "^root::::type=role;" $zoneroot/etc/user_attr >/dev/null 2>&1; then
697d894dca64 681 root as a role and "jack" user scheme doesn't work with IPS zones
Dave Miner <dminer@opensolaris.org>
parents: 438
diff changeset
   337
	printf "$m_brokenness\n"
697d894dca64 681 root as a role and "jack" user scheme doesn't work with IPS zones
Dave Miner <dminer@opensolaris.org>
parents: 438
diff changeset
   338
	#
697d894dca64 681 root as a role and "jack" user scheme doesn't work with IPS zones
Dave Miner <dminer@opensolaris.org>
parents: 438
diff changeset
   339
	# Remove "jack" user.
697d894dca64 681 root as a role and "jack" user scheme doesn't work with IPS zones
Dave Miner <dminer@opensolaris.org>
parents: 438
diff changeset
   340
	#
697d894dca64 681 root as a role and "jack" user scheme doesn't work with IPS zones
Dave Miner <dminer@opensolaris.org>
parents: 438
diff changeset
   341
	print "/^jack:/d\nw" | ed -s $zoneroot/etc/passwd
697d894dca64 681 root as a role and "jack" user scheme doesn't work with IPS zones
Dave Miner <dminer@opensolaris.org>
parents: 438
diff changeset
   342
	chmod u+w $zoneroot/etc/shadow
697d894dca64 681 root as a role and "jack" user scheme doesn't work with IPS zones
Dave Miner <dminer@opensolaris.org>
parents: 438
diff changeset
   343
	print "/^jack:/d\nw" | ed -s $zoneroot/etc/shadow
697d894dca64 681 root as a role and "jack" user scheme doesn't work with IPS zones
Dave Miner <dminer@opensolaris.org>
parents: 438
diff changeset
   344
	chmod u-w $zoneroot/etc/shadow
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   345
528
697d894dca64 681 root as a role and "jack" user scheme doesn't work with IPS zones
Dave Miner <dminer@opensolaris.org>
parents: 438
diff changeset
   346
	#
697d894dca64 681 root as a role and "jack" user scheme doesn't work with IPS zones
Dave Miner <dminer@opensolaris.org>
parents: 438
diff changeset
   347
	# Set root from a role back to... not a role.  Grr.
697d894dca64 681 root as a role and "jack" user scheme doesn't work with IPS zones
Dave Miner <dminer@opensolaris.org>
parents: 438
diff changeset
   348
	#
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 943
diff changeset
   349
	print "s/^root::::type=role;/root::::/\nw" |
528
697d894dca64 681 root as a role and "jack" user scheme doesn't work with IPS zones
Dave Miner <dminer@opensolaris.org>
parents: 438
diff changeset
   350
	    ed -s $zoneroot/etc/user_attr
697d894dca64 681 root as a role and "jack" user scheme doesn't work with IPS zones
Dave Miner <dminer@opensolaris.org>
parents: 438
diff changeset
   351
fi
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   352
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   353
if [ $sys_labeled -eq 0 ]; then
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   354
	#
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   355
	# Make sure sysidtools run; we manually poke in the SSH action
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   356
	# so that we get an SSH key.  Yes, this is seriously borken.
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   357
	# See http://defect.opensolaris.org/bz/show_bug.cgi?id=741
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   358
	#
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   359
	printf "$m_more_brokenness\n"
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   360
	/usr/sbin/sysidconfig -b $zoneroot -a /lib/svc/method/sshd
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   361
	touch $zoneroot/etc/.UNCONFIGURED
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   362
fi
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   363
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   364
# Umount the dataset on the root.
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   365
/usr/sbin/umount $zoneroot
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   366
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   367
printf "$m_complete\n\n" ${SECONDS}
1108
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   368
if [ $sys_labeled -eq 0 ]; then
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   369
	printf "$m_postnote\n"
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   370
	printf "$m_postnote2\n"
14533641d138 8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents: 1091
diff changeset
   371
fi
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   372
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   373
exit $ZONE_SUBPROC_OK