| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# splitindex installation script |
| 4 |
# Copyright (c) Markus Kohm 2013 |
| 5 |
# |
| 6 |
# $Id: install.sh,v 1.10 2013-04-04 13:12:18 mjk Exp $ |
| 7 |
# |
| 8 |
# This file is part of the SplitIndex bundle. |
| 9 |
# |
| 10 |
# This work may be distributed and/or modified under the conditions of |
| 11 |
# the LaTeX Project Public License, version 1.3c of the license. |
| 12 |
# The latest version of this license is in |
| 13 |
# http://www.latex-project.org/lppl.txt |
| 14 |
# and version 1.3c or later is part of all distributions of LaTeX |
| 15 |
# version 2005/12/01 or later and of this work. |
| 16 |
# |
| 17 |
# This work has the LPPL maintenance status "maintained". |
| 18 |
# |
| 19 |
# The Current Maintainer and author of this work is Markus Kohm. |
| 20 |
# |
| 21 |
# The list of all files belongig to the SplitIndex bundle is given in |
| 22 |
# in the file `manifest.txt'. Files generated by means of unpacking the |
| 23 |
# distribution (using, for example, the docstrip program) or by means |
| 24 |
# of compiling them from a source file, for example, from splitindex.c |
| 25 |
# or splitindex.java may be distributed at the distributor's discretion. |
| 26 |
# However if they are distributed then a copy of the SplitIndex bundle |
| 27 |
# must be distributed together with them. |
| 28 |
# |
| 29 |
# The list of derived (unpacked or compiled) files belongig to the |
| 30 |
# distribution and covered by LPPL is defined by the unpacking scripts |
| 31 |
# (with extension .ins) and the installation script (with name |
| 32 |
# install.sh) which are part of the distribution. |
| 33 |
# |
| 34 |
# Two often ignorred clauses from LPPL 1.3c you should not ignore: |
| 35 |
# ---------------------------------------------------------------- |
| 36 |
# 2. You may distribute a complete, unmodified copy of the Work as you |
| 37 |
# received it. Distribution of only part of the Work is considered |
| 38 |
# modification of the Work, and no right to distribute such a Derived |
| 39 |
# Work may be assumed under the terms of this clause. |
| 40 |
# 3. You may distribute a Compiled Work that has been generated from a |
| 41 |
# complete, unmodified copy of the Work as distributed under Clause 2 |
| 42 |
# above, as long as that Compiled Work is distributed in such a way that |
| 43 |
# the recipients may install the Compiled Work on their system exactly |
| 44 |
# as it would have been installed if they generated a Compiled Work |
| 45 |
# directly from the Work. |
| 46 |
|
| 47 |
if [ -z "$DESTDIR" ] |
| 48 |
then |
| 49 |
TEXMFINSTALL=`kpsewhich -var-value=TEXMFLOCAL` |
| 50 |
if ! mkdir -p $TEXMFINSTALL/tex/latex/splitidx |
| 51 |
then |
| 52 |
TEXMFINSTALL=`kpsewhich -var-value=TEXMFHOME` |
| 53 |
fi |
| 54 |
else |
| 55 |
[ -z "$TEXMFINSTALL" ] && TEXMFINSTALL="/texmf" |
| 56 |
[ -z "$BINDIR" ] && BINDIR="/bin" |
| 57 |
fi |
| 58 |
|
| 59 |
if [ "$1" == "-h" -o "$1" == "--help" ] |
| 60 |
then |
| 61 |
cat <<EOF |
| 62 |
install.sh |
| 63 |
Copyright (c) Markus Kohm 2013 |
| 64 |
|
| 65 |
This bash script installs splitidx and splitindex. |
| 66 |
The files will be installed into TEXMF tree |
| 67 |
$DESTDIR$TEXMFINSTALL/. |
| 68 |
EOF |
| 69 |
echo -n 'Binaries will be installed to ' |
| 70 |
if [ -z "$BINDIR" ] |
| 71 |
then |
| 72 |
find `kpsewhich -var-value=SELFAUTODIR` -mindepth 1 -type d -print |
| 73 |
else |
| 74 |
echo "$DESTDIR$BINDIR/" |
| 75 |
fi |
| 76 |
cat <<EOF |
| 77 |
You may change installation paths by setting environment variables DESTDIR, |
| 78 |
TEXMFINSTALL and BINDIR. |
| 79 |
EOF |
| 80 |
exit 0 |
| 81 |
fi |
| 82 |
|
| 83 |
perlavailable=false |
| 84 |
if type perl |
| 85 |
then |
| 86 |
perlavailable=true |
| 87 |
fi |
| 88 |
|
| 89 |
set -e |
| 90 |
|
| 91 |
sourcedir=`find ./ -name splitidx.dtx` |
| 92 |
sourcedir=${sourcedir%/*}/ |
| 93 |
|
| 94 |
pushd $sourcedir |
| 95 |
|
| 96 |
tex splitidx.ins |
| 97 |
|
| 98 |
pdflatex -draftmode -interaction=batchmode splitidx.dtx |
| 99 |
pdflatex -draftmode -interaction=batchmode splitidx.dtx |
| 100 |
mkindex splitidx.dtx |
| 101 |
pdflatex -interaction=batchmode splitidx.dtx |
| 102 |
|
| 103 |
mkdir -p "$DESTDIR$TEXMFINSTALL/tex/latex/splitidx" |
| 104 |
mkdir -p "$DESTDIR$TEXMFINSTALL/tex/generic/splitindex" |
| 105 |
mkdir -p "$DESTDIR$TEXMFINSTALL/scripts/splitindex" |
| 106 |
mkdir -p "$DESTDIR$TEXMFINSTALL/doc/latex/splitidx" |
| 107 |
mkdir -p "$DESTDIR$TEXMFINSTALL/doc/man/man1" |
| 108 |
mkdir -p "$DESTDIR$TEXMFINSTALL/source/latex/splitindex" |
| 109 |
|
| 110 |
install -v -m 644 splitidx.sty "$DESTDIR$TEXMFINSTALL/tex/latex/splitidx/" |
| 111 |
install -v -m 644 splitindex.tex "$DESTDIR$TEXMFINSTALL/tex/generic/splitindex/" |
| 112 |
install -v -m 755 splitindex.pl splitindex.tlu splitindex_main.tlu \ |
| 113 |
"$DESTDIR$TEXMFINSTALL/scripts/splitindex" |
| 114 |
install -v -m 644 README splitidx.pdf \ |
| 115 |
"$DESTDIR$TEXMFINSTALL/source/latex/splitindex/" |
| 116 |
install -v -m 644 splitindex.1 "$DESTDIR$TEXMFINSTALL/doc/man/man1/" |
| 117 |
|
| 118 |
install -v -m 644 README install.txt manifest.txt \ |
| 119 |
splitidx.dtx splitidx.ins \ |
| 120 |
splitindex.1 splitindex.c splitindex.java splitindex.pl splitindex.tex \ |
| 121 |
splitindex.tlu splitindex_main.tlu \ |
| 122 |
"$DESTDIR$TEXMFINSTALL/source/latex/splitindex/" |
| 123 |
|
| 124 |
if $perlavailable |
| 125 |
then |
| 126 |
cp splitindex.pl splitindex |
| 127 |
else |
| 128 |
cp splitindex.tlu splitindex |
| 129 |
fi |
| 130 |
|
| 131 |
if [ -z "$BINDIR" ] |
| 132 |
then |
| 133 |
find `kpsewhich -var-value=SELFAUTODIR` -mindepth 1 -type d -print0 | \ |
| 134 |
xargs -0 install -v -m 755 splitindex |
| 135 |
else |
| 136 |
install -v -m 755 splitindex "$DESTDIR$BINDIR/" |
| 137 |
fi |
| 138 |
|
| 139 |
rm splitindex |
| 140 |
|
| 141 |
popd |