author | mgerdts@gmail.com |
Wed, 14 Nov 2007 20:28:12 -0600 | |
changeset 206 | a617b308b931 |
parent 188 | a0989804cd9d |
child 210 | b1f4389f448d |
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 |
# |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
23 |
# Copyright 2007 Sun Microsystems, Inc. All rights reserved. |
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 |
|
168 | 27 |
ZONE_SUBPROC_OK=0 |
28 |
ZONE_SUBPROC_USAGE=253 |
|
29 |
ZONE_SUBPROC_NOTCOMPLETE=254 |
|
30 |
ZONE_SUBPROC_FATAL=255 |
|
31 |
||
32 |
f_img=$(gettext "failed to create image") |
|
33 |
f_pkg=$(gettext "failed to install package") |
|
34 |
f_interrupted=$(gettext "Installation cancelled due to interrupt.") |
|
35 |
||
36 |
m_image=$(gettext " Image: Preparing at %s ...") |
|
37 |
m_catalog=$(gettext " Catalog: Retrieving from %s ...") |
|
38 |
m_core=$(gettext " Installing: Core Packages ...") |
|
39 |
m_coreu=$(gettext " Installing: Core Utilities ...") |
|
40 |
m_pkg=$(gettext " Installing: pkg(5) Utilities ...") |
|
41 |
m_diag=$(gettext " Installing: Diagnostic Tools ...") |
|
42 |
m_shells=$(gettext " Installing: Shells ...") |
|
43 |
m_ns=$(gettext " Installing: Name Services ...") |
|
44 |
m_man=$(gettext " Installing: man(1) Command ...") |
|
45 |
m_smf=$(gettext "Postinstall: Copying SMF seed repository ...") |
|
46 |
m_mannote=$(gettext " Note: Man pages can be obtained by installing SUNWman") |
|
47 |
m_complete=$(gettext " Done: Installation completed in %s seconds.") |
|
48 |
m_postnote=$(gettext " Next Steps: Boot the zone, then log into the zone console") |
|
49 |
m_postnote2=$(gettext " (zlogin -C) to complete the configuration process") |
|
50 |
||
51 |
m_done=$(gettext " done.") |
|
52 |
||
53 |
||
54 |
fail_incomplete() { |
|
55 |
print -u2 "$1" |
|
56 |
exit $ZONE_SUBPROC_NOTCOMPLETE |
|
57 |
} |
|
58 |
||
59 |
fail_fatal() { |
|
60 |
print -u2 "$1" |
|
61 |
exit $ZONE_SUBPROC_FATAL |
|
62 |
} |
|
63 |
||
64 |
||
65 |
fail_usage() { |
|
66 |
print "Usage: $0 [-h] [-a <authority>]" |
|
97
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
67 |
exit $ZONE_SUBPROC_USAGE |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
68 |
} |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
69 |
|
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
70 |
trap_cleanup() { |
168 | 71 |
print "$f_interrupted" |
97
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
72 |
exit $int_code |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
73 |
} |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
74 |
|
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
75 |
int_code=$ZONE_SUBPROC_NOTCOMPLETE |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
76 |
|
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
77 |
trap trap_cleanup INT |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
78 |
|
188
a0989804cd9d
Update brand installer to go to pkg.opensolaris.org by default
Dan Price <dp@eng.sun.com>
parents:
168
diff
changeset
|
79 |
authority="opensolaris.org=http://pkg.opensolaris.org" |
168 | 80 |
zonename="" |
81 |
zonepath="" |
|
82 |
||
83 |
# Setup i18n output |
|
84 |
TEXTDOMAIN="SUNW_OST_OSCMD" |
|
85 |
export TEXTDOMAIN |
|
86 |
||
87 |
||
88 |
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
|
89 |
case $opt in |
168 | 90 |
h) fail_usage ;; |
91 |
R) zonepath="$OPTARG" ;; |
|
97
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
92 |
z) zonename="$OPTARG" ;; |
168 | 93 |
a) authority="$OPTARG" ;; |
94 |
*) fail_usage ;; |
|
97
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
95 |
esac |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
96 |
done |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
97 |
shift $((OPTIND-1)) |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
98 |
|
168 | 99 |
if [[ -z $zonepath || -z $zonename ]]; then |
100 |
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
|
101 |
exit $ZONE_SUBPROC_USAGE |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
102 |
fi |
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
103 |
|
168 | 104 |
zoneroot=$zonepath/root |
105 |
||
106 |
printf "\n$m_image" $zoneroot/root |
|
107 |
pkg image-create -z -F -a "$authority" $zoneroot || fail_fatal $f_img |
|
108 |
printf "$m_done\n" |
|
109 |
||
110 |
PKG_IMAGE="$zoneroot" |
|
111 |
export PKG_IMAGE |
|
112 |
||
113 |
printf "$m_catalog" "$authority" |
|
114 |
pkg refresh || fail_fatal "$f_refresh" |
|
98
2ac7781efe22
Package up the packaging system.
Danek Duvall <danek.duvall@sun.com>
parents:
97
diff
changeset
|
115 |
if [[ $? -ne 0 ]]; then |
2ac7781efe22
Package up the packaging system.
Danek Duvall <danek.duvall@sun.com>
parents:
97
diff
changeset
|
116 |
print "Failed to retrieve catalog" |
2ac7781efe22
Package up the packaging system.
Danek Duvall <danek.duvall@sun.com>
parents:
97
diff
changeset
|
117 |
exit 1 |
2ac7781efe22
Package up the packaging system.
Danek Duvall <danek.duvall@sun.com>
parents:
97
diff
changeset
|
118 |
fi |
168 | 119 |
printf "$m_done\n" |
120 |
||
121 |
printf "$m_core" |
|
122 |
pkg install SUNWcsd || fail_incomplete "$f_pkg" |
|
123 |
pkg install SUNWcs SUNWcsl || fail_incomplete "$f_pkg" |
|
124 |
printf "$m_done\n" |
|
125 |
||
126 |
printf "$m_coreu" |
|
127 |
pkg install SUNWesu SUNWadmr SUNWadmap SUNWbzip SUNWgzip || fail_incomplete "$f_pkg" |
|
128 |
printf "$m_done\n" |
|
129 |
||
130 |
# |
|
131 |
# Workaround: in our test repo, SUNWipkg has no dependencies |
|
132 |
# so we must supply it python. |
|
133 |
# |
|
134 |
printf "$m_pkg" |
|
135 |
pkg install SUNWPython SUNWipkg || fail_incomplete "$f_pkg" |
|
136 |
printf "$m_done\n" |
|
137 |
||
138 |
# |
|
139 |
# Get some diagnostic tools, truss, dtrace, etc. |
|
140 |
# |
|
141 |
printf "$m_diag" |
|
142 |
pkg install SUNWtoo SUNWdtrc SUNWrcmdc SUNWbip || fail_incomplete "$f_pkg" |
|
143 |
printf "$m_done\n" |
|
144 |
||
145 |
# |
|
146 |
# Get some sensible shells |
|
147 |
# |
|
148 |
printf "$m_shells" |
|
149 |
pkg install SUNWbash SUNWzsh SUNWtcsh || fail_incomplete "$f_pkg" |
|
150 |
printf "$m_done\n" |
|
151 |
||
152 |
# |
|
153 |
# Get some name services. |
|
154 |
# |
|
155 |
printf "$m_ns" |
|
206
a617b308b931
199 zone creation fail due to bad package name
mgerdts@gmail.com
parents:
188
diff
changeset
|
156 |
pkg install SUNWnis SUNWlldap || fail_incomplete "$f_pkg" |
168 | 157 |
printf "$m_done\n" |
158 |
||
159 |
# |
|
160 |
# Get man(1) but not the man pages |
|
161 |
# |
|
162 |
printf "$m_man" |
|
163 |
pkg install SUNWdoc || fail_incomplete "$f_pkg" |
|
164 |
printf "$m_done\n" |
|
165 |
print "$m_mannote\n" |
|
166 |
||
167 |
# XXX leaving this out for now. Reconsider later. |
|
168 |
# |
|
169 |
# Core X and GNOME -- I add these because it's easy to overlook that |
|
170 |
# you need fonts, and the result is that fontconfig dumps core a lot. |
|
171 |
# |
|
172 |
#printf $m_corex |
|
173 |
#pkg install SUNWfontconfig FSWxorg-fonts || fail_incomplete "$f_pkg" |
|
174 |
#pkg install SUNWxorg-client-programs SUNWgnome-fonts || fail_incomplete "$f_pkg" |
|
175 |
#pkg install SUNWgnome-base-libs SUNWgnome-panel || fail_incomplete "$f_pkg" |
|
176 |
## |
|
177 |
## workaround for lack of xterm, and add GDM since it's nice to have it. |
|
178 |
## |
|
179 |
#pkg install SUNWgnome-terminal || fail_incomplete "$f_pkg" |
|
180 |
#pkg install SUNWgnome-display-mgr || fail_incomplete "$f_pkg" |
|
181 |
||
182 |
||
183 |
#print "Setting up SMF profile links" |
|
97
9a488b15900f
Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
184 |
# This was formerly done in SUNWcsr/postinstall |
168 | 185 |
printf "$m_smf" |
186 |
ln -s ns_files.xml $zoneroot/var/svc/profile/name_service.xml |
|
187 |
ln -s generic_limited_net.xml $zoneroot/var/svc/profile/generic.xml |
|
188 |
ln -s inetd_generic.xml $zoneroot/var/svc/profile/inetd_services.xml |
|
189 |
ln -s platform_none.xml $zoneroot/var/svc/profile/platform.xml |
|
190 |
||
191 |
## This was formerly done in i.manifest |
|
192 |
cp $zoneroot/lib/svc/seed/nonglobal.db $zoneroot/etc/svc/repository.db |
|
193 |
printf "$m_done\n" |
|
194 |
||
195 |
||
196 |
# |
|
197 |
# Make sure sysidtools run |
|
198 |
# |
|
199 |
touch $zoneroot/etc/.UNCONFIGURED |
|
200 |
||
201 |
printf "$m_complete\n\n" ${SECONDS} |
|
202 |
printf "$m_postnote\n" |
|
203 |
printf "$m_postnote2\n" |
|
204 |
||
205 |
exit $ZONE_SUBPROC_OK |