author | Karen Tung <Karen.Tung@oracle.com> |
Thu, 04 Aug 2011 11:23:50 -0700 | |
changeset 1357 | c6b82080c0ba |
parent 1001 | fa5c7a246a82 |
permissions | -rw-r--r-- |
660
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
1 |
#!/sbin/sh |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
2 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
4 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
8 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
13 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
19 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
21 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
22 |
# |
1001
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
23 |
# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. |
660
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
24 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
25 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
26 |
# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T. |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
27 |
# All rights reserved. |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
28 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
29 |
|
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
30 |
# Make sure that the libraries essential to this stage of booting can be found. |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
31 |
LD_LIBRARY_PATH=/lib; export LD_LIBRARY_PATH |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
32 |
|
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
33 |
. /lib/svc/share/smf_include.sh |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
34 |
. /lib/svc/share/fs_include.sh |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
35 |
|
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
36 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
37 |
# Remount root RW |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
38 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
39 |
echo "\rRemounting root read/write" > /dev/msglog |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
40 |
ISA_INFO=`/sbin/uname -p` |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
41 |
if [ $ISA_INFO = "sparc" ] |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
42 |
then |
1001
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
43 |
# ramdisk device is different between SPARC and x86 |
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
44 |
RAMDISK=/devices/ramdisk-root:a |
660
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
45 |
else |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
46 |
# x86 label |
1001
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
47 |
RAMDISK=/devices/ramdisk:a |
660
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
48 |
fi |
1001
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
49 |
/sbin/mount -o remount,rw $RAMDISK / |
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
50 |
|
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
51 |
# Remove the SMF repository backup as it is not required in installation and |
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
52 |
# just chews up ramdisk space. RFE 6896186 would remove the need to do this. |
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
53 |
/usr/bin/rm -f /etc/svc/repository-boot* |
660
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
54 |
|
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
55 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
56 |
# Workaround for devfs lazy init. The sd nodes are not |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
57 |
# created till you try to access them. |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
58 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
59 |
echo "Probing for device nodes ..." > /dev/msglog |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
60 |
ls -lR /devices/* > /dev/null |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
61 |
|
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
62 |
# |
868
ccab1050a371
6979474 Miniroot testing for sparc systems failed in snv_147
Jan Damborsky <jan.damborsky@sun.com>
parents:
660
diff
changeset
|
63 |
# Depending upon how we are booted, make sure that either the 'media' instance |
1001
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
64 |
# or the 'net' instance of the filesystem/root-assembly service is enabled. |
868
ccab1050a371
6979474 Miniroot testing for sparc systems failed in snv_147
Jan Damborsky <jan.damborsky@sun.com>
parents:
660
diff
changeset
|
65 |
# |
ccab1050a371
6979474 Miniroot testing for sparc systems failed in snv_147
Jan Damborsky <jan.damborsky@sun.com>
parents:
660
diff
changeset
|
66 |
# Disabling 'media' instance has to be synchronous, otherwise there is |
ccab1050a371
6979474 Miniroot testing for sparc systems failed in snv_147
Jan Damborsky <jan.damborsky@sun.com>
parents:
660
diff
changeset
|
67 |
# a space for race condition - 'media' service could enter online state |
ccab1050a371
6979474 Miniroot testing for sparc systems failed in snv_147
Jan Damborsky <jan.damborsky@sun.com>
parents:
660
diff
changeset
|
68 |
# for a while - after filesystem/root-minimal finishes its job |
ccab1050a371
6979474 Miniroot testing for sparc systems failed in snv_147
Jan Damborsky <jan.damborsky@sun.com>
parents:
660
diff
changeset
|
69 |
# and before request for 'disable' is processed by smf(5) framework. |
660
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
70 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
71 |
if [ $ISA_INFO = "sparc" ]; then |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
72 |
# check if the wanboot device exists |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
73 |
BOOTFS_DISK="/devices/ramdisk-bootfs:a" |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
74 |
if [ -b "$BOOTFS_DISK" ]; then |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
75 |
# booting off of the net |
1001
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
76 |
/usr/sbin/svcadm enable svc:/system/filesystem/root-assembly:net |
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
77 |
/usr/sbin/svcadm disable -s \ |
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
78 |
svc:/system/filesystem/root-assembly:media |
1357
c6b82080c0ba
7068988 The physical:default fails when booting from Auto Install media, unable to get manifest
Karen Tung <Karen.Tung@oracle.com>
parents:
1001
diff
changeset
|
79 |
else |
c6b82080c0ba
7068988 The physical:default fails when booting from Auto Install media, unable to get manifest
Karen Tung <Karen.Tung@oracle.com>
parents:
1001
diff
changeset
|
80 |
# enable automatic network configuration for media booted |
c6b82080c0ba
7068988 The physical:default fails when booting from Auto Install media, unable to get manifest
Karen Tung <Karen.Tung@oracle.com>
parents:
1001
diff
changeset
|
81 |
# environments |
c6b82080c0ba
7068988 The physical:default fails when booting from Auto Install media, unable to get manifest
Karen Tung <Karen.Tung@oracle.com>
parents:
1001
diff
changeset
|
82 |
/usr/sbin/svccfg apply /etc/svc/profile/network_nwam.xml |
660
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
83 |
fi |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
84 |
else |
1001
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
85 |
MEDIA=`/sbin/devprop -s install_media` |
660
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
86 |
if [ ! -z "$MEDIA" ]; then |
1001
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
87 |
/usr/sbin/svcadm enable svc:/system/filesystem/root-assembly:net |
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
88 |
/usr/sbin/svcadm disable -s \ |
fa5c7a246a82
1351 combine listcd and listusb.
David Miner <dminer@opensolaris.org>
parents:
868
diff
changeset
|
89 |
svc:/system/filesystem/root-assembly:media |
1357
c6b82080c0ba
7068988 The physical:default fails when booting from Auto Install media, unable to get manifest
Karen Tung <Karen.Tung@oracle.com>
parents:
1001
diff
changeset
|
90 |
else |
c6b82080c0ba
7068988 The physical:default fails when booting from Auto Install media, unable to get manifest
Karen Tung <Karen.Tung@oracle.com>
parents:
1001
diff
changeset
|
91 |
# enable automatic network configuration for media booted |
c6b82080c0ba
7068988 The physical:default fails when booting from Auto Install media, unable to get manifest
Karen Tung <Karen.Tung@oracle.com>
parents:
1001
diff
changeset
|
92 |
# environments |
c6b82080c0ba
7068988 The physical:default fails when booting from Auto Install media, unable to get manifest
Karen Tung <Karen.Tung@oracle.com>
parents:
1001
diff
changeset
|
93 |
/usr/sbin/svccfg apply /etc/svc/profile/network_nwam.xml |
660
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
94 |
fi |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
95 |
fi |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
96 |
|
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
diff
changeset
|
97 |
exit $SMF_EXIT_OK |