src/brand/pkgcreatezone
author <gerald.jelinek@sun.com>
Tue, 23 Sep 2008 07:41:08 -0600
changeset 547 9a267e76a197
parent 528 697d894dca64
child 554 fe196874250d
permissions -rwxr-xr-x
3454 initial ipkg brand enhancements for SNAP support
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     1
#!/bin/ksh -p
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     2
#
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     3
# CDDL HEADER START
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     4
#
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     8
#
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    12
# and limitations under the License.
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    13
#
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    19
#
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    20
# CDDL HEADER END
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    21
#
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    22
#
371
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
    23
# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    24
# Use is subject to license terms.
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    25
#
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    26
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
    27
. /usr/lib/brand/ipkg/common.ksh
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    28
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    29
f_img=$(gettext "failed to create image")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    30
f_pkg=$(gettext "failed to install package")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    31
f_interrupted=$(gettext "Installation cancelled due to interrupt.")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    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.")
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    34
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
    35
m_core=$(gettext      " Installing: (output follows)\n")
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    36
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
    37
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
    38
m_more_brokenness=$(gettext "Postinstall: Working around http://defect.opensolaris.org/bz/show_bug.cgi?id=741")
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    39
m_mannote=$(gettext   "       Note: Man pages can be obtained by installing SUNWman")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    40
m_complete=$(gettext  "       Done: Installation completed in %s seconds.")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    41
m_postnote=$(gettext  " Next Steps: Boot the zone, then log into the zone console")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    42
m_postnote2=$(gettext "             (zlogin -C) to complete the configuration process")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    43
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    44
m_done=$(gettext      " done.")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    45
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    46
trap_cleanup() {
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    47
	print "$f_interrupted"
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    48
	exit $int_code
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    49
}
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
int_code=$ZONE_SUBPROC_NOTCOMPLETE
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    52
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    53
trap trap_cleanup INT
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    54
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    55
zonename=""
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    56
zonepath=""
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    57
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    58
#
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    59
# If there's a preferred authority set for the system, set that as our
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    60
# default.  Otherwise use opensolaris.org.
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    61
#
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    62
authority="opensolaris.org=http://pkg.opensolaris.org"
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    63
if [[ -x /usr/bin/pkg ]]; then
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    64
	sysauth=`LC_ALL=C /usr/bin/pkg authority | grep preferred | awk '{printf "%s=%s", $1, $3}'`
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    65
	if [[ $? -eq 0 && -n "$sysauth" ]]; then
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    66
		authority=$sysauth
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    67
	fi
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    68
fi
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    69
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    70
# Setup i18n output
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    71
TEXTDOMAIN="SUNW_OST_OSCMD"
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    72
export TEXTDOMAIN
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    73
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    74
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    75
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
    76
	case $opt in
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
    77
		h)	fail_usage "$0 [-h] [-a <authority>]";;
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    78
		R)	zonepath="$OPTARG" ;;
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    79
		z)	zonename="$OPTARG" ;;
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    80
		a)	authority="$OPTARG" ;;
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
    81
		*)	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
    82
	esac
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    83
done
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    84
shift $((OPTIND-1))
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    85
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    86
if [[ -z $zonepath || -z $zonename ]]; then
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    87
	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
    88
	exit $ZONE_SUBPROC_USAGE
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    89
fi
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    90
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    91
zoneroot=$zonepath/root
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    92
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
    93
#
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
    94
# 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
    95
# dataset.
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
    96
#
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
get_current_gzbe
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
    99
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   100
# 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
   101
get_zonepath_ds $zonepath
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   102
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   103
# 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
   104
fail_zonepath_in_rootds $ZONEPATH_DS
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   105
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   106
/usr/sbin/zfs create -o mountpoint=legacy -o zoned=on $ZONEPATH_DS/ROOT \
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   107
	|| fail_fatal "$f_zfs_create"
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   108
/usr/sbin/zfs create -o $PROP_ACTIVE=on -o $PROP_PARENT=$CURRENT_GZBE \
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   109
	$ZONEPATH_DS/ROOT/zbe || fail_incomplete "$f_zfs_create"
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   110
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   111
/usr/bin/mkdir $zoneroot || fail_incomplete "$f_root_create"
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   112
/usr/sbin/mount -F zfs $ZONEPATH_DS/ROOT/zbe $zoneroot || \
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   113
	fail_incomplete "$f_zfs_mount"
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   114
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   115
#
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   116
# Done setting up the zone's datasets.
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   117
#
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   118
371
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   119
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
   120
printf "\n$m_image" $zoneroot
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   121
pkg image-create -z -F -a "$authority" $zoneroot || fail_incomplete "$f_img"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   122
printf "$m_done\n"
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   123
438
69202d962ff6 2736 IPS branded zones should install the entire encorporation
Danek Duvall <danek.duvall@sun.com>
parents: 371
diff changeset
   124
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
   125
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   126
PKG_IMAGE="$zoneroot"
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   127
export PKG_IMAGE
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   128
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   129
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
   130
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
   131
pkg install -q SUNWcsd || fail_incomplete "$f_pkg"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   132
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   133
pkglist=""
344
4c887185d780 528 pkg list -u gives confusing output
Dan Price <dp@eng.sun.com>
parents: 329
diff changeset
   134
pkglist="$pkglist SUNWcnetr SUNWesu SUNWadmr SUNWadmap SUNWbzip SUNWgzip"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   135
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   136
#
371
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   137
# Workaround: For now, SUNWipkg has no dependencies so we must supply it python.
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   138
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   139
pkglist="$pkglist SUNWPython SUNWipkg"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   140
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   141
#
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   142
# Get some diagnostic tools, truss, dtrace, etc.
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   143
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   144
pkglist="$pkglist SUNWtoo SUNWdtrc SUNWrcmdc SUNWbip"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   145
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   146
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   147
# Get at least one sensible shell, and vi
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   148
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   149
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
   150
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   151
#
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   152
# 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
   153
#
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   154
pkglist="$pkglist SUNWsshcu SUNWssh SUNWsshd"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   155
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   156
#
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   157
# Get some name services.
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   158
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   159
pkglist="$pkglist SUNWnis SUNWlldap"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   160
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   161
#
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   162
# Get nfs client and autofs; it's a pain not to have them.
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   163
#
344
4c887185d780 528 pkg list -u gives confusing output
Dan Price <dp@eng.sun.com>
parents: 329
diff changeset
   164
pkglist="$pkglist SUNWnfsc SUNWatfs"
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   165
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   166
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   167
#
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   168
# Get man(1) but not the man pages
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   169
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   170
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
   171
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   172
# 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
   173
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
   174
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   175
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
   176
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   177
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
   178
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
   179
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
   180
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
   181
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
   182
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   183
# 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
   184
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
   185
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
   186
chmod 0600 $repfile
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   187
chown root:sys $repfile
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   188
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   189
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
   190
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
   191
# 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
   192
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
   193
	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
   194
	#
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
   195
	# 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
   196
	#
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
   197
	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
   198
	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
   199
	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
   200
	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
   201
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
   202
	#
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
   203
	# 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
   204
	#
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
   205
	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
   206
	    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
   207
fi
280
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
#
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   210
# 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
   211
# 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
   212
#
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   213
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
   214
/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
   215
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
   216
547
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   217
# Umount the dataset on the root.
9a267e76a197 3454 initial ipkg brand enhancements for SNAP support
<gerald.jelinek@sun.com>
parents: 528
diff changeset
   218
/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
   219
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   220
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
   221
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
   222
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
   223
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   224
exit $ZONE_SUBPROC_OK