author | <gerald.jelinek@sun.com> |
Tue, 10 Nov 2009 14:40:37 -0700 | |
changeset 1483 | 2276b6786711 |
parent 1466 | bfdf13d64d47 |
child 1493 | 625950c12e71 |
permissions | -rwxr-xr-x |
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 |
|
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 | 37 |
|
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
38 |
f_a_obs=$(gettext "-a publisher=uri option is obsolete, use -P instead.") |
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
39 |
f_pkg5_missing=$(gettext "pkg(5) does not seem to be present on this system.\n") |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
40 |
f_no_pref_publisher=$(gettext "Unable to get global zone preferred publisher information, and none was supplied.\nYou must specify one using the -P option.") |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
41 |
f_key_file=$(gettext "Key file not allowed without -P") |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
42 |
f_cert_file=$(gettext "Cert file not allowed without -P") |
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
43 |
f_img=$(gettext "failed to create image\n") |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
44 |
f_pkg=$(gettext "failed to install package\n") |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
45 |
f_interrupted=$(gettext "Installation cancelled due to interrupt.\n") |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
46 |
f_bad_publisher=$(gettext "Syntax error in publisher information.") |
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
47 |
f_no_entire=$(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
|
48 |
f_no_entire_in_pref=$(gettext "Unable to locate the incorporation '%s' in the preferred publisher '%s'.\nUse -P to supply a publisher which contains this package.\n") |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
49 |
f_key_prop=$(gettext "Unable to propagate key %s to %s") |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
50 |
f_cert_prop=$(gettext "Unable to propagate cert %s to %s") |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
51 |
f_get_secinfo=$(gettext "Failed to get key/cert information for publisher %s") |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
52 |
f_nosuch_key=$(gettext "Failed to find key %s") |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
53 |
f_nosuch_cert=$(gettext "Failed to find cert %s") |
168 | 54 |
|
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
55 |
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
|
56 |
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
|
57 |
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
|
58 |
m_incorp=$(gettext "Sanity Check: Looking for 'entire' incorporation.\n") |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
59 |
m_key_prop=$(gettext " Credentials: Propagating %s\n") |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
60 |
m_cert_prop=$(gettext " Credentials: Propagating %s\n") |
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
61 |
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
|
62 |
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
|
63 |
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
|
64 |
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
|
65 |
m_mannote=$(gettext " Note: Man pages can be obtained by installing SUNWman") |
168 | 66 |
|
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
67 |
m_usage=$(gettext "\n install [-h]\n install [-c certificate_file] [-k key_file] [-P publisher=uri]\n [-e extrapkg [...]]\n install {-a archive|-d path} {-p|-u} [-s|-v]") |
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
68 |
|
168 | 69 |
m_done=$(gettext " done.") |
70 |
||
1275
7bdf8c791f04
9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents:
1111
diff
changeset
|
71 |
is_brand_labeled() { |
1323
4521ea470b28
10837 ipkg zone creation will always warn after changeset 7bdf8c791f04
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents:
1275
diff
changeset
|
72 |
brand_labeled=0 |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
73 |
brand=$(/usr/sbin/zoneadm -z $ZONENAME list -p | awk -F: '{print $6}') |
1323
4521ea470b28
10837 ipkg zone creation will always warn after changeset 7bdf8c791f04
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents:
1275
diff
changeset
|
74 |
if [[ $brand == "labeled" ]]; then |
1275
7bdf8c791f04
9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents:
1111
diff
changeset
|
75 |
brand_labeled=1 |
7bdf8c791f04
9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents:
1111
diff
changeset
|
76 |
fi |
1108
14533641d138
8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents:
1091
diff
changeset
|
77 |
} |
14533641d138
8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents:
1091
diff
changeset
|
78 |
|
97
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
79 |
trap_cleanup() { |
168 | 80 |
print "$f_interrupted" |
97
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
81 |
exit $int_code |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
82 |
} |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
83 |
|
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
84 |
int_code=$ZONE_SUBPROC_NOTCOMPLETE |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
85 |
trap trap_cleanup INT |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
86 |
|
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
87 |
extra_packages="" |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
88 |
ZONENAME="" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
89 |
ZONEPATH="" |
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
90 |
pub_and_url="" |
329 | 91 |
|
168 | 92 |
# Setup i18n output |
93 |
TEXTDOMAIN="SUNW_OST_OSCMD" |
|
94 |
export TEXTDOMAIN |
|
95 |
||
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
96 |
KEYDIR=/var/pkg/ssl |
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
97 |
PKG=/usr/bin/pkg |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
98 |
|
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
99 |
# |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
100 |
# 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
|
101 |
# |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
102 |
[[ ! -x $PKG ]] && fail_incomplete "$f_pkg5_missing" |
168 | 103 |
|
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
104 |
certfile="None" |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
105 |
keyfile="None" |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
106 |
unset install_archive |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
107 |
unset source_dir |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
108 |
unset msg |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
109 |
unset silent_mode |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
110 |
unset verbose_mode |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
111 |
|
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
112 |
while getopts "a:c:d:e:hk:P:pR:suvz:" opt; do |
97
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
113 |
case $opt in |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
114 |
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
|
115 |
if [[ ! -f $OPTARG ]]; then |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
116 |
# If old style 'pub=uri' parameter then error. |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
117 |
echo $OPTARG | egrep -s = |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
118 |
if (( $? == 0 )); then |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
119 |
fail_usage "$f_a_obs" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
120 |
fi |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
121 |
fi |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
122 |
install_archive="-a $OPTARG";; |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
123 |
c) certfile="$OPTARG" ;; |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
124 |
d) source_dir="-d $OPTARG";; |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
125 |
e) extra_packages="$extra_packages $OPTARG" ;; |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
126 |
h) fail_usage "";; |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
127 |
k) keyfile="$OPTARG" ;; |
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
128 |
P) pub_and_url="$OPTARG" ;; |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
129 |
p) preserve_zone="-p";; |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
130 |
R) ZONEPATH="$OPTARG" ;; |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
131 |
s) silent_mode=1;; |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
132 |
u) unconfig_zone="-u";; |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
133 |
v) verbose_mode="-v";; |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
134 |
z) ZONENAME="$OPTARG" ;; |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
135 |
*) fail_usage "";; |
97
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
136 |
esac |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
137 |
done |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
138 |
shift $((OPTIND-1)) |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
139 |
|
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
140 |
if [[ -z $ZONEPATH || -z $ZONENAME ]]; then |
168 | 141 |
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
|
142 |
exit $ZONE_SUBPROC_USAGE |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
143 |
fi |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
144 |
|
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
145 |
# XXX shared/common script currently uses lower case zonename & zonepath |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
146 |
zonename="$ZONENAME" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
147 |
zonepath="$ZONEPATH" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
148 |
|
1275
7bdf8c791f04
9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents:
1111
diff
changeset
|
149 |
is_brand_labeled |
1108
14533641d138
8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents:
1091
diff
changeset
|
150 |
|
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
151 |
ZONEROOT=$ZONEPATH/root |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
152 |
secinfo="" |
168 | 153 |
|
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
154 |
# 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
|
155 |
[[ -n "$install_archive" && -n "$source_dir" ]] && |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
156 |
fail_usage "$f_incompat_options" "-a" "-d" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
157 |
|
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
158 |
# 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
|
159 |
[[ -n $silent_mode && -n $verbose_mode ]] && \ |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
160 |
fail_usage "$f_incompat_options" "-s" "-v" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
161 |
|
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
162 |
# The install can't both preserve and unconfigure |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
163 |
[[ -n $unconfig_zone && -n $preserve_zone ]] && \ |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
164 |
fail_usage "$f_incompat_options" "-u" "-p" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
165 |
|
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
166 |
# 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
|
167 |
if [[ -n "$install_archive" || -n "$source_dir" ]]; then |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
168 |
[[ -n $pub_and_url ]] && fail_usage "$f_incompat_options" "-a|-d" "-P" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
169 |
[[ -n "$extra_packages" ]] && \ |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
170 |
fail_usage "$f_incompat_options" "-a|-d" "-e" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
171 |
[[ "$certfile" != "None" ]] && \ |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
172 |
fail_usage "$f_incompat_options" "-a|-d" "-c" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
173 |
[[ "$keyfile" != "None" ]] && \ |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
174 |
fail_usage "$f_incompat_options" "-a|-d" "-k" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
175 |
fi |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
176 |
|
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
177 |
# 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
|
178 |
if [[ -z $install_archive && -z $source_dir ]]; then |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
179 |
[[ -n $preserve_zone || -n $unconfig_zone ]] && \ |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
180 |
fail_usage "$f_incompat_options" "default" "-p|-u" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
181 |
fi |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
182 |
|
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
183 |
# |
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
184 |
# 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
|
185 |
# 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
|
186 |
# |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
187 |
propagate_secinfo= |
1466
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
188 |
propagate_extra= |
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
189 |
if [[ -z $pub_and_url ]]; then |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
190 |
if [[ $keyfile != "None" ]]; then |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
191 |
fail_usage "$f_key_file" |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
192 |
fi |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
193 |
if [[ $certfile != "None" ]]; then |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
194 |
fail_usage "$f_cert_file" |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
195 |
fi |
1466
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
196 |
|
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
197 |
# We look for a preferred online origin. |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
198 |
tpub_and_url=`LC_ALL=C $PKG publisher -PH | \ |
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
199 |
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
|
200 |
{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
|
201 |
|
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
202 |
[[ $? -eq 0 && -n $tpub_and_url ]] && pub_and_url="$tpub_and_url" |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
203 |
|
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
204 |
# Note that later we need to propagate key & cert. |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
205 |
propagate_secinfo=1 |
1466
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
206 |
|
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
207 |
# |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
208 |
# since the user didn't specify a publisher, propagate all the |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
209 |
# publishers that don't have a key. |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
210 |
# |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
211 |
propagate_extra=1 |
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
212 |
fi |
1466
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
213 |
[[ -z $pub_and_url ]] && fail_usage "$f_no_pref_publisher" |
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
214 |
|
1466
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
215 |
# find the remaining publishers in the global zone |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
216 |
publishers_extra="" |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
217 |
if [[ -n $propagate_extra ]]; then |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
218 |
LC_ALL=C $PKG publisher -H | awk ' |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
219 |
$2 == "origin" && $3 == "online" {printf "%s=%s\n", $1, $4} |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
220 |
END {exit(0)} |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
221 |
' | while IFS== read publisher publisherurl; do |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
222 |
[[ "$publisher=$publisherurl" = "$pub_and_url" ]] && continue |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
223 |
|
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
224 |
# skip extra publishers that need a key |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
225 |
[[ "`get_pub_secinfo $publisher`" != "None None" ]] && continue |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
226 |
|
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
227 |
if [[ -z "$publishers_extra" ]]; then |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
228 |
publishers_extra="$publisher=$publisherurl" |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
229 |
else |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
230 |
publishers_extra=`printf "%s\n%s" \ |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
231 |
"$publisher=$publisherurl" "$publishers_extra"` |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
232 |
fi |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
233 |
done |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
234 |
fi |
954
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 |
# |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
237 |
# 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
|
238 |
# |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
239 |
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
|
240 |
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
|
241 |
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
|
242 |
fi |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
243 |
|
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
244 |
if [[ -n $propagate_secinfo ]]; then |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
245 |
# |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
246 |
# Get the global zone's cert and key (if any) so that we can propagate |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
247 |
# them into the new image. |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
248 |
# |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
249 |
get_pub_secinfo $publisher | read keyfile certfile |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
250 |
if [[ $? -ne 0 ]]; then |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
251 |
fail_usage "$f_get_secinfo" $publisher |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
252 |
fi |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
253 |
fi |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
254 |
# |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
255 |
# Do some sanity checks on key and cert. |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
256 |
# |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
257 |
[[ $keyfile != "None" && ! -f $keyfile ]] && \ |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
258 |
fail_usage "$f_nosuch_key" $keyfile |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
259 |
[[ $certfile != "None" && ! -f $certfile ]] && \ |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
260 |
fail_usage "$f_nosuch_cert" $certfile |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
261 |
|
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
262 |
# |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
263 |
# 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
|
264 |
# 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
|
265 |
# 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
|
266 |
# |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
267 |
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
|
268 |
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
|
269 |
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
|
270 |
|
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
271 |
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
|
272 |
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
|
273 |
fi |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
274 |
|
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
275 |
# |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
276 |
# 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
|
277 |
# dataset. |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
278 |
# |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
279 |
create_active_ds |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
280 |
|
579
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
281 |
# |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
282 |
# 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
|
283 |
# |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
284 |
if [[ -n $install_archive || -n $source_dir ]]; then |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
285 |
/usr/lib/brand/ipkg/image_install $ZONENAME $ZONEPATH \ |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
286 |
$install_archive $source_dir $verbose_mode $silent_mode \ |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
287 |
$unconfig_zone $preserve_zone |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
288 |
ii_result=$? |
579
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
289 |
|
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
290 |
if (( $ii_result != 0 )); then |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
291 |
exit $ZONE_SUBPROC_NOTCOMPLETE |
943
e04a1ccbeac8
7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents:
579
diff
changeset
|
292 |
fi |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
293 |
exit $ZONE_SUBPROC_OK |
943
e04a1ccbeac8
7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents:
579
diff
changeset
|
294 |
fi |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
295 |
|
1466
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
296 |
printf "$m_publisher\n" $publisher $publisherurl |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
297 |
echo "$publishers_extra" | while IFS== read publisher publisherurl; do |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
298 |
[ -z "$publisher" ] && break |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
299 |
printf "$m_publisher\n" $publisher $publisherurl |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
300 |
done |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
301 |
printf "$m_image\n" $ZONEROOT |
168 | 302 |
|
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
303 |
# |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
304 |
# We copy the credentials from the global zone into the new image |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
305 |
# we're about to create. |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
306 |
# |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
307 |
if [[ $keyfile != "None" ]]; then |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
308 |
newkeylocation="$KEYDIR/$(basename $keyfile)" |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
309 |
secinfo="$secinfo -k $newkeylocation" |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
310 |
printf "$m_key_prop\n" $(basename $keyfile) |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
311 |
mkdir -p -m 755 $ZONEROOT/$KEYDIR || fail_fatal "$f_key_prop" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
312 |
cp $keyfile $ZONEROOT/$newkeylocation || fail_fatal "$f_key_prop" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
313 |
chmod 644 $ZONEROOT/$newkeylocation |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
314 |
chown -h root:root $ZONEROOT/$newkeylocation |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
315 |
fi |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
316 |
if [[ $certfile != "None" ]]; then |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
317 |
newcertlocation="$KEYDIR/$(basename $certfile)" |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
318 |
secinfo="$secinfo -c $newcertlocation" |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
319 |
printf "$m_cert_prop\n" $(basename $certfile) |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
320 |
mkdir -p -m 755 $ZONEROOT/$KEYDIR || fail_fatal "$f_cert_prop" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
321 |
cp $certfile $ZONEROOT/$newcertlocation || fail_fatal "$f_cert_prop" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
322 |
chmod 644 $ZONEROOT/$newkeylocation |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
323 |
chown -h root:root $ZONEROOT/$newkeylocation |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
324 |
fi |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
325 |
|
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
326 |
# |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
327 |
# Regrettably, since we already copied the key information into place, |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
328 |
# we must pass the -f (force) option to image-create, since it thinks that |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
329 |
# something must be wrong, as the image exists. |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
330 |
# |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
331 |
# XXX in the future, we can create the image --no-refresh, then |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
332 |
# set the publisher. But image-create --no-refresh is broken right now. |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
333 |
# |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
334 |
$PKG image-create -f --zone --full -p "$pub_and_url" $secinfo $ZONEROOT || \ |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1108
diff
changeset
|
335 |
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
|
336 |
|
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
337 |
PKG_IMAGE="$ZONEROOT" |
168 | 338 |
export PKG_IMAGE |
1466
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
339 |
|
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
340 |
# add extra publishers |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
341 |
echo "$publishers_extra" | while IFS== read publisher publisherurl; do |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
342 |
[ -z "$publisher" ] && break |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
343 |
$PKG set-publisher -O $publisherurl $publisher || |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
344 |
fail_incomplete "$f_img" |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
345 |
done |
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
346 |
|
554
fe196874250d
3508 zone install should utilize/populate global zone d/l cache
Dan Price <dp@eng.sun.com>
parents:
547
diff
changeset
|
347 |
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
|
348 |
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
|
349 |
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
|
350 |
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
|
351 |
fi |
168 | 352 |
|
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
353 |
# |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
354 |
# 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
|
355 |
# 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
|
356 |
# 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
|
357 |
# 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
|
358 |
# 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
|
359 |
# |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
360 |
# 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
|
361 |
# 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
|
362 |
# 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
|
363 |
# |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
364 |
printf "$m_incorp\n" |
1466
bfdf13d64d47
11392 'zoneadm .. install' only uses preferred publisher
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1362
diff
changeset
|
365 |
echo $pub_and_url | IFS== read publisher publisherurl |
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
366 |
$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
|
367 |
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
|
368 |
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
|
369 |
fi |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
370 |
|
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
371 |
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
|
372 |
# |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
373 |
# 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
|
374 |
# 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
|
375 |
# 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
|
376 |
# /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
|
377 |
# 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
|
378 |
# arrive. |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
379 |
# |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
380 |
$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
|
381 |
$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
|
382 |
$PKG install --no-refresh --no-index SUNWcs || fail_fatal "$f_pkg" |
168 | 383 |
|
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
384 |
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
|
385 |
pkglist="" |
344
4c887185d780
528 pkg list -u gives confusing output
Dan Price <dp@eng.sun.com>
parents:
329
diff
changeset
|
386 |
pkglist="$pkglist SUNWcnetr SUNWesu SUNWadmr SUNWadmap SUNWbzip SUNWgzip" |
168 | 387 |
|
388 |
# |
|
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
389 |
# Workaround: For now, SUNWipkg has no dependency on python, so we supply it. |
168 | 390 |
# |
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
391 |
pkglist="$pkglist SUNWPython SUNWipkg" |
168 | 392 |
|
393 |
# |
|
394 |
# Get some diagnostic tools, truss, dtrace, etc. |
|
395 |
# |
|
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
396 |
pkglist="$pkglist SUNWtoo SUNWdtrc SUNWrcmdc SUNWbip" |
168 | 397 |
|
398 |
# |
|
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
399 |
# Get at least one sensible shell, and vi |
168 | 400 |
# |
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
401 |
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
|
402 |
|
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
403 |
# |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
404 |
# 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
|
405 |
# |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
406 |
pkglist="$pkglist SUNWsshcu SUNWssh SUNWsshd" |
168 | 407 |
|
408 |
# |
|
409 |
# Get some name services. |
|
410 |
# |
|
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
411 |
pkglist="$pkglist SUNWnis SUNWlldap" |
168 | 412 |
|
413 |
# |
|
329 | 414 |
# Get nfs client and autofs; it's a pain not to have them. |
415 |
# |
|
344
4c887185d780
528 pkg list -u gives confusing output
Dan Price <dp@eng.sun.com>
parents:
329
diff
changeset
|
416 |
pkglist="$pkglist SUNWnfsc SUNWatfs" |
329 | 417 |
|
1108
14533641d138
8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents:
1091
diff
changeset
|
418 |
# |
1362
4485bac2b3d8
10410 exclusive stack zones can't find a default router
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1323
diff
changeset
|
419 |
# 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
|
420 |
# |
4485bac2b3d8
10410 exclusive stack zones can't find a default router
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1323
diff
changeset
|
421 |
pkglist="$pkglist SUNWroute" |
4485bac2b3d8
10410 exclusive stack zones can't find a default router
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1323
diff
changeset
|
422 |
|
4485bac2b3d8
10410 exclusive stack zones can't find a default router
Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
parents:
1323
diff
changeset
|
423 |
# |
1108
14533641d138
8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents:
1091
diff
changeset
|
424 |
# 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
|
425 |
# |
1275
7bdf8c791f04
9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents:
1111
diff
changeset
|
426 |
if [ $brand_labeled -ne 0 ]; then |
7bdf8c791f04
9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents:
1111
diff
changeset
|
427 |
pkglist="$pkglist system/trusted/trusted-nonglobal" |
1108
14533641d138
8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents:
1091
diff
changeset
|
428 |
fi |
329 | 429 |
|
430 |
# |
|
168 | 431 |
# Get man(1) but not the man pages |
432 |
# |
|
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
433 |
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
|
434 |
|
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
435 |
# |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
436 |
# 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
|
437 |
# |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
438 |
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
|
439 |
|
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
440 |
# |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
441 |
# 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
|
442 |
# 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
|
443 |
# |
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
444 |
$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
|
445 |
|
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
446 |
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
|
447 |
|
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
448 |
printf "$m_smf" |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
449 |
ln -s ns_files.xml $ZONEROOT/var/svc/profile/name_service.xml |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
450 |
ln -s generic_limited_net.xml $ZONEROOT/var/svc/profile/generic.xml |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
451 |
ln -s inetd_generic.xml $ZONEROOT/var/svc/profile/inetd_services.xml |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
452 |
ln -s platform_none.xml $ZONEROOT/var/svc/profile/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
|
453 |
|
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
454 |
# This was formerly done in i.manifest |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
455 |
repfile=$ZONEROOT/etc/svc/repository.db |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
456 |
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
|
457 |
chmod 0600 $repfile |
e4db4be79d2e
1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents:
344
diff
changeset
|
458 |
chown root:sys $repfile |
e4db4be79d2e
1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents:
344
diff
changeset
|
459 |
|
168 | 460 |
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
|
461 |
|
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
|
462 |
# Clean up root as a role and jack if needed |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
463 |
if grep "^root::::type=role;" $ZONEROOT/etc/user_attr >/dev/null 2>&1; then |
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
|
464 |
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
|
465 |
# |
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
|
466 |
# 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
|
467 |
# |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
468 |
print "/^jack:/d\nw" | ed -s $ZONEROOT/etc/passwd |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
469 |
chmod u+w $ZONEROOT/etc/shadow |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
470 |
print "/^jack:/d\nw" | ed -s $ZONEROOT/etc/shadow |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
471 |
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
|
472 |
|
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
|
473 |
# |
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
|
474 |
# 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
|
475 |
# |
954
8614b0c63fb3
4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents:
943
diff
changeset
|
476 |
print "s/^root::::type=role;/root::::/\nw" | |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
477 |
ed -s $ZONEROOT/etc/user_attr |
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
|
478 |
fi |
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
479 |
|
1275
7bdf8c791f04
9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents:
1111
diff
changeset
|
480 |
# |
7bdf8c791f04
9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents:
1111
diff
changeset
|
481 |
# 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
|
482 |
# 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
|
483 |
# 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
|
484 |
# |
7bdf8c791f04
9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents:
1111
diff
changeset
|
485 |
printf "$m_more_brokenness\n" |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
486 |
/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
|
487 |
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
|
488 |
|
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
489 |
# Umount the dataset on the root. |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1466
diff
changeset
|
490 |
/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
|
491 |
|
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
492 |
printf "$m_complete\n\n" ${SECONDS} |
1275
7bdf8c791f04
9191 labeled zones should no longer rely on sparse-root functionality
Ric Aleshire <Ric.Aleshire@Sun.COM>
parents:
1111
diff
changeset
|
493 |
if [ $brand_labeled -eq 0 ]; then |
1108
14533641d138
8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents:
1091
diff
changeset
|
494 |
printf "$m_postnote\n" |
14533641d138
8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents:
1091
diff
changeset
|
495 |
printf "$m_postnote2\n" |
14533641d138
8031 IPS changes to address trusted zone installation breakage
David.Comay@Sun.COM
parents:
1091
diff
changeset
|
496 |
fi |
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
497 |
|
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
498 |
exit $ZONE_SUBPROC_OK |