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