smf_include.sh (0:68f95e015346) smf_include.sh (1573:7338e65f2666)
1#!/bin/sh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
1#!/bin/sh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License, Version 1.0 only
7# (the "License"). You may not use this file except in compliance
8# with the License.
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23#
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
24# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
23# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
25# Use is subject to license terms.
26#
27#ident "%Z%%M% %I% %E% SMI"
28
29smf_present () {
30 [ -r /etc/svc/volatile/repository_door ] && \
31 [ ! -f /etc/svc/volatile/repository_door ]
32}
33
34smf_clear_env () {
35 unset \
36 SMF_FMRI \
37 SMF_METHOD \
24# Use is subject to license terms.
25#
26#ident "%Z%%M% %I% %E% SMI"
27
28smf_present () {
29 [ -r /etc/svc/volatile/repository_door ] && \
30 [ ! -f /etc/svc/volatile/repository_door ]
31}
32
33smf_clear_env () {
34 unset \
35 SMF_FMRI \
36 SMF_METHOD \
38 SMF_RESTARTER
37 SMF_RESTARTER \
38 SMF_ZONENAME
39}
40
41# smf_console
42#
43# Use as "echo message 2>&1 | smf_console". If SMF_MSGLOG_REDIRECT is
44# unset, message will be displayed to console. SMF_MSGLOG_REDIRECT is
45# reserved for future use.
46#
47smf_console () {
48 /usr/bin/tee ${SMF_MSGLOG_REDIRECT:-/dev/msglog}
49}
50
39}
40
41# smf_console
42#
43# Use as "echo message 2>&1 | smf_console". If SMF_MSGLOG_REDIRECT is
44# unset, message will be displayed to console. SMF_MSGLOG_REDIRECT is
45# reserved for future use.
46#
47smf_console () {
48 /usr/bin/tee ${SMF_MSGLOG_REDIRECT:-/dev/msglog}
49}
50
51# smf_zonename
51#
52#
53# Prints the name of this zone.
54
55smf_zonename() {
56 echo "${SMF_ZONENAME:=`/sbin/zonename`}"
57}
58
59# smf_is_globalzone
60#
61# Returns zero (success) if this is the global zone. 1 otherwise.
62#
63smf_is_globalzone() {
64 [ "${SMF_ZONENAME:=`/sbin/zonename`}" = "global" ] && return 0
65 return 1
66}
67
68# smf_is_nonglobalzone
69#
70# Returns zero (success) if this is not the global zone. 1 otherwise.
71#
72smf_is_nonglobalzone() {
73 [ "${SMF_ZONENAME:=`/sbin/zonename`}" != "global" ] && return 0
74 return 1
75}
76
52# smf_netstrategy
53# -> (_INIT_NET_IF, _INIT_NET_STRATEGY)
54#
55# Sets _INIT_NET_IF to the name for the network-booted
56# interface if we are booting from the network. _INIT_NET_STRATEGY is
57# assigned the value of the current network configuration strategy.
58# Valid values for _INIT_NET_STRATEGY are "none", "dhcp", and "rarp".
59#
60# The network boot strategy for a zone is always "none".
61#
62smf_netstrategy () {
77# smf_netstrategy
78# -> (_INIT_NET_IF, _INIT_NET_STRATEGY)
79#
80# Sets _INIT_NET_IF to the name for the network-booted
81# interface if we are booting from the network. _INIT_NET_STRATEGY is
82# assigned the value of the current network configuration strategy.
83# Valid values for _INIT_NET_STRATEGY are "none", "dhcp", and "rarp".
84#
85# The network boot strategy for a zone is always "none".
86#
87smf_netstrategy () {
63 if [ "${_INIT_ZONENAME:=`/sbin/zonename`}" != "global" ]; then
88 if smf_is_nonglobalzone; then
64 _INIT_NET_STRATEGY="none" export _INIT_NET_STRATEGY
65 return 0
66 fi
67
68 set -- `/sbin/netstrategy`
69 if [ $? -eq 0 ]; then
70 [ "$1" = "nfs" -o "$1" = "cachefs" ] && \
71 _INIT_NET_IF="$2" export _INIT_NET_IF

--- 88 unchanged lines hidden ---
89 _INIT_NET_STRATEGY="none" export _INIT_NET_STRATEGY
90 return 0
91 fi
92
93 set -- `/sbin/netstrategy`
94 if [ $? -eq 0 ]; then
95 [ "$1" = "nfs" -o "$1" = "cachefs" ] && \
96 _INIT_NET_IF="$2" export _INIT_NET_IF

--- 88 unchanged lines hidden ---