summaryrefslogtreecommitdiff
path: root/U/mboxlock.U
blob: 447aae1c44cd782a117490f2d24baa5dd6437315 (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
?RCS: $Id$
?RCS:
?RCS:  Copyright (c) 1991, Syd Weinstein
?RCS:  Copyright (c) 1991, Raphael Manfredi
?RCS:
?RCS:  You may redistribute only under the terms of the GNU General Public
?RCS:  Licence as specified in the README file that comes with dist.
?RCS:
?RCS: $Log
?MAKE:d_lockflock d_flockonly lock_by_flock flock_only: cat contains d_flock Myread +usrinc Setvar Oldconfig package
?MAKE:	-pick add $@ %<
?S:d_lockflock:
?S:	This variable conditionally defines the LOCK_BY_FLOCK symbol, which
?S:	indicates that the mailbox should be locked by flock.
?S:.
?S:d_flockonly:
?S:	This variable conditionally defines the FLOCK_ONLY symbol, which indicates
?S:	that the mailbox should be locked only by flock. Be sure this will not
?S:	introduce any conflict with other mail-related programs.
?S:.
?S:lock_by_flock:
?S:	This variable holds 'true' if the mailbox should be locked by flock.
?S:.
?S:flock_only:
?S:	This variable holds 'true' when the mailbox is to be locked by flock only.
?S:.
?C:LOCK_BY_FLOCK:
?C:	This symbol, if defined, indicates that the flock mailbox locking should
?C:	be used.
?C:.
?C:FLOCK_ONLY:
?C:	This symbol, if defined, indicates that only flock mailbox locking should
?C:	be used. Be sure that this will never conflict with other utilities.
?C:.
?H:#$d_lockflock	LOCK_BY_FLOCK		/**/
?H:#$d_flockonly	FLOCK_ONLY		/**/
?H:.
?LINT:set d_lockflock d_flockonly
: see which mailbox locking should be used
echo " "
lock_by_flock=''
flock_only=''
case "$d_flock" in
"$define")
	if $contains EWOULDBLOCK $usrinc/errno.h > /dev/null 2>&1; then
		echo 'EWOULDBLOCK found, will use flock type mailbox locking.'
		val="$define"
	elif $contains EWOULDBLOCK $usrinc/sys/errno.h > /dev/null 2>&1; then
		echo 'EWOULDBLOCK found, will use flock type mailbox locking.'
		val="$define"
	else
		echo 'Will use .lock type mailbox locking.'
		val="$undef"
	fi
	;;
*)
	echo 'Will use .lock type mailbox locking.'
	val="$undef"
	;;
esac
set d_lockflock; eval $setvar

case "$d_lockflock" in
"$define")
	lock_by_flock='true'
	case "$d_flockonly" in
	"$define") dflt=y;;
	*) dflt=n;;
	esac
	$cat <<EOM
 
Some sites wish to use flock style locking only. This allows $package to be
installed without the setgid bit being set on some systems that would otherwise
require it.

Note: Be sure no other mail utility that needs to lock the mail spool file
uses .lock type locking before using only flock style locking.

EOM
	rp="Would you like to use flock style mail spool locking only?"
	. ./myread
	case "$ans" in
	y*|Y*) val="$define";;
	*) val="$undef";;
	esac
	;;
*) val="$undef";;
esac
set d_flockonly; eval $setvar

case "$d_flockonly" in
"$define") flock_only='true';;
esac