This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[UTIL] Perl system does not default to $_
[metaconfig.git] / dist / U / nis.U
1 ?RCS: $Id$
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
4 ?RCS: 
5 ?RCS: You may redistribute only under the terms of the Artistic License,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic License; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 4.0.
10 ?RCS:
11 ?RCS: $Log: nis.U,v $
12 ?RCS: Revision 3.0.1.3  1997/02/28  16:17:38  ram
13 ?RCS: patch61: ensure suitable defaults for hostcat and friends
14 ?RCS:
15 ?RCS: Revision 3.0.1.2  1995/03/21  08:48:34  ram
16 ?RCS: patch52: continued fix for NeXT NIS/NetInfo handling
17 ?RCS:
18 ?RCS: Revision 3.0.1.1  1995/02/15  14:16:23  ram
19 ?RCS: patch51: now correctly handles NeXT using NIS rather than NetInfo
20 ?RCS:
21 ?RCS: Revision 3.0  1993/08/18  12:09:24  ram
22 ?RCS: Baseline for dist 3.0 netwide release.
23 ?RCS:
24 ?MAKE:passcat groupcat hostcat: Myread Oldconfig test contains
25 ?MAKE:  -pick add $@ %<
26 ?S:passcat:
27 ?S:     This variable contains a command that produces the text of the
28 ?S:     /etc/passwd file.  This is normally "cat /etc/passwd", but can be
29 ?S:     "ypcat passwd" when NIS is used.
30 ?S:.
31 ?S:groupcat:
32 ?S:     This variable contains a command that produces the text of the
33 ?S:     /etc/group file.  This is normally "cat /etc/group", but can be
34 ?S:     "ypcat group" when NIS is used.
35 ?S:.
36 ?S:hostcat:
37 ?S:     This variable contains a command that produces the text of the
38 ?S:     /etc/hosts file.  This is normally "cat /etc/hosts", but can be
39 ?S:     "ypcat hosts" when NIS is used.
40 ?S:.
41 : see if we have to deal with yellow pages, now NIS.
42 ?X: NeXT gives us some fun here, as always, by having both NIS (former YP)
43 ?X: and NetInfo. But since it has both, it's ok to put the test inside the if.
44 ?X: Contributed by Thomas Neumann <tom@smart.bo.open.de>.
45 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
46         if $test -f /usr/etc/nibindd; then
47                 echo " "
48                 echo "I'm fairly confident you're on a NeXT."
49 @if passcat || groupcat
50                 echo " "
51                 rp='Do you get the passwd file via NetInfo?'
52                 dflt=y
53                 case "$passcat" in
54                 nidump*) ;;
55                 '') ;;
56                 *) dflt=n;;
57                 esac
58                 . ./myread
59                 case "$ans" in
60                 y*) passcat='nidump passwd .'
61 @if groupcat
62                         echo "(Assuming /etc/group is also distributed.)"
63                         groupcat='nidump group .'
64 @end
65                         ;;
66                 *)      echo "You told me, so don't blame me."
67                         case "$passcat" in
68                         nidump*) passcat=''
69 @if groupcat
70                                  groupcat='';;
71 @end
72                         esac
73 @if groupcat
74                         echo "(Assuming /etc/group is handled the same way.)"
75 @end
76                         ;;
77                 esac
78 @end
79 @if hostcat
80                 echo " "
81                 rp='Do you get the hosts file via NetInfo?'
82                 dflt=y
83                 case "$hostcat" in
84                 nidump*) ;;
85                 '') ;;
86                 *) dflt=n;;
87                 esac
88                 . ./myread
89                 case "$ans" in
90                 y*) hostcat='nidump hosts .';;
91                 *)      case "$hostcat" in
92                         nidump*) hostcat='';;
93                         esac
94                         ;;
95                 esac
96 @end
97         fi
98 @if passcat || groupcat
99         case "$passcat" in
100         nidump*) ;;
101         *)
102                 case "$passcat" in
103                 *ypcat*) dflt=y;;
104                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
105                                 dflt=y
106                         else
107                                 dflt=n
108                         fi;;
109                 *) dflt=n;;
110                 esac
111                 echo " "
112                 rp='Are you getting the passwd file via yellow pages?'
113                 . ./myread
114                 case "$ans" in
115                 y*) passcat='ypcat passwd'
116 @if groupcat
117                         echo "(Assuming /etc/group is also distributed.)"
118                         groupcat='ypcat group'
119 @end
120                         ;;
121                 *)      passcat='cat /etc/passwd'
122 @if groupcat
123                         echo "(Assuming /etc/group is also local.)"
124                         groupcat='cat /etc/group'
125 @end
126                         ;;
127                 esac
128                 ;;
129         esac
130 @end
131 @if hostcat
132         case "$hostcat" in
133         nidump*) ;;
134         *)
135                 case "$hostcat" in
136                 *ypcat*) dflt=y;;
137                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
138                                 dflt=y
139                         else
140                                 dflt=n
141                         fi;;
142                 *) dflt=n;;
143                 esac
144                 echo " "
145                 rp='Are you getting the hosts file via yellow pages?'
146                 . ./myread
147                 case "$ans" in
148                 y*) hostcat='ypcat hosts';;
149                 *) hostcat='cat /etc/hosts';;
150                 esac
151                 ;;
152         esac
153 @end
154 fi
155 ?X: Ensure suitable default -- Manoj Srivastava
156 case "$hostcat" in
157 '') hostcat=':'
158         $test -f /etc/hosts && hostcat='cat /etc/hosts';;
159 esac
160 case "$groupcat" in
161 '')     groupcat=':'
162         $test -f /etc/group && groupcat='cat /etc/group';;
163 esac
164 case "$passcat" in
165 '') passcat=':'
166         $test -f /etc/passwd && passcat='cat /etc/passwd';;
167 esac
168