summaryrefslogtreecommitdiff
path: root/usr/src/cmd/initpkg
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/initpkg')
-rw-r--r--usr/src/cmd/initpkg/init.d/volmgt17
-rw-r--r--usr/src/cmd/initpkg/rc2.sh30
-rw-r--r--usr/src/cmd/initpkg/rc3.sh31
-rw-r--r--usr/src/cmd/initpkg/rcS.sh48
4 files changed, 35 insertions, 91 deletions
diff --git a/usr/src/cmd/initpkg/init.d/volmgt b/usr/src/cmd/initpkg/init.d/volmgt
index 5d9d2ce4da..e7a155f89e 100644
--- a/usr/src/cmd/initpkg/init.d/volmgt
+++ b/usr/src/cmd/initpkg/init.d/volmgt
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -21,15 +20,21 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
+. /lib/svc/share/smf_include.sh
+
+if smf_is_nonglobalzone; then
+ echo "Volume management is not available in non-global zones."
+ exit 1
+fi
+
case "$1" in
'start')
- if [ -f /etc/vold.conf -a -f /usr/sbin/vold -a \
- "${_INIT_ZONENAME:=`/sbin/zonename`}" = "global" ]; then
+ if [ -f /etc/vold.conf -a -f /usr/sbin/vold ]; then
echo 'volume management starting.'
svcadm enable svc:/system/filesystem/volfs:default
fi
diff --git a/usr/src/cmd/initpkg/rc2.sh b/usr/src/cmd/initpkg/rc2.sh
index 979890592f..d9628c977f 100644
--- a/usr/src/cmd/initpkg/rc2.sh
+++ b/usr/src/cmd/initpkg/rc2.sh
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -25,7 +24,7 @@
# All rights reserved.
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -41,6 +40,8 @@ if [ -z "$SMF_RESTARTER" ]; then
exit 1
fi
+. /lib/svc/share/smf_include.sh
+
action=$1
# Export boot parameters to rc scripts
@@ -65,23 +66,10 @@ export _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
_INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
_INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
-_INIT_ZONENAME=`/sbin/zonename`
-
-export _INIT_ZONENAME
-
-if [ "$_INIT_ZONENAME" = "global" ]; then
- # Export net boot configuration strategy. _INIT_NET_IF is set to the
- # interface name of the netbooted interface if this is a net boot.
- # _INIT_NET_STRATEGY is set to the network configuration strategy.
- set -- `/sbin/netstrategy`
- if [ $? -eq 0 ]; then
- if [ "$1" = "nfs" -o "$1" = "cachefs" ]; then
- _INIT_NET_IF="$2"
- fi
- _INIT_NET_STRATEGY="$3"
- export _INIT_NET_IF _INIT_NET_STRATEGY
- fi
-fi
+#
+# Set _INIT_NET_STRATEGY and _INIT_NET_IF variables from /sbin/netstrategy
+#
+smf_netstrategy
case $action in
stop)
diff --git a/usr/src/cmd/initpkg/rc3.sh b/usr/src/cmd/initpkg/rc3.sh
index bdaa047e9f..fc9d743cb2 100644
--- a/usr/src/cmd/initpkg/rc3.sh
+++ b/usr/src/cmd/initpkg/rc3.sh
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -25,7 +24,7 @@
# All rights reserved.
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -40,6 +39,8 @@ if [ -z "$SMF_RESTARTER" ]; then
exit 1
fi
+. /lib/svc/share/smf_include.sh
+
# Export boot parameters to rc scripts
set -- `/usr/bin/who -r`
@@ -62,23 +63,11 @@ export _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
_INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
_INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
-_INIT_ZONENAME=`/sbin/zonename`
-
-export _INIT_ZONENAME
+#
+# Set _INIT_NET_STRATEGY and _INIT_NET_IF variables from /sbin/netstrategy
+#
+smf_netstrategy
-if [ "$_INIT_ZONENAME" = "global" ]; then
- # Export net boot configuration strategy. _INIT_NET_IF is set to the
- # interface name of the netbooted interface if this is a net boot.
- # _INIT_NET_STRATEGY is set to the network configuration strategy.
- set -- `/sbin/netstrategy`
- if [ $? -eq 0 ]; then
- if [ "$1" = "nfs" -o "$1" = "cachefs" ]; then
- _INIT_NET_IF="$2"
- fi
- _INIT_NET_STRATEGY="$3"
- export _INIT_NET_IF _INIT_NET_STRATEGY
- fi
-fi
if [ -d /etc/rc3.d ]; then
for f in /etc/rc3.d/K*; do
@@ -100,7 +89,7 @@ if [ -d /etc/rc3.d ]; then
done
fi
-if [ "$_INIT_ZONENAME" = "global" ]; then
+if smf_is_globalzone; then
# Unload all the loadable modules brought in during boot
# Delay a few seconds to allow dtlogin to open console first.
diff --git a/usr/src/cmd/initpkg/rcS.sh b/usr/src/cmd/initpkg/rcS.sh
index 962035549e..5e41614d7e 100644
--- a/usr/src/cmd/initpkg/rcS.sh
+++ b/usr/src/cmd/initpkg/rcS.sh
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -102,47 +101,10 @@ export _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
_INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
_INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
-_INIT_ZONENAME=`/sbin/zonename`
-
-export _INIT_ZONENAME
-
-if [ "$_INIT_ZONENAME" = "global" ]; then
- # Export net boot configuration strategy. _INIT_NET_IF is set to the
- # interface name of the netbooted interface if this is a net boot.
- # _INIT_NET_STRATEGY is set to the network configuration strategy.
- set -- `/sbin/netstrategy`
- if [ $? -eq 0 ]; then
- if [ "$1" = "nfs" -o "$1" = "cachefs" ]; then
- _INIT_NET_IF="$2"
- export _INIT_NET_IF
- fi
- _INIT_NET_STRATEGY="$3"
- fi
-else
- # Special case for zones since netstrategy needs /dev/ip which does
- # not exist in a non-global zone. Also, the _IF variable is only
- # consumed in the global zone.
- _INIT_NET_STRATEGY="none"
-fi
-export _INIT_NET_STRATEGY
-
-#
-# Useful shell functions:
-#
-
-#
-# shcat file
#
-# Simulates cat in sh so it doesn't need to be on the root filesystem.
+# Set _INIT_NET_STRATEGY and _INIT_NET_IF variables from /sbin/netstrategy
#
-shcat() {
- while [ $# -ge 1 ]; do
- while read i; do
- echo "$i"
- done < $1
- shift
- done
-}
+smf_netstrategy
. /lib/svc/share/fs_include.sh