Print this page
4360 Fix SMF methods and other scripts which rely on the system shell to use /sbin/sh
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libdscp/svc/svc-dscp
+++ new/usr/src/lib/libdscp/svc/svc-dscp
1 -#!/bin/sh
1 +#!/sbin/sh
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22 #
23 23 # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 24 # Use is subject to license terms.
25 25 #
26 -# ident "%Z%%M% %I% %E% SMI"
27 26 #
28 27
29 28 #
30 29 # Start script for the SPARC-Enterprise DSCP service.
31 30 #
32 31
33 32 . /lib/svc/share/smf_include.sh
34 33
35 34 OPL=SUNW,SPARC-Enterprise
36 35 OPL_LIB=/usr/platform/${OPL}/lib
37 36 DM2S_DEVICE=/dev/dm2s0
38 37 PPP_OPTIONS=${OPL_LIB}/dscp.ppp.options
39 38 DSCP_IFNAME=/var/run/dscp.ifname
40 39 PRTDSCP=/usr/platform/${OPL}/sbin/prtdscp
41 40 PLATFORM=`/sbin/uname -i`
42 41 SLEEP=/bin/sleep
43 42 PKILL=/bin/pkill
44 43
45 44 LD_LIBRARY_PATH=/lib:${OPL_LIB}; export LD_LIBRARY_PATH
46 45
47 46 # This service can only run on OPL.
48 47 if [ "${PLATFORM}" != "${OPL}" ]; then
49 48 exit $SMF_EXIT_ERR_CONFIG
50 49 fi
51 50
52 51 case "$1" in
53 52 'start')
54 53
55 54 if [ ! -x /usr/bin/pppd ]; then
56 55 exit $SMF_EXIT_ERR_CONFIG
57 56 fi
58 57
59 58 if [ ! -c $DM2S_DEVICE ]; then
60 59 exit $SMF_EXIT_ERR_CONFIG
61 60 fi
62 61
63 62 if [ ! -f $PPP_OPTIONS ]; then
64 63 exit $SMF_EXIT_ERR_CONFIG
65 64 fi
66 65
67 66 SUCCESS=0
68 67 for UNIT in 0 1 2 3 4 5 6 7 8 9; do
69 68 /usr/bin/pppd $DM2S_DEVICE unit $UNIT file $PPP_OPTIONS
70 69 if [ ! "$?" = "1" ]; then
71 70 echo "sppp$UNIT" > $DSCP_IFNAME
72 71 SUCCESS=1
73 72 break
74 73 fi
75 74 done
76 75
77 76 if [ $SUCCESS -ne 1 ]; then
78 77 exit $SMF_EXIT_ERR_FATAL
79 78 fi
80 79
81 80 # Wait for the DSCP link to come up, but only for 30 seconds
82 81 for RETRY in 0 1 2 3 4 5; do
83 82 ${PRTDSCP} >/dev/null 2>&1
84 83 if [ $? -eq 0 ]; then
85 84 exit $SMF_EXIT_OK
86 85 fi
87 86 ${SLEEP} 5
88 87 done
89 88
90 89 # Stop pppd before we return failure
91 90 ${PKILL} -TERM -f "pppd ${DM2S_DEVICE}"
92 91 ${SLEEP} 1
93 92 ${PKILL} -KILL -f "pppd ${DM2S_DEVICE}"
94 93 rm -f $DSCP_IFNAME
95 94 exit $SMF_EXIT_ERR_FATAL
96 95 ;;
97 96
98 97 'stop')
99 98 # First try SIGTERM and then SIGKILL
100 99 ${PKILL} -TERM -f "pppd ${DM2S_DEVICE}"
101 100 ${SLEEP} 1
102 101 ${PKILL} -KILL -f "pppd ${DM2S_DEVICE}"
103 102 rm -f $DSCP_IFNAME
104 103 exit $SMF_EXIT_OK
105 104 ;;
106 105 esac
↓ open down ↓ |
70 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX