author | <gerald.jelinek@sun.com> |
Fri, 13 Mar 2009 08:53:20 -0600 | |
changeset 943 | e04a1ccbeac8 |
parent 579 | d6ab4f57f07d |
child 954 | 8614b0c63fb3 |
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 |
|
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 | 28 |
|
29 |
f_img=$(gettext "failed to create image") |
|
30 |
f_pkg=$(gettext "failed to install package") |
|
31 |
f_interrupted=$(gettext "Installation cancelled due to interrupt.") |
|
32 |
||
371
e4db4be79d2e
1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents:
344
diff
changeset
|
33 |
m_authority=$(gettext " Authority: Using %s.") |
554
fe196874250d
3508 zone install should utilize/populate global zone d/l cache
Dan Price <dp@eng.sun.com>
parents:
547
diff
changeset
|
34 |
m_cache=$(gettext " Cache: Using %s.") |
168 | 35 |
m_image=$(gettext " Image: Preparing at %s ...") |
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
36 |
m_core=$(gettext " Installing: (output follows)\n") |
168 | 37 |
m_smf=$(gettext "Postinstall: Copying SMF seed repository ...") |
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
38 |
m_brokenness=$(gettext "Postinstall: Working around http://defect.opensolaris.org/bz/show_bug.cgi?id=681") |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
39 |
m_more_brokenness=$(gettext "Postinstall: Working around http://defect.opensolaris.org/bz/show_bug.cgi?id=741") |
168 | 40 |
m_mannote=$(gettext " Note: Man pages can be obtained by installing SUNWman") |
41 |
m_complete=$(gettext " Done: Installation completed in %s seconds.") |
|
42 |
m_postnote=$(gettext " Next Steps: Boot the zone, then log into the zone console") |
|
43 |
m_postnote2=$(gettext " (zlogin -C) to complete the configuration process") |
|
44 |
||
45 |
m_done=$(gettext " done.") |
|
46 |
||
97
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
47 |
trap_cleanup() { |
168 | 48 |
print "$f_interrupted" |
97
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
49 |
exit $int_code |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
50 |
} |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
51 |
|
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
52 |
int_code=$ZONE_SUBPROC_NOTCOMPLETE |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
53 |
|
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
54 |
trap trap_cleanup INT |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
55 |
|
168 | 56 |
zonename="" |
57 |
zonepath="" |
|
58 |
||
329 | 59 |
# |
60 |
# If there's a preferred authority set for the system, set that as our |
|
61 |
# default. Otherwise use opensolaris.org. |
|
62 |
# |
|
63 |
authority="opensolaris.org=http://pkg.opensolaris.org" |
|
64 |
if [[ -x /usr/bin/pkg ]]; then |
|
65 |
sysauth=`LC_ALL=C /usr/bin/pkg authority | grep preferred | awk '{printf "%s=%s", $1, $3}'` |
|
66 |
if [[ $? -eq 0 && -n "$sysauth" ]]; then |
|
67 |
authority=$sysauth |
|
68 |
fi |
|
69 |
fi |
|
70 |
||
168 | 71 |
# Setup i18n output |
72 |
TEXTDOMAIN="SUNW_OST_OSCMD" |
|
73 |
export TEXTDOMAIN |
|
74 |
||
75 |
||
76 |
while getopts "a:z:R:h" opt; do |
|
97
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
77 |
case $opt in |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
78 |
h) fail_usage "$0 [-h] [-a <authority>]";; |
168 | 79 |
R) zonepath="$OPTARG" ;; |
97
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
80 |
z) zonename="$OPTARG" ;; |
168 | 81 |
a) authority="$OPTARG" ;; |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
82 |
*) fail_usage "$0 [-h] [-a <authority>]";; |
97
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
83 |
esac |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
84 |
done |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
85 |
shift $((OPTIND-1)) |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
86 |
|
168 | 87 |
if [[ -z $zonepath || -z $zonename ]]; then |
88 |
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
|
89 |
exit $ZONE_SUBPROC_USAGE |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
90 |
fi |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
91 |
|
168 | 92 |
zoneroot=$zonepath/root |
93 |
||
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
94 |
# |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
95 |
# 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
|
96 |
# dataset. |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
97 |
# |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
98 |
|
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
99 |
get_current_gzbe |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
100 |
|
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
101 |
# 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
|
102 |
get_zonepath_ds $zonepath |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
103 |
|
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
104 |
# 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
|
105 |
fail_zonepath_in_rootds $ZONEPATH_DS |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
106 |
|
579
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
107 |
# |
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
108 |
# 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
|
109 |
# 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
|
110 |
# |
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
111 |
|
943
e04a1ccbeac8
7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents:
579
diff
changeset
|
112 |
/usr/sbin/zfs list -H -o name $ZONEPATH_DS/ROOT >/dev/null 2>&1 |
e04a1ccbeac8
7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents:
579
diff
changeset
|
113 |
if (( $? != 0 )); then |
e04a1ccbeac8
7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents:
579
diff
changeset
|
114 |
/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
|
115 |
if (( $? != 0 )); then |
e04a1ccbeac8
7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents:
579
diff
changeset
|
116 |
fail_fatal "$f_zfs_create" |
e04a1ccbeac8
7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents:
579
diff
changeset
|
117 |
fi |
e04a1ccbeac8
7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents:
579
diff
changeset
|
118 |
fi |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
119 |
|
579
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
120 |
BENAME=zbe |
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
121 |
BENUM=0 |
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
122 |
# Try 100 different names before giving up. |
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
123 |
while [ $BENUM -lt 100 ]; do |
943
e04a1ccbeac8
7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents:
579
diff
changeset
|
124 |
/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
|
125 |
-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
|
126 |
if (( $? == 0 )); then |
e04a1ccbeac8
7304 dataset already exists warnings from zone install
<gerald.jelinek@sun.com>
parents:
579
diff
changeset
|
127 |
break |
579
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
128 |
fi |
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
129 |
BENUM=`expr $BENUM + 1` |
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
130 |
BENAME="zbe-$BENUM" |
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
131 |
done |
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
132 |
|
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
133 |
if [ $BENUM -ge 100 ]; then |
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
134 |
fail_fatal "$f_zfs_create" |
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
135 |
fi |
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
136 |
|
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
137 |
if [ ! -d $zoneroot ]; then |
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
138 |
/usr/bin/mkdir $zoneroot |
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
139 |
fi |
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
140 |
|
d6ab4f57f07d
3657 SNAP related ipkg brand issues
<gerald.jelinek@sun.com>
parents:
554
diff
changeset
|
141 |
/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
|
142 |
fail_incomplete "$f_zfs_mount" |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
143 |
|
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
144 |
# |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
145 |
# Done setting up the zone's datasets. |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
146 |
# |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
147 |
|
371
e4db4be79d2e
1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents:
344
diff
changeset
|
148 |
printf "$m_authority" `echo $authority | cut -d= -f 2` |
210
b1f4389f448d
239 Misleading image path $zonepath/root/root
mgerdts@gmail.com
parents:
206
diff
changeset
|
149 |
printf "\n$m_image" $zoneroot |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
150 |
pkg image-create -z -F -a "$authority" $zoneroot || fail_incomplete "$f_img" |
168 | 151 |
printf "$m_done\n" |
152 |
||
438
69202d962ff6
2736 IPS branded zones should install the entire encorporation
Danek Duvall <danek.duvall@sun.com>
parents:
371
diff
changeset
|
153 |
entire_fmri=$(pkg list -Hv entire | nawk '{print $1}') |
69202d962ff6
2736 IPS branded zones should install the entire encorporation
Danek Duvall <danek.duvall@sun.com>
parents:
371
diff
changeset
|
154 |
|
168 | 155 |
PKG_IMAGE="$zoneroot" |
156 |
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
|
157 |
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
|
158 |
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
|
159 |
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
|
160 |
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
|
161 |
fi |
168 | 162 |
|
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
163 |
printf "$m_core\n" |
438
69202d962ff6
2736 IPS branded zones should install the entire encorporation
Danek Duvall <danek.duvall@sun.com>
parents:
371
diff
changeset
|
164 |
pkg install -q $entire_fmri || fail_incomplete "$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
|
165 |
pkg install -q SUNWcsd || fail_incomplete "$f_pkg" |
168 | 166 |
|
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
167 |
pkglist="" |
344
4c887185d780
528 pkg list -u gives confusing output
Dan Price <dp@eng.sun.com>
parents:
329
diff
changeset
|
168 |
pkglist="$pkglist SUNWcnetr SUNWesu SUNWadmr SUNWadmap SUNWbzip SUNWgzip" |
168 | 169 |
|
170 |
# |
|
371
e4db4be79d2e
1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents:
344
diff
changeset
|
171 |
# Workaround: For now, SUNWipkg has no dependencies so we must supply it python. |
168 | 172 |
# |
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
173 |
pkglist="$pkglist SUNWPython SUNWipkg" |
168 | 174 |
|
175 |
# |
|
176 |
# Get some diagnostic tools, truss, dtrace, etc. |
|
177 |
# |
|
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
178 |
pkglist="$pkglist SUNWtoo SUNWdtrc SUNWrcmdc SUNWbip" |
168 | 179 |
|
180 |
# |
|
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
181 |
# Get at least one sensible shell, and vi |
168 | 182 |
# |
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
183 |
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
|
184 |
|
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
185 |
# |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
186 |
# 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
|
187 |
# |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
188 |
pkglist="$pkglist SUNWsshcu SUNWssh SUNWsshd" |
168 | 189 |
|
190 |
# |
|
191 |
# Get some name services. |
|
192 |
# |
|
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
193 |
pkglist="$pkglist SUNWnis SUNWlldap" |
168 | 194 |
|
195 |
# |
|
329 | 196 |
# Get nfs client and autofs; it's a pain not to have them. |
197 |
# |
|
344
4c887185d780
528 pkg list -u gives confusing output
Dan Price <dp@eng.sun.com>
parents:
329
diff
changeset
|
198 |
pkglist="$pkglist SUNWnfsc SUNWatfs" |
329 | 199 |
|
200 |
||
201 |
# |
|
168 | 202 |
# Get man(1) but not the man pages |
203 |
# |
|
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
204 |
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
|
205 |
|
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
206 |
# Do the install |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
207 |
pkg install $pkglist || fail_incomplete "$f_pkg" |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
208 |
|
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
209 |
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
|
210 |
|
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
211 |
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
|
212 |
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
|
213 |
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
|
214 |
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
|
215 |
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
|
216 |
|
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
217 |
# 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
|
218 |
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
|
219 |
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
|
220 |
chmod 0600 $repfile |
e4db4be79d2e
1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents:
344
diff
changeset
|
221 |
chown root:sys $repfile |
e4db4be79d2e
1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents:
344
diff
changeset
|
222 |
|
168 | 223 |
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
|
224 |
|
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
|
225 |
# 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
|
226 |
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
|
227 |
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
|
228 |
# |
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
|
229 |
# 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
|
230 |
# |
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
|
231 |
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
|
232 |
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
|
233 |
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
|
234 |
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
|
235 |
|
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
|
236 |
# |
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
|
237 |
# 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
|
238 |
# |
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
|
239 |
print "s/^root::::type=role;/root::::/\nw" | |
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
|
240 |
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
|
241 |
fi |
280
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
242 |
|
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
243 |
# |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
244 |
# Make sure sysidtools run; we manually poke in the SSH action |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
245 |
# so that we get an SSH key. Yes, this is seriously borken. |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
246 |
# |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
247 |
printf "$m_more_brokenness\n" |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
248 |
/usr/sbin/sysidconfig -b $zoneroot -a /lib/svc/method/sshd |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
249 |
touch $zoneroot/etc/.UNCONFIGURED |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
250 |
|
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
251 |
# Umount the dataset on the root. |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
528
diff
changeset
|
252 |
/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
|
253 |
|
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
254 |
printf "$m_complete\n\n" ${SECONDS} |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
255 |
printf "$m_postnote\n" |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
256 |
printf "$m_postnote2\n" |
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
257 |
|
84c03819796f
742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents:
210
diff
changeset
|
258 |
exit $ZONE_SUBPROC_OK |