2N/A#!/bin/sh
2N/A#
2N/A# CDDL HEADER START
2N/A#
2N/A# The contents of this file are subject to the terms of the
2N/A# Common Development and Distribution License (the "License").
2N/A# You may not use this file except in compliance with the License.
2N/A#
2N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A# or http://www.opensolaris.org/os/licensing.
2N/A# See the License for the specific language governing permissions
2N/A# and limitations under the License.
2N/A#
2N/A# When distributing Covered Code, include this CDDL HEADER in each
2N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A# If applicable, add the following below this CDDL HEADER, with the
2N/A# fields enclosed by brackets "[]" replaced with your own identifying
2N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2N/A#
2N/A# CDDL HEADER END
2N/A#
2N/A#
2N/A# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A#
2N/A
2N/A#
2N/A# Start script for the SPARC-Enterprise DSCP service.
2N/A#
2N/A
2N/A. /lib/svc/share/smf_include.sh
2N/A
2N/AOPL=SUNW,SPARC-Enterprise
2N/AOPL_LIB=/usr/platform/${OPL}/lib
2N/ADM2S_DEVICE=/dev/dm2s0
2N/APPP_OPTIONS=${OPL_LIB}/dscp.ppp.options
2N/ADSCP_IFNAME=$SMF_SYSVOL_FS/dscp.ifname
2N/APRTDSCP=/usr/platform/${OPL}/sbin/prtdscp
2N/APLATFORM=`/usr/sbin/uname -i`
2N/ASLEEP=/bin/sleep
2N/APKILL=/bin/pkill
2N/A
2N/ALD_LIBRARY_PATH=/lib:${OPL_LIB}; export LD_LIBRARY_PATH
2N/A
2N/A# This service can only run on OPL.
2N/Aif [ "${PLATFORM}" != "${OPL}" ]; then
2N/A exit $SMF_EXIT_ERR_CONFIG
2N/Afi
2N/A
2N/Acase "$1" in
2N/A'start')
2N/A
2N/A if [ ! -x /usr/bin/pppd ]; then
2N/A exit $SMF_EXIT_ERR_CONFIG
2N/A fi
2N/A
2N/A if [ ! -c $DM2S_DEVICE ]; then
2N/A exit $SMF_EXIT_ERR_CONFIG
2N/A fi
2N/A
2N/A if [ ! -f $PPP_OPTIONS ]; then
2N/A exit $SMF_EXIT_ERR_CONFIG
2N/A fi
2N/A
2N/A SUCCESS=0
2N/A for UNIT in 0 1 2 3 4 5 6 7 8 9; do
2N/A /usr/bin/pppd $DM2S_DEVICE unit $UNIT file $PPP_OPTIONS
2N/A if [ ! "$?" = "1" ]; then
2N/A echo "sppp$UNIT" > $DSCP_IFNAME
2N/A SUCCESS=1
2N/A break
2N/A fi
2N/A done
2N/A
2N/A if [ $SUCCESS -ne 1 ]; then
2N/A exit $SMF_EXIT_ERR_FATAL
2N/A fi
2N/A
2N/A # Wait for the DSCP link to come up, but only for 30 seconds
2N/A for RETRY in 0 1 2 3 4 5; do
2N/A ${PRTDSCP} >/dev/null 2>&1
2N/A if [ $? -eq 0 ]; then
2N/A exit $SMF_EXIT_OK
2N/A fi
2N/A ${SLEEP} 5
2N/A done
2N/A
2N/A # Stop pppd before we return failure
2N/A ${PKILL} -TERM -f "pppd ${DM2S_DEVICE}"
2N/A ${SLEEP} 1
2N/A ${PKILL} -KILL -f "pppd ${DM2S_DEVICE}"
2N/A rm -f $DSCP_IFNAME
2N/A exit $SMF_EXIT_ERR_FATAL
2N/A ;;
2N/A
2N/A'stop')
2N/A # First try SIGTERM and then SIGKILL
2N/A ${PKILL} -TERM -f "pppd ${DM2S_DEVICE}"
2N/A ${SLEEP} 1
2N/A ${PKILL} -KILL -f "pppd ${DM2S_DEVICE}"
2N/A rm -f $DSCP_IFNAME
2N/A exit $SMF_EXIT_OK
2N/A ;;
2N/Aesac