Print this page
XXX Remove nawk(1)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/ypcmd/ypstart.sh
+++ new/usr/src/cmd/ypcmd/ypstart.sh
1 1 #!/bin/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 ↓ |
15 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 -#
28 26 # Enable appropriate NIS daemons based on the current configuration.
29 27
30 28 enable () {
31 29 /usr/sbin/svcadm enable -t $1
32 30 [ $? = 0 ] || echo "ypstart: unable to enable $1"
33 31
34 32 if [ "`/usr/bin/svcprop -p restarter/state $1`" = "maintenance" ]; then
35 33 echo "ypstart: unable to enable $1; in maintenance"
36 34 fi
37 35 }
38 36
39 37
40 38 domain=`domainname`
41 39 if [ -z "$domain" ]; then
42 40 echo "ERROR: Default domain is not defined. \c"
43 41 echo "Use \"domainname\" to set the domain."
44 42 exit 1
45 43 fi
46 44
47 45 echo "starting NIS (YP server) services:\c"
48 46
49 47 zone=`/sbin/zonename`
50 48
51 49 if [ -d /var/yp/$domain ]; then
52 50 state=`/usr/bin/svcprop -p restarter/state network/nis/server:default`
53 51
54 52 [ "$state" = "disabled" ] && if [ -n "`pgrep -z $zone ypserv`" ]; then
55 53 echo "ypstart: ypserv already running?"
56 54 fi
57 55
58 56 enable svc:/network/nis/server:default && echo " ypserv\c"
↓ open down ↓ |
21 lines elided |
↑ open up ↑ |
59 57
60 58 YP_SERVER=TRUE # remember we're a server for later
61 59
62 60 # check to see if we are the master
63 61 if [ -f /var/yp/NISLDAPmapping ]; then
64 62 passwdfile=/var/yp/$domain/LDAP_passwd.byname
65 63 else
66 64 passwdfile=/var/yp/$domain/passwd.byname
67 65 fi
68 66 master=`/usr/sbin/makedbm -u $passwdfile | grep YP_MASTER_NAME \
69 - | nawk '{ print tolower($2) }'`
67 + | /usr/xpg4/bin/awk '{ print tolower($2) }'`
70 68 fi
71 69
72 70 # Enabling the YP client is not strictly necessary, but it is
73 71 # traditional.
74 72 state=`/usr/bin/svcprop -p restarter/state network/nis/client:default`
75 73
76 74 [ "$state" = "disabled" ] && if [ -n "`pgrep -z $zone ypbind`" ]; then
77 75 echo "ypstart: ypbind already running?"
78 76 fi
79 77
80 78 enable svc:/network/nis/client:default && echo " ypbind\c"
81 79
82 80 # do a ypwhich to force ypbind to get bound
83 81 ypwhich > /dev/null 2>&1
84 82
85 83 if [ "$YP_SERVER" = TRUE ]; then
86 84 # Are we the master server? If so, start the
87 85 # ypxfrd, rpc.yppasswdd and rpc.ypupdated daemons.
88 86 hostname=`uname -n | tr '[A-Z]' '[a-z]'`
89 87
90 88 if [ "$master" = "$hostname" ]; then
91 89 enable svc:/network/nis/xfr:default && echo " ypxfrd\c"
92 90 enable svc:/network/nis/passwd:default &&
93 91 echo " rpc.yppasswdd\c"
94 92
95 93 if [ ! -f /var/yp/NISLDAPmapping -a -f /var/yp/updaters ]; then
96 94 enable svc:/network/nis/update:default &&
97 95 echo " rpc.ypupdated\c"
98 96 fi
99 97 fi
100 98 fi
101 99
102 100 # As this operation is likely configuration changing, restart the
103 101 # name-services milestone (such that configuration-sensitive services
104 102 # are in turn restarted).
105 103 /usr/sbin/svcadm restart milestone/name-services
106 104
107 105 echo " done."
↓ open down ↓ |
28 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX