summaryrefslogtreecommitdiff
path: root/mcon/U/scriptdir.U
blob: fc1c857f7d49963a729b295667939052d4db5dad (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
?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: scriptdir.U,v $
?RCS: Revision 3.0.1.3  1995/09/25  09:17:15  ram
?RCS: patch59: unit is now forced to the top of Configure, if possible
?RCS:
?RCS: Revision 3.0.1.2  1995/01/30  14:46:13  ram
?RCS: patch49: can now handle installation prefix changes (from WED)
?RCS:
?RCS: Revision 3.0.1.1  1994/08/29  16:32:04  ram
?RCS: patch32: now uses installation prefix
?RCS:
?RCS: Revision 3.0  1993/08/18  12:09:45  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:scriptdir scriptdirexp installscript: afs cat test Getfile Loc \
	Oldconfig +bin Prefixit prefixexp Prefixup
?MAKE:	-pick add $@ %<
?Y:TOP
?S:scriptdir:
?S:	This variable holds the name of the directory in which the user wants
?S:	to put publicly scripts for the package in question.  It is either
?S:	the same directory as for binaries, or a special one that can be
?S:	mounted across different architectures, like /usr/share. Programs
?S:	must be prepared to deal with ~name expansion.
?S:.
?S:scriptdirexp:
?S:	This variable is the same as scriptdir, but is filename expanded
?S:	at configuration time, for programs not wanting to bother with it.
?S:.
?S:installscript:
?S:	This variable is usually the same as scriptdirexp, unless you are on
?S:	a system running AFS, in which case they may differ slightly. You
?S:	should always use this variable within your makefiles for portability.
?S:.
?C:SCRIPTDIR:
?C:	This symbol holds the name of the directory in which the user wants
?C:	to put publicly executable scripts for the package in question.  It
?C:	is often a directory that is mounted across diverse architectures.
?C:	Programs must be prepared to deal with ~name expansion.
?C:.
?C:SCRIPTDIR_EXP:
?C:	This is the same as SCRIPTDIR, but is filename expanded at
?C:	configuration time, for use in programs not prepared to do
?C:	~name substitutions at run-time.
?C:.
?H:#define SCRIPTDIR "$scriptdir"	/**/
?H:#define SCRIPTDIR_EXP "$scriptdirexp"	/**/
?H:.
: determine where public executable scripts go
set scriptdir scriptdir
eval $prefixit
case "$scriptdir" in
'')
	dflt="$bin"
	: guess some guesses
	$test -d /usr/share/scripts && dflt=/usr/share/scripts
	$test -d /usr/share/bin && dflt=/usr/share/bin
	$test -d /usr/local/script && dflt=/usr/local/script
	$test -d $prefixexp/script && dflt=$prefixexp/script
	set dflt
	eval $prefixup
	;;
*)  dflt="$scriptdir"
	;;
esac
$cat <<EOM
 
Some installations have a separate directory just for executable scripts so
that they can mount it across multiple architectures but keep the scripts in
one spot.  You might, for example, have a subdirectory of /usr/share for this.
Or you might just lump your scripts in with all your other executables.
 
EOM
fn=d~
rp='Where do you keep publicly executable scripts?'
. ./getfile
if $test "X$ansexp" != "X$scriptdirexp"; then
	installscript=''
fi
scriptdir="$ans"
scriptdirexp="$ansexp"
if $afs; then
	$cat <<EOM

Since you are running AFS, I need to distinguish the directory in which
scripts reside from the directory in which they are installed (and from
which they are presumably copied to the former directory by occult means).

EOM
	case "$installscript" in
	'') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
	*) dflt="$installscript";;
	esac
	fn=de~
	rp='Where will public scripts be installed?'
	. ./getfile
	installscript="$ans"
else
	installscript="$scriptdirexp"
fi