5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
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 #
23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26
27 smf_present () {
28 [ -r /etc/svc/volatile/repository_door ] && \
29 [ ! -f /etc/svc/volatile/repository_door ]
30 }
31
32 smf_clear_env () {
33 unset \
34 SMF_FMRI \
35 SMF_METHOD \
36 SMF_RESTARTER \
37 SMF_ZONENAME
38 }
39
40 # smf_console
41 #
42 # Use as "echo message 2>&1 | smf_console". If SMF_MSGLOG_REDIRECT is
43 # unset, message will be displayed to console. SMF_MSGLOG_REDIRECT is
44 # reserved for future use.
117 }
118
119 # smf_netstrategy
120 # -> (_INIT_NET_IF, _INIT_NET_STRATEGY)
121 #
122 # Sets _INIT_NET_IF to the name for the network-booted
123 # interface if we are booting from the network. _INIT_NET_STRATEGY is
124 # assigned the value of the current network configuration strategy.
125 # Valid values for _INIT_NET_STRATEGY are "none", "dhcp", and "rarp".
126 #
127 # The network boot strategy for a zone is always "none".
128 #
129 smf_netstrategy () {
130 if smf_is_nonglobalzone; then
131 _INIT_NET_STRATEGY="none" export _INIT_NET_STRATEGY
132 return 0
133 fi
134
135 set -- `/sbin/netstrategy`
136 if [ $? -eq 0 ]; then
137 [ "$1" = "nfs" -o "$1" = "cachefs" ] && \
138 _INIT_NET_IF="$2" export _INIT_NET_IF
139 _INIT_NET_STRATEGY="$3" export _INIT_NET_STRATEGY
140 else
141 return 1
142 fi
143 }
144
145 #
146 # smf_kill_contract CONTRACT SIGNAL WAIT TIMEOUT
147 #
148 # To be called from stop methods of non-transient services.
149 # Sends SIGNAL to the service contract CONTRACT. If the
150 # WAIT argument is non-zero, smf_kill_contract will wait
151 # until the contract is empty before returning, or until
152 # TIMEOUT expires.
153 #
154 # Example, send SIGTERM to contract 200:
155 #
156 # smf_kill_contract 200 TERM
157 #
|
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
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 #
23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 # Copyright 2015 Nexenta Systems, Inc. All rights reserved.
26 #
27
28 smf_present () {
29 [ -r /etc/svc/volatile/repository_door ] && \
30 [ ! -f /etc/svc/volatile/repository_door ]
31 }
32
33 smf_clear_env () {
34 unset \
35 SMF_FMRI \
36 SMF_METHOD \
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.
118 }
119
120 # smf_netstrategy
121 # -> (_INIT_NET_IF, _INIT_NET_STRATEGY)
122 #
123 # Sets _INIT_NET_IF to the name for the network-booted
124 # interface if we are booting from the network. _INIT_NET_STRATEGY is
125 # assigned the value of the current network configuration strategy.
126 # Valid values for _INIT_NET_STRATEGY are "none", "dhcp", and "rarp".
127 #
128 # The network boot strategy for a zone is always "none".
129 #
130 smf_netstrategy () {
131 if smf_is_nonglobalzone; then
132 _INIT_NET_STRATEGY="none" export _INIT_NET_STRATEGY
133 return 0
134 fi
135
136 set -- `/sbin/netstrategy`
137 if [ $? -eq 0 ]; then
138 [ "$1" = "nfs" ] && \
139 _INIT_NET_IF="$2" export _INIT_NET_IF
140 _INIT_NET_STRATEGY="$3" export _INIT_NET_STRATEGY
141 else
142 return 1
143 fi
144 }
145
146 #
147 # smf_kill_contract CONTRACT SIGNAL WAIT TIMEOUT
148 #
149 # To be called from stop methods of non-transient services.
150 # Sends SIGNAL to the service contract CONTRACT. If the
151 # WAIT argument is non-zero, smf_kill_contract will wait
152 # until the contract is empty before returning, or until
153 # TIMEOUT expires.
154 #
155 # Example, send SIGTERM to contract 200:
156 #
157 # smf_kill_contract 200 TERM
158 #
|