summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/ctable/inst
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/ctable/inst')
-rwxr-xr-xMaster/texmf-dist/doc/latex/ctable/inst222
1 files changed, 105 insertions, 117 deletions
diff --git a/Master/texmf-dist/doc/latex/ctable/inst b/Master/texmf-dist/doc/latex/ctable/inst
index afdd96cd19b..968e73b1827 100755
--- a/Master/texmf-dist/doc/latex/ctable/inst
+++ b/Master/texmf-dist/doc/latex/ctable/inst
@@ -1,148 +1,137 @@
#!/bin/bash
-NAME=ctable
-LOCAL=`kpsewhich --expand-var '$TEXMFLOCAL'`/tex/latex/$NAME
+ NAME=ctable
+ DOCTYPE=package
+ EXT=sty
+ VERSION=`grep " v[0-9.]\+[a-z]\{,1\} $NAME $DOCTYPE" $NAME.dtx |sed 's/.* v\([0-9.]\+[a-z]\{,1\}\) .*/\1/' `
+EXECUTABLES=(zip getopt)
-# this script generates NAME's documentation into NAME.pdf
-# and then installs (unless the environment variable NOINSTALL is not empty)
-# NAME in TEXMFLOCAL
-# This is not a make-like process. If you changed any files, then first run
-# inst with the --Clean option, then run inst without options.
-
-function die {
+die() {
echo -e "$*"
exit 1
}
-function help {
+help() {
cat <<-EOD
- Usage: inst [option]
+ This is inst - install the $NAME LaTeX $DOCTYPE
Options:
- -h, --help Print this help
- -c, --clean Clean up, but keep $NAME.{sty,pdf} and README
- -C, --Clean Clean up all files that can be regenerated
- -z, --zip Create zip for CTAN (developer only)
+ -h, --help print this help
+ -c, --clean remove all files created by the installation, except the zip file
+ -z, --zip Create zip for CTAN (no install, developer only)
+
+ Without any options, inst installs $NAME in the first writable
+ TEXMFMAIN, TEXMFLOCAL or TEXMFHOME tree.
EOD
exit
}
-function clean {
- rm -f {$NAME,doc/*}.{aux,idx,ilg,chk,fls,ind,log,glo,gls,out,tex}
- rm -f doc/*.pdf
+setdir() { # create installation directory
+ for i in MAIN LOCAL HOME; do
+ TREE=$(kpsewhich --expand-var \$TEXMF$i)
+ test -w $TREE && break
+ TREE=
+ done
+ test "$TREE" = "" && die "Could not find a writable TeX tree"
+ INSTTEX=${TREE}/tex/latex/$NAME
+ INSTSRC=$TREE/source/latex/$NAME
+ INSTDOC=$TREE/doc/latex/$NAME
+ mkdir -p $INSTTEX || die could not create $INSTTEX
+ mkdir -p $INSTSRC || die could not create $INSTSRC
+ mkdir -p $INSTDOC || die could not create $INSTDOC
+}
+
+testexecs() { # test presence of executables
+ for i in ${EXECUTABLES[*]}; do
+ type $i &> /dev/null || die executable $i not found
+ done
+}
+
+readme() { # generate the README file
+sed -n '/^%<\*readme>/,/^%<\/readme>/p
+ /\\changes{v'$VERSION'}/,/^% }/p' $NAME.dtx |
+sed 's/^%//;s/\\\\$//
+ /<.readme>/d
+ /^ }/d
+ s/ \\changes.*/Changes in version '$VERSION':/
+ s/$\\Rightarrow\$/=>/g
+ s/\\textbackslash/\\/g
+ s/\\text\(sl\|it\){\([^}]\+\)}/\/\2\//g # \textsl{...} -> /.../
+ s/{\([^}]*\)}/\1/g # keep last, removes all {...}
+ ' >README
}
-function Clean {
+
+clean() { # clean but keep what goes in the zip
+ rm -f $NAME.{aux,fls,glo,gls,idx,ilg,ind,log,out,toc,$EXT}
+ rm -f doc/{$NAME.$EXT,*.{pdf,aux,log,out}}
+ rm -f doc/{s,}[0-9][0-9][a-z].*
+}
+
+Clean() {
clean
- rm -f {$NAME,doc/*}.{sty,cls,pdf} README
+ rm -f $NAME.pdf README
}
-function makeall {
+makeall() {
echo y |tex $NAME.ins >/dev/null
- ( # recompile example graphics if any is missing:
- cd doc
- ln -sf ../$NAME.sty || exit 1 # use the $NAME.sty version to be installed
- for i in [0-9][0-9]?; do
- if [ ! -f $i.pdf -o ! -f s$i.pdf ]; then
- echo Creating example graphics
- ./doit || exit 1
- ./doit -c
- break
- fi
- done
- rm $NAME.sty
- cd ..
-
- echo Creating documentation
- pdflatex --recorder --interaction=batchmode $NAME.dtx || die "`texlog_extract $NAME.log`"
- if [ -f $NAME.glo ]; then
- makeindex -q -s gglo.ist -o $NAME.gls $NAME.glo || echo makeindex-error
- fi
- if [ -f $NAME.idx ]; then
- makeindex -q -s gind.ist -o $NAME.ind $NAME.idx || exit 1
- fi
- pdflatex --recorder --interaction=nonstopmode $NAME.dtx > /dev/null || exit 1
-
- # set environment variable NOINSTALL to skip installation in your textree
- if [ "$NOINSTALL" = "" ]; then
- echo Installing $NAME.{dtx,sty,pdf}
- rm -rf $LOCAL
- mkdir -p $LOCAL
- cp $NAME.{dtx,sty,pdf} $LOCAL || exit 1
- fi
- sudo -i mktexlsr $LOCAL
- exit 0
- )
- if [ $? != 0 ]; then
- echo errors detected, see $NAME.log
- else
- echo $NAME successfully installed
- fi
- texlog_extract $NAME
+ # install any .ttf files
+ mkdir -p ~/.fonts
+ find doc -name '*.ttf' -exec cp {} ~/.fonts \;
+ fc-cache ~/.fonts
+
+ # create the README file
readme
-}
-function readme { # generate the README file
- sed -n "/^%<\*readme>/,/^%<\/readme>/p;/\\\\changes{v$version}/,/^% }/p" $NAME.dtx |
- sed "s/^%//;s/\\\\\\\\$//;/<.readme>/d;/^ }/d;s/ \\\\changes.*/Changes in version $version:/" >README
+ # compile all examples
+ cd doc
+ ln -sf ../$NAME.sty || exit 1 # use the version to be installed
+ for i in [0-9][0-9]?; do
+ if [ ! -f $i.pdf -o ! -f s$i.pdf ]; then
+ ./doit || exit 1
+ break
+ fi
+ done
+ cd ..
+ # make $NAME.pdf
+ pdflatex --recorder --interaction=batchmode $NAME.dtx >/dev/null ||
+ die "`texlog_extract $NAME.log`"
+ test -f $NAME.glo && makeindex -q -s gglo.ist -o $NAME.gls $NAME.glo
+ test -f $NAME.idx && makeindex -q -s gind.ist -o $NAME.ind $NAME.idx
+ pdflatex --interaction=batchmode $NAME.dtx > /dev/null
+ pdflatex --interaction=batchmode $NAME.dtx > /dev/null
}
+installall() {
+ # install and cleanup
+ echo installing in $TREE
-function mkzip {
- # is cvs up to date?
- cvs -Q status 2>&1 |grep Status:|grep -v Up-to-date
- if [ $? -eq 0 ]; then
- echo -n 'Still go on (y/N) '
- read yn
- if [[ ! $yn =~ ^[yY] ]]; then echo Quitting...; exit 1; fi
- fi
-
- # create sty and pdf if need so:
- NOINSTALL=true ./inst || echo die Problems creating sty and pdf files
-
- files=( $NAME/{README,inst} $NAME/$NAME.{dtx,ins,sty,pdf} $NAME/doc/{[0-9][0-9][a-z],doit,lion.png,penguin.jpg})
- cd ..
- for i in ${files[@]}; do
- test -e $i || die File $i does not exist
- done
- cd ctable
-
- # check for equal dates and warn if different:
- dateexp='[0-9][0-9][0-9][0-9]\/[0-9][0-9]\/[0-9][0-9]'
- versexp='[0-9]\+\.[0-9]\+[a-z]*'
- read packdate version cvsdate <<<`sed -n "
- s/.Id: .*\($dateexp\).*/\1/p
- s/.*\($dateexp\) v\($versexp\).*/\1 \2/p
- " $NAME.dtx`
- cat <<-EOD
- packagedate: $packdate
- version: $version
- cvs-date: $cvsdate
- EOD
+ rm -rf $INSTTEX/* $INSTSRC/* $INSTDOC/*
+ cp -f $NAME.$EXT $INSTTEX
+ cp -a $NAME.{ins,dtx} $INSTSRC
+ cp -a README inst $NAME.pdf $INSTDOC
+ mktexlsr $TREE 2>/dev/null
+ clean
+}
- # normally packdate and cvsdate are equal, because I make the zip right after updating CVS:
- if [ $packdate != $cvsdate ]; then
- echo package and cvs dates differ
- echo -n 'Still go on (y/N) '
- read yn
- if [[ ! $yn =~ ^[yY] ]]; then echo Quitting...; exit 1; fi
- fi
-
- # make the zip
+mkzip() {
+ clean
cd ..
- zip=$NAME-$version.zip
- zip -Dqr $NAME/$zip ${files[@]}
- echo " created: $zip"
-
+ zipfile=$NAME/$NAME-$VERSION.zip
+ rm -f $zipfile
+ zip -Drq $zipfile $NAME/* -x $NAME/test/*
+ cd $NAME
+ Clean
}
-version=`grep " v[0-9.]\+ $NAME package" $NAME.dtx |sed 's/.* v\([0-9.]\+\) .*/\1/' `
-if ! options=$(getopt -o hcCz \
- -l help,clean,Clean,zip -- "$@"); then exit 1; fi
+testexecs
+setdir
+
+if ! options=$(getopt -o hcz \
+ -l help,clean,zip -- "$@"); then exit 1; fi
eval set -- "$options"
while [ $# -gt 0 ]; do
case $1 in
- -c|--clean) clean; exit;;
- -C|--Clean) Clean; exit;;
+ -c|--clean) Clean; exit;;
-z|--zip) makeall; mkzip; exit;;
-h|--help) help;;
(--) shift; break;;
@@ -150,8 +139,7 @@ while [ $# -gt 0 ]; do
esac
shift
done
+test "$1" = "" || die No arguments expected
makeall
-
-# $Id: inst,v 1.33 2013/06/14 21:12:34 wybo Exp $
-
+installall