src/brand/pkgcreatezone
author Dan Price <dp@eng.sun.com>
Sun, 04 May 2008 18:11:59 -0700
changeset 371 e4db4be79d2e
parent 344 4c887185d780
child 438 69202d962ff6
permissions -rwxr-xr-x
1756 IPS Zone creation includes shadow entry for jack 1778 pkgcreatezone is sloppy with file perms 1779 nuke redundant refresh, and other miscellaneous cleanup in pkgcreatezone
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
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    27
ZONE_SUBPROC_OK=0
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    28
ZONE_SUBPROC_USAGE=253
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    29
ZONE_SUBPROC_NOTCOMPLETE=254
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    30
ZONE_SUBPROC_FATAL=255
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    31
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    32
f_img=$(gettext "failed to create image")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    33
f_pkg=$(gettext "failed to install package")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    34
f_interrupted=$(gettext "Installation cancelled due to interrupt.")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    35
371
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
    36
m_authority=$(gettext   "  Authority: Using %s.")
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    37
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
    38
m_core=$(gettext      " Installing: (output follows)\n")
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    39
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
    40
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
    41
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
    42
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
    43
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
    44
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
    45
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
    46
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    47
m_done=$(gettext      " done.")
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    48
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    49
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    50
fail_incomplete() {
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    51
	print -u2 "$1"
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    52
	exit $ZONE_SUBPROC_NOTCOMPLETE
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    53
}
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    54
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    55
fail_fatal() {
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    56
	print -u2 "$1"
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    57
	exit $ZONE_SUBPROC_FATAL
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    58
}
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    59
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    60
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    61
fail_usage() {
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    62
	print "Usage: $0 [-h] [-a <authority>]"
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    63
	exit $ZONE_SUBPROC_USAGE
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    64
}
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    65
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    66
trap_cleanup() {
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    67
	print "$f_interrupted"
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    68
	exit $int_code
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    69
}
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    70
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    71
int_code=$ZONE_SUBPROC_NOTCOMPLETE
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    72
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    73
trap trap_cleanup INT
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    74
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    75
zonename=""
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    76
zonepath=""
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    77
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    78
#
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    79
# 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
    80
# default.  Otherwise use opensolaris.org.
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    81
#
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    82
authority="opensolaris.org=http://pkg.opensolaris.org"
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    83
if [[ -x /usr/bin/pkg ]]; then
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    84
	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
    85
	if [[ $? -eq 0 && -n "$sysauth" ]]; then
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    86
		authority=$sysauth
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    87
	fi
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    88
fi
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
    89
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    90
# Setup i18n output
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    91
TEXTDOMAIN="SUNW_OST_OSCMD"
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    92
export TEXTDOMAIN
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    93
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    94
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    95
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
    96
	case $opt in
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    97
		h)	fail_usage ;;
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
    98
		R)	zonepath="$OPTARG" ;;
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    99
		z)	zonename="$OPTARG" ;;
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   100
		a)	authority="$OPTARG" ;;
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   101
		*)	fail_usage ;;
97
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   102
	esac
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   103
done
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   104
shift $((OPTIND-1))
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   105
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   106
if [[ -z $zonepath || -z $zonename ]]; then
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   107
	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
   108
	exit $ZONE_SUBPROC_USAGE
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   109
fi
9a488b15900f Introduce a branded zone as a testing aid
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   110
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   111
zoneroot=$zonepath/root
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   112
371
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   113
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
   114
printf "\n$m_image" $zoneroot
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   115
pkg image-create -z -F -a "$authority" $zoneroot || fail_fatal $f_img
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   116
printf "$m_done\n"
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   117
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   118
PKG_IMAGE="$zoneroot"
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   119
export PKG_IMAGE
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   120
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   121
printf "$m_core\n"
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   122
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
   123
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   124
pkglist=""
344
4c887185d780 528 pkg list -u gives confusing output
Dan Price <dp@eng.sun.com>
parents: 329
diff changeset
   125
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
   126
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   127
#
371
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   128
# 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
   129
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   130
pkglist="$pkglist SUNWPython SUNWipkg"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   131
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   132
#
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   133
# Get some diagnostic tools, truss, dtrace, etc.
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   134
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   135
pkglist="$pkglist SUNWtoo SUNWdtrc SUNWrcmdc SUNWbip"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   136
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   137
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   138
# 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
   139
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   140
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
   141
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   142
#
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   143
# 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
   144
#
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   145
pkglist="$pkglist SUNWsshcu SUNWssh SUNWsshd"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   146
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   147
#
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   148
# Get some name services.
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   149
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   150
pkglist="$pkglist SUNWnis SUNWlldap"
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   151
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   152
#
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   153
# 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
   154
#
344
4c887185d780 528 pkg list -u gives confusing output
Dan Price <dp@eng.sun.com>
parents: 329
diff changeset
   155
pkglist="$pkglist SUNWnfsc SUNWatfs"
329
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   156
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   157
f549eab0d7b7 735 install -n uninformative
Dan Price <dp@eng.sun.com>
parents: 280
diff changeset
   158
#
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   159
# Get man(1) but not the man pages
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   160
#
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   161
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
   162
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   163
# 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
   164
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
   165
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   166
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
   167
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   168
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
   169
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
   170
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
   171
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
   172
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
   173
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   174
# 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
   175
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
   176
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
   177
chmod 0600 $repfile
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   178
chown root:sys $repfile
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   179
168
bbeeeaf343c0 16 Improve ipkg brand installer
Dan Price <dp@eng.sun.com>
parents: 111
diff changeset
   180
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
   181
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
printf "$m_brokenness\n"
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   184
#
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   185
# Remove "jack" user.
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   186
#
371
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   187
print "/^jack:/d\nw" | ed -s $zoneroot/etc/passwd
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   188
chmod u+w $zoneroot/etc/shadow
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   189
print "/^jack:/d\nw" | ed -s $zoneroot/etc/shadow
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   190
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
   191
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   192
#
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   193
# Set root from a role back to... not a role.  Grr.
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   194
#
371
e4db4be79d2e 1756 IPS Zone creation includes shadow entry for jack
Dan Price <dp@eng.sun.com>
parents: 344
diff changeset
   195
print "s/^root::::type=role;/root::::/\nw" | ed -s $zoneroot/etc/user_attr
280
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   196
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   197
#
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   198
# 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
   199
# 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
   200
#
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   201
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
   202
/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
   203
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
   204
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   205
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   206
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
   207
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
   208
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
   209
84c03819796f 742 Zones are broken due to 681 and 741; supply workarounds
Dan Price <dp@eng.sun.com>
parents: 210
diff changeset
   210
exit $ZONE_SUBPROC_OK