author | Mike Gerdts <mike.gerdts@oracle.com> |
Thu, 03 Mar 2011 08:29:03 -0800 | |
changeset 2243 | 526fc99bbf2d |
parent 2235 | 1f446820dcb0 |
child 2310 | ce10607d5332 |
permissions | -rw-r--r-- |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
1 |
# |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
2 |
# CDDL HEADER START |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
3 |
# |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
4 |
# The contents of this file are subject to the terms of the |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
5 |
# Common Development and Distribution License (the "License"). |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
6 |
# You may not use this file except in compliance with the License. |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
7 |
# |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
8 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
9 |
# or http://www.opensolaris.org/os/licensing. |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
10 |
# See the License for the specific language governing permissions |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
11 |
# and limitations under the License. |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
12 |
# |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
13 |
# When distributing Covered Code, include this CDDL HEADER in each |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
14 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
15 |
# If applicable, add the following below this CDDL HEADER, with the |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
16 |
# fields enclosed by brackets "[]" replaced with your own identifying |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
17 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
18 |
# |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
19 |
# CDDL HEADER END |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
20 |
# |
1879
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
21 |
|
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
22 |
# |
2173
3f44e4b7f94f
16274 nit in error message from common.ksh:fail_zonepath_in_rootds()
Dan Price <daniel.price@oracle.com>
parents:
2163
diff
changeset
|
23 |
# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
24 |
# |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
25 |
|
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
26 |
# |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
27 |
# Only change PATH if you give full consideration to GNU or other variants |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
28 |
# of common commands having different arguments and output. Setting PATH is |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
29 |
# and not using the full path to executables provides a performance improvement |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
30 |
# by using the ksh builtin equivalent of many common commands. |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
31 |
# |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
32 |
export PATH=/usr/bin:/usr/sbin |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
33 |
unset LD_LIBRARY_PATH |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
34 |
|
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
35 |
. /usr/lib/brand/shared/common.ksh |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
36 |
|
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
37 |
PROP_PARENT="org.opensolaris.libbe:parentbe" |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
38 |
PROP_ACTIVE="org.opensolaris.libbe:active" |
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
39 |
PROP_BE_HANDLE="com.oracle.libbe:nbe_handle" |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
40 |
|
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
41 |
f_incompat_options=$(gettext "cannot specify both %s and %s options") |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
42 |
f_sanity_detail=$(gettext "Missing %s at %s") |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
43 |
f_sanity_sparse=$(gettext "Is this a sparse zone image? The image must be whole-root.") |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
44 |
sanity_ok=$(gettext " Sanity Check: Passed. Looks like an OpenSolaris system.") |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
45 |
sanity_fail=$(gettext " Sanity Check: FAILED (see log for details).") |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
46 |
sanity_fail_vers=$(gettext " Sanity Check: the Solaris image (release %s) is not an OpenSolaris image and cannot be installed in this type of branded zone.") |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
47 |
install_fail=$(gettext " Result: *** Installation FAILED ***") |
2173
3f44e4b7f94f
16274 nit in error message from common.ksh:fail_zonepath_in_rootds()
Dan Price <daniel.price@oracle.com>
parents:
2163
diff
changeset
|
48 |
f_zfs_in_root=$(gettext "Installing a zone inside of the root pool's 'ROOT' dataset is unsupported.") |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
49 |
f_root_create=$(gettext "Unable to create the zone's ZFS dataset mountpoint.") |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
50 |
f_no_gzbe=$(gettext "unable to determine global zone boot environment.") |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
51 |
f_multiple_ds=$(gettext "multiple active datasets.") |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
52 |
f_no_active_ds=$(gettext "no active dataset.") |
1493
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
53 |
f_zfs_unmount=$(gettext "Unable to unmount the zone's root ZFS dataset (%s).\nIs there a global zone process inside the zone root?\nThe current zone boot environment will remain mounted.\n") |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
54 |
f_zfs_mount=$(gettext "Unable to mount the zone's ZFS dataset.") |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
55 |
|
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1091
diff
changeset
|
56 |
f_safedir=$(gettext "Expected %s to be a directory.") |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1091
diff
changeset
|
57 |
f_cp=$(gettext "Failed to cp %s %s.") |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1091
diff
changeset
|
58 |
f_cp_unsafe=$(gettext "Failed to safely copy %s to %s.") |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1091
diff
changeset
|
59 |
|
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
60 |
m_brnd_usage=$(gettext "brand-specific usage: ") |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
61 |
|
1493
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
62 |
v_unconfig=$(gettext "Performing zone sys-unconfig") |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
63 |
e_unconfig=$(gettext "sys-unconfig failed") |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
64 |
v_mounting=$(gettext "Mounting the zone") |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
65 |
e_badmount=$(gettext "Zone mount failed") |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
66 |
v_unmount=$(gettext "Unmounting zone") |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
67 |
e_badunmount=$(gettext "Zone unmount failed") |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
68 |
e_exitfail=$(gettext "Postprocessing failed.") |
2243
526fc99bbf2d
17959 p2v of older ipkg images fails
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2235
diff
changeset
|
69 |
v_update_format=$(gettext "Updating image format") |
526fc99bbf2d
17959 p2v of older ipkg images fails
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2235
diff
changeset
|
70 |
e_update_format=$(gettext "Updating image format failed") |
1493
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
71 |
|
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
72 |
m_complete=$(gettext " Done: Installation completed in %s seconds.") |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
73 |
m_postnote=$(gettext " Next Steps: Boot the zone, then log into the zone console (zlogin -C)") |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
74 |
m_postnote2=$(gettext " to complete the configuration process.") |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
75 |
|
1493
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
76 |
is_brand_labeled() { |
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
77 |
if [[ -z $ALTROOT ]]; then |
2027
f2e9f684e5be
16805 mount of ipkg zone in alternate root fails
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents:
1879
diff
changeset
|
78 |
AR_OPTIONS="" |
f2e9f684e5be
16805 mount of ipkg zone in alternate root fails
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents:
1879
diff
changeset
|
79 |
else |
f2e9f684e5be
16805 mount of ipkg zone in alternate root fails
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents:
1879
diff
changeset
|
80 |
AR_OPTIONS="-R $ALTROOT" |
f2e9f684e5be
16805 mount of ipkg zone in alternate root fails
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents:
1879
diff
changeset
|
81 |
fi |
f2e9f684e5be
16805 mount of ipkg zone in alternate root fails
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents:
1879
diff
changeset
|
82 |
brand=$(/usr/sbin/zoneadm $AR_OPTIONS -z $ZONENAME \ |
f2e9f684e5be
16805 mount of ipkg zone in alternate root fails
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents:
1879
diff
changeset
|
83 |
list -p | awk -F: '{print $6}') |
1493
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
84 |
[[ $brand == "labeled" ]] && return 1 |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
85 |
return 0 |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
86 |
} |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
87 |
|
1879
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
88 |
sanity_check() { |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
89 |
typeset dir="$1" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
90 |
shift |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
91 |
res=0 |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
92 |
|
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
93 |
# |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
94 |
# Check for some required directories and make sure this isn't a |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
95 |
# sparse zone image from SXCE. |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
96 |
# |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
97 |
checks="etc etc/svc var var/svc" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
98 |
for x in $checks; do |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
99 |
if [[ ! -e $dir/$x ]]; then |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
100 |
log "$f_sanity_detail" "$x" "$dir" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
101 |
res=1 |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
102 |
fi |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
103 |
done |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
104 |
if (( $res != 0 )); then |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
105 |
log "$f_sanity_sparse" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
106 |
log "$sanity_fail" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
107 |
fatal "$install_fail" "$ZONENAME" |
1504
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
108 |
fi |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
109 |
|
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
110 |
# Check for existence of pkg command. |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
111 |
if [[ ! -x $dir/usr/bin/pkg ]]; then |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
112 |
log "$f_sanity_detail" "usr/bin/pkg" "$dir" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
113 |
log "$sanity_fail" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
114 |
fatal "$install_fail" "$ZONENAME" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
115 |
fi |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
116 |
|
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
117 |
# |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
118 |
# XXX There should be a better way to do this. |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
119 |
# Check image release. We only work on the same minor release as the |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
120 |
# system is running. The INST_RELEASE file doesn't exist with IPS on |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
121 |
# OpenSolaris, so its presence means we have an earlier Solaris |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
122 |
# (i.e. non-OpenSolaris) image. |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
123 |
# |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
124 |
if [[ -f "$dir/var/sadm/system/admin/INST_RELEASE" ]]; then |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
125 |
image_vers=$(nawk -F= '{if ($1 == "VERSION") print $2}' \ |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
126 |
$dir/var/sadm/system/admin/INST_RELEASE) |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
127 |
vlog "$sanity_fail_vers" "$image_vers" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
128 |
fatal "$install_fail" "$ZONENAME" |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
129 |
fi |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
130 |
|
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
131 |
vlog "$sanity_ok" |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
132 |
} |
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
133 |
|
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
134 |
function get_current_gzbe { |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
135 |
# |
2027
f2e9f684e5be
16805 mount of ipkg zone in alternate root fails
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents:
1879
diff
changeset
|
136 |
# If there is no alternate root (normal case) then set the |
f2e9f684e5be
16805 mount of ipkg zone in alternate root fails
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents:
1879
diff
changeset
|
137 |
# global zone boot environment by finding the boot environment |
f2e9f684e5be
16805 mount of ipkg zone in alternate root fails
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents:
1879
diff
changeset
|
138 |
# that is active now. |
f2e9f684e5be
16805 mount of ipkg zone in alternate root fails
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents:
1879
diff
changeset
|
139 |
# If a zone exists in a boot environment mounted on an alternate root, |
f2e9f684e5be
16805 mount of ipkg zone in alternate root fails
Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
parents:
1879
diff
changeset
|
140 |
# then find the boot environment where the alternate root is mounted. |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
141 |
# |
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
142 |
CURRENT_GZBE=$(beadm list -H | nawk -v alt=$ALTROOT -F\; '{ |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
143 |
if (length(alt) == 0) { |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
144 |
# Field 3 is the BE status. 'N' is the active BE. |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
145 |
if ($3 !~ "N") |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
146 |
next |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
147 |
} else { |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
148 |
# Field 4 is the BE mountpoint. |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
149 |
if ($4 != alt) |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
150 |
next |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
151 |
} |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
152 |
# Field 2 is the BE UUID |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
153 |
print $2 |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
154 |
}') |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
155 |
if [ -z "$CURRENT_GZBE" ]; then |
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
156 |
return 1 |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
157 |
fi |
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
158 |
return 0 |
547
9a267e76a197
3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents:
diff
changeset
|
159 |
} |
1091
fc73bc2d78ce
7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents:
954
diff
changeset
|
160 |
|
fc73bc2d78ce
7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents:
954
diff
changeset
|
161 |
# |
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
162 |
# get_active_be zone |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
163 |
# |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
164 |
# Finds the active boot environment for the given zone. |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
165 |
# |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
166 |
# Arguments: |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
167 |
# |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
168 |
# zone zone structure initialized with init_zone |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
169 |
# |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
170 |
# Globals: |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
171 |
# |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
172 |
# CURRENT_GZBE Current global zone boot environment. If not already set, |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
173 |
# it will be set. |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
174 |
# |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
175 |
# Returns: |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
176 |
# |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
177 |
# 0 on success, else 1. |
1493
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
178 |
# |
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
179 |
function get_active_be { |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
180 |
typeset -n zone=$1 |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
181 |
typeset active_ds= |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
182 |
typeset tab=$(printf "\t") |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
183 |
|
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
184 |
[[ -z "$CURRENT_GZBE" ]] && get_current_gzbe |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
185 |
|
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
186 |
typeset name parent active |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
187 |
zfs list -H -r -d 1 -t filesystem -o name,$PROP_PARENT,$PROP_ACTIVE \ |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
188 |
${zone.ROOT_ds} | while IFS=$tab read name parent active ; do |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
189 |
[[ $parent == "$CURRENT_GZBE" ]] || continue |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
190 |
[[ $active == on ]] || continue |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
191 |
vlog "Found active dataset %s" "$name" |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
192 |
if [[ -n "$active_ds" ]] ; then |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
193 |
error "$f_multiple_ds" |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
194 |
return 1 |
1493
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
195 |
fi |
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
196 |
active_ds=$name |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
197 |
done |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
198 |
if [[ -z $active_ds ]]; then |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
199 |
error "$f_no_active_ds" |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
200 |
return 1 |
1493
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
201 |
fi |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
202 |
|
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
203 |
zone.active_ds=$active_ds |
1493
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
204 |
} |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
205 |
|
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
206 |
function set_active_be { |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
207 |
typeset -n zone="$1" |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
208 |
typeset be="$2" |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
209 |
|
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
210 |
[[ -z "$CURRENT_GZBE" ]] && get_current_gzbe |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
211 |
|
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
212 |
# |
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
213 |
# Turn off the active property on BE's with the same GZBE |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
214 |
# |
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
215 |
zfs list -H -r -d 1 -t filesystem -o name,$PROP_PARENT,$PROP_ACTIVE \ |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
216 |
${zone.ROOT_ds} | while IFS=$tab read name parent active ; do |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
217 |
[[ $parent == "$CURRENT_GZBE" ]] || continue |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
218 |
[[ $active == on ]] || continue |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
219 |
[[ $name == "${zone.ROOT_ds}/$be" ]] && continue |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
220 |
vlog "Deactivating active dataset %s" "$name" |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
221 |
zfs set $PROP_ACTIVE=off "$name" || return 1 |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
222 |
done |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
223 |
|
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
224 |
zone.active_ds="${zone.ROOT_ds}/$be" |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
225 |
|
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
226 |
zfs set "$PROP_PARENT=$CURRENT_GZBE" ${zone.active_ds} \ |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
227 |
|| return 1 |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
228 |
zfs set "$PROP_ACTIVE=on" ${zone.active_ds} || return 1 |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
229 |
|
2235
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
230 |
zfs set "$PROP_BE_HANDLE=on" "${zone.rpool_ds}" || return 1 |
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
231 |
|
1f446820dcb0
17791 ipkg brand needs to be in sync with revised dataset layout
Mike Gerdts <mike.gerdts@oracle.com>
parents:
2219
diff
changeset
|
232 |
return 0 |
1483
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
233 |
} |
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
234 |
|
2276b6786711
6793 p2v support for ipkg-branded zones
<gerald.jelinek@sun.com>
parents:
1327
diff
changeset
|
235 |
# |
1493
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
236 |
# Run sys-unconfig on the zone. |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
237 |
# |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
238 |
unconfigure_zone() { |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
239 |
vlog "$v_unconfig" |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
240 |
|
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
241 |
vlog "$v_mounting" |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
242 |
ZONE_IS_MOUNTED=1 |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
243 |
zoneadm -z $ZONENAME mount -f || fatal "$e_badmount" |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
244 |
|
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
245 |
zlogin -S $ZONENAME /usr/sbin/sys-unconfig -R /a \ |
1879
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
246 |
</dev/null >/dev/null 2>&1 |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
247 |
if (( $? != 0 )); then |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
248 |
error "$e_unconfig" |
1493
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
249 |
failed=1 |
1879
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
250 |
fi |
1493
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
251 |
|
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
252 |
vlog "$v_unmount" |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
253 |
zoneadm -z $ZONENAME unmount || fatal "$e_badunmount" |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
254 |
ZONE_IS_MOUNTED=0 |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
255 |
|
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
256 |
[[ -n $failed ]] && fatal "$e_exitfail" |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
257 |
} |
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
258 |
|
625950c12e71
3979 zone fs only available from Global zone, when zone is booted
<gerald.jelinek@sun.com>
parents:
1483
diff
changeset
|
259 |
# |
1879
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
260 |
# Emits to stdout the fmri for the supplied package, |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
261 |
# stripped of publisher name and other junk. |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
262 |
# |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
263 |
get_pkg_fmri() { |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
264 |
typeset pname=$1 |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
265 |
typeset pkg_fmri= |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
266 |
typeset info_out= |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
267 |
|
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
268 |
info_out=$(LC_ALL=C $PKG info pkg:/$pname 2>/dev/null) |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
269 |
if [[ $? -ne 0 ]]; then |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
270 |
return 1 |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
271 |
fi |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
272 |
pkg_fmri=$(echo $info_out | grep FMRI | cut -d'@' -f 2) |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
273 |
echo "$pname@$pkg_fmri" |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
274 |
return 0 |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
275 |
} |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
276 |
|
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
277 |
# |
1091
fc73bc2d78ce
7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents:
954
diff
changeset
|
278 |
# Emits to stdout the entire incorporation for this image, |
fc73bc2d78ce
7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents:
954
diff
changeset
|
279 |
# stripped of publisher name and other junk. |
fc73bc2d78ce
7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents:
954
diff
changeset
|
280 |
# |
fc73bc2d78ce
7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents:
954
diff
changeset
|
281 |
get_entire_incorp() { |
1879
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
282 |
get_pkg_fmri entire |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
283 |
return $? |
1091
fc73bc2d78ce
7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents:
954
diff
changeset
|
284 |
} |
fc73bc2d78ce
7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents:
954
diff
changeset
|
285 |
|
fc73bc2d78ce
7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents:
954
diff
changeset
|
286 |
# |
1709
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
287 |
# Emits to stdout the extended attributes for a publisher. The |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
288 |
# attributes are emitted in the order "sticky preferred enabled". It |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
289 |
# expects two parameters: publisher name and URL type which can be |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
290 |
# ("mirror" or "origin"). |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
291 |
# |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
292 |
get_publisher_attrs() { |
1879
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
293 |
typeset pname=$1 |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
294 |
typeset utype=$2 |
1709
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
295 |
|
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
296 |
LC_ALL=C $PKG publisher -HF tsv| \ |
2219
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2173
diff
changeset
|
297 |
nawk '($5 == "'"$utype"'" || \ |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2173
diff
changeset
|
298 |
("'"$utype"'" == "origin" && $5 == "")) \ |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2173
diff
changeset
|
299 |
&& $1 == "'"$pname"'" \ |
1709
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
300 |
{printf "%s %s %s\n", $2, $3, $4;}' |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
301 |
return 0 |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
302 |
} |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
303 |
|
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
304 |
# |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
305 |
# Emits to stdout the extended attribute arguments for a publisher. It |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
306 |
# expects two parameters: publisher name and URL type which can be |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
307 |
# ("mirror" or "origin"). |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
308 |
# |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
309 |
get_publisher_attr_args() { |
1879
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
310 |
typeset args= |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
311 |
typeset sticky= |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
312 |
typeset preferred= |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
313 |
typeset enabled= |
1709
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
314 |
|
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
315 |
get_publisher_attrs $1 $2 | |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
316 |
while IFS=" " read sticky preferred enabled; do |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
317 |
if [ $sticky == "true" ]; then |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
318 |
args="--sticky" |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
319 |
else |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
320 |
args="--non-sticky" |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
321 |
fi |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
322 |
|
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
323 |
if [ $preferred == "true" ]; then |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
324 |
args="$args -P" |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
325 |
fi |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
326 |
|
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
327 |
if [ $enabled == "true" ]; then |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
328 |
args="$args --enable" |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
329 |
else |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
330 |
args="$args --disable" |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
331 |
fi |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
332 |
done |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
333 |
echo $args |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
334 |
|
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
335 |
return 0 |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
336 |
} |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
337 |
|
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
338 |
# |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
339 |
# Emits to stdout the publisher's prefix followed by a '=', and then |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
340 |
# the list of the requested URLs separated by spaces, followed by a |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
341 |
# newline after each unique publisher. It expects two parameters, |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
342 |
# publisher type ("all", "preferred", "non-preferred") and URL type |
1879
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
343 |
# ("mirror" or "origin".) |
1091
fc73bc2d78ce
7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents:
954
diff
changeset
|
344 |
# |
1504
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
345 |
get_publisher_urls() { |
1879
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
346 |
typeset ptype=$1 |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
347 |
typeset utype=$2 |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
348 |
typeset __pub_prefix= |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
349 |
typeset __publisher_urls= |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
350 |
typeset ptype_filter= |
1504
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
351 |
|
1709
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
352 |
if [ "$ptype" == "all" ] |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
353 |
then |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
354 |
ptype_filter="" |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
355 |
elif [ "$ptype" == "preferred" ] |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
356 |
then |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
357 |
ptype_filter="true" |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
358 |
elif [ "$ptype" == "non-preferred" ] |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
359 |
then |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
360 |
ptype_filter="false" |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
361 |
fi |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
362 |
|
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
363 |
LC_ALL=C $PKG publisher -HF tsv | \ |
2219
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2173
diff
changeset
|
364 |
nawk '($5 == "'"$utype"'" || \ |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2173
diff
changeset
|
365 |
("'"$utype"'" == "origin" && $5 == "")) && \ |
1709
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
366 |
( "'"$ptype_filter"'" == "" || $3 == "'"$ptype_filter"'" ) \ |
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
367 |
{printf "%s %s\n", $1, $7;}' | |
1504
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
368 |
while IFS=" " read __publisher __publisher_url; do |
2219
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2173
diff
changeset
|
369 |
if [[ "$utype" == "origin" && \ |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2173
diff
changeset
|
370 |
-z "$__publisher_url" ]]; then |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2173
diff
changeset
|
371 |
# Publisher without origins. |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2173
diff
changeset
|
372 |
__publisher_url="None" |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2173
diff
changeset
|
373 |
fi |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2173
diff
changeset
|
374 |
|
1504
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
375 |
if [[ -n "$__pub_prefix" && \ |
1709
28592bd37c9d
12738 zone install/attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1535
diff
changeset
|
376 |
"$__pub_prefix" != "$__publisher" ]]; then |
1504
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
377 |
# Different publisher so emit accumulation and |
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
378 |
# clear existing data. |
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
379 |
echo $__pub_prefix=$__publisher_urls |
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
380 |
__publisher_urls="" |
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
381 |
fi |
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
382 |
__pub_prefix=$__publisher |
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
383 |
__publisher_urls="$__publisher_urls$__publisher_url " |
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
384 |
done |
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
385 |
|
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
386 |
if [[ -n "$__pub_prefix" && -n "$__publisher_urls" ]]; then |
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
387 |
echo $__pub_prefix=$__publisher_urls |
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
388 |
fi |
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
389 |
|
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1493
diff
changeset
|
390 |
return 0 |
1091
fc73bc2d78ce
7490 ipkg brand attach needs similar logic to pkgcreatezone for 'entire' incorporation
Dan Price <dp@eng.sun.com>
parents:
954
diff
changeset
|
391 |
} |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1091
diff
changeset
|
392 |
|
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1091
diff
changeset
|
393 |
# |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1091
diff
changeset
|
394 |
# Emit to stdout the key and cert associated with the publisher |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1091
diff
changeset
|
395 |
# name provided. Returns 'None' if no information is present. |
1327
6c5e04bdd8b2
10428 pkgcreatezone "Failed to find cert %s" if global zone publisher has mirror
Darren Moffat <Darren.Moffat@Sun.COM>
parents:
1111
diff
changeset
|
396 |
# For now we assume that the mirrors all use the same key and cert |
6c5e04bdd8b2
10428 pkgcreatezone "Failed to find cert %s" if global zone publisher has mirror
Darren Moffat <Darren.Moffat@Sun.COM>
parents:
1111
diff
changeset
|
397 |
# as the main publisher. |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1091
diff
changeset
|
398 |
# |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1091
diff
changeset
|
399 |
get_pub_secinfo() { |
1879
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
400 |
typeset key= |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
401 |
typeset cert= |
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
402 |
|
1327
6c5e04bdd8b2
10428 pkgcreatezone "Failed to find cert %s" if global zone publisher has mirror
Darren Moffat <Darren.Moffat@Sun.COM>
parents:
1111
diff
changeset
|
403 |
key=$(LC_ALL=C $PKG publisher $1 | |
6c5e04bdd8b2
10428 pkgcreatezone "Failed to find cert %s" if global zone publisher has mirror
Darren Moffat <Darren.Moffat@Sun.COM>
parents:
1111
diff
changeset
|
404 |
nawk -F': ' '/SSL Key/ {print $2; exit 0}') |
6c5e04bdd8b2
10428 pkgcreatezone "Failed to find cert %s" if global zone publisher has mirror
Darren Moffat <Darren.Moffat@Sun.COM>
parents:
1111
diff
changeset
|
405 |
cert=$(LC_ALL=C $PKG publisher $1 | |
6c5e04bdd8b2
10428 pkgcreatezone "Failed to find cert %s" if global zone publisher has mirror
Darren Moffat <Darren.Moffat@Sun.COM>
parents:
1111
diff
changeset
|
406 |
nawk -F': ' '/SSL Cert/ {print $2; exit 0}') |
1111
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1091
diff
changeset
|
407 |
print $key $cert |
26c3e2407c53
8570 zone installer needs support for ssl certs & keys
Dan Price <dp@eng.sun.com>
parents:
1091
diff
changeset
|
408 |
} |
1535 | 409 |
|
410 |
# |
|
411 |
# Handle pkg exit code. Exit 0 means Command succeeded, exit 4 means |
|
412 |
# No changes were made - nothing to do. Any other exit code is an error. |
|
413 |
# |
|
414 |
pkg_err_check() { |
|
1879
7dc50f542f19
14684 zone attach incorporation logic needs enhancement
Gary Pennington <gary.pennington@sun.com>
parents:
1709
diff
changeset
|
415 |
typeset res=$? |
1535 | 416 |
(( $res != 0 && $res != 4 )) && fail_fatal "$1" |
417 |
} |