treewide: replace /sbin/sh hashbangs with /bin/sh
[unleashed.git] / usr / src / cmd / rcm_daemon / common / SUNW,ibsdpu.sh
blob239c8b8acec027ffa404f2ee8aaaa62c2eec9f0c
1 #!/bin/sh
3 # CDDL HEADER START
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.
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.
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]
20 # CDDL HEADER END
24 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # RCM script to inform the need to run 'sdpadm disable' before removing the
30 # last IB HCA, when SDP is enabled in the system.
33 rcm_script_version=1
34 rcm_script_func_info="SDP (un)configuration rcm script"
35 rcm_cmd_timeout=10
36 rcm_resource_name=/devices/ib/sdpib@0:sdpib
38 do_scriptinfo()
40 printf "rcm_script_version=%d\n" $rcm_script_version;
41 printf "rcm_script_func_info=$rcm_script_func_info\n";
42 printf "rcm_cmd_timeout=%d\n" $rcm_cmd_timeout;
43 exit 0;
46 do_register()
48 printf "rcm_resource_name=%s\n" $rcm_resource_name;
49 exit 0;
52 do_resourceinfo()
54 if [ x"$1" = x"/devices/ib/sdpib@0:sdpib" ]
55 then
56 printf "rcm_resource_usage_info=SDP IB device 0\n";
57 exit 0;
58 else
59 printf "rcm_failure_reason=Unknown SDP device\n";
60 exit 3;
64 do_queryremove()
66 status=`sdpadm status`
67 ret=$?
69 if [ $ret -eq 0 ] && [ "$status" != "SDP is Disabled" ]
70 then
71 printf "rcm_log_warn=SDP is enabled. Please run 'sdpadm disable' command "
72 printf "before un-configuring IB HCA/SDP\n";
73 printf "rcm_failure_reason=SDP is enabled on this system\n";
74 exit 3;
75 elif [ $ret -ne 0 ]
76 then
77 printf "rcm_log_warn='sdpadm status' command failed. Could not find the "
78 printf "status of SDP\n";
79 printf "rcm_failure_reason='sdpadm status' command failed.\n";
80 exit 1;
82 exit 0;
85 do_preremove()
87 exit 0;
90 do_undoremove()
92 exit 0;
95 do_postremove()
97 exit 0;
100 case "$1" in
101 scriptinfo) do_scriptinfo;;
102 register) do_register;;
103 resourceinfo) do_resourceinfo $2;;
104 queryremove) do_queryremove $2;;
105 preremove) do_preremove $2;;
106 undoremove) do_undoremove $2;;
107 postremove) do_postremove $2;;
108 *) echo Unknown option $1;;
109 esac