summaryrefslogtreecommitdiff
path: root/print/yatex/files/INSTALL.tmpl
blob: 6b343f1846df03f3ae649d82f8e399336189f3f1 (plain) (blame)
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
#!/bin/sh

pkgname=$1

BASENAME=${BASENAME:-%%BASENAME%%}
CP=${CP:-%%CP%%}
ECHO=${ECHO:-%%ECHO%%}
GREP=${GREP:-%%GREP%%}
SED=${SED:-%%SED%%}
TOUCH=${TOUCH:-%%TOUCH%%}
CUT=${CUT:-%%CUT%%}
DO_NADA=${DO_NADA:-%%DO_NADA%%}
CUT=/usr/bin/cut
EXPR=/bin/expr

infodir=${INFODIR:-%%INFODIR%%}
infofiles=${INFOFILES:-%%INFOFILES%%}
infonodes=${INFONODES:-%%INFONODES%%}
infonodeexps=${INFONODEEXPS:-%%INFONODEEXPS%%}
dirsection=${DIRSECTION:-%%DIRSECTION%%}

if [ "X$2" = X"POST-INSTALL" ]; then
    count=1
    # For example, the result of `cut ttt -d : -f 2` is ttt. Why?
    infofiles=${infofiles}:
    while ${DO_NADA}; do
	if [ X`${ECHO} ${infofiles} | ${CUT} -d : -f $count` = X ]; then
	    break
	fi
	file=`${ECHO} ${infofiles} | ${CUT} -d : -f $count`
	if [ X%%EMACS%% = Xxemacs ]; then
	    file=${file}.info
	fi
	nodename=`${ECHO} ${infonodes} | ${CUT} -d : -f $count`
	nodeexp=`${ECHO} ${infonodeexps} | ${CUT} -d : -f $count`
	if [ ! "`${GREP} \"START-INFO-DIR-ENTRY\" ${infodir}/${file}`" ]; then
	    ${ECHO} "INFO-DIR-SECTION ${dirsection}" \
					    >> ${infodir}/${file}
	    ${ECHO} "START-INFO-DIR-ENTRY"	>> ${infodir}/${file}
	    ${ECHO} "* ${nodename}: (`${BASENAME} ${file}`).		${nodeexp}" \
					    >> ${infodir}/${file}
	    ${ECHO} "END-INFO-DIR-ENTRY"	>> ${infodir}/${file}
	fi
	count=`${EXPR} $count + 1`
    done
    if [ X%%EMACS%% != Xxemacs ]; then
	${ECHO} "Adding entry for \"${pkgname}\" to ${infodir}/dir"
	for file in `${ECHO}  ${infofiles} | ${SED} "s,:, ,g"`; do
		install-info ${infodir}/${file} ${infodir}/dir
	done
    fi
    exit 0
else
    exit 0
fi