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/inst177
1 files changed, 91 insertions, 86 deletions
diff --git a/Master/texmf-dist/doc/latex/ctable/inst b/Master/texmf-dist/doc/latex/ctable/inst
index 968e73b1827..6db01fd85bd 100755
--- a/Master/texmf-dist/doc/latex/ctable/inst
+++ b/Master/texmf-dist/doc/latex/ctable/inst
@@ -1,89 +1,102 @@
#!/bin/bash
+ dtxname=ctable
+ dtxtype=package
+ ext=sty
+ delete=($dtxname.$ext README.tex doc/\*.tex)
+ dtxversion=$(grep " v[0-9.]\+[a-z]\{0,1\} $dtxname $dtxtype" $dtxname.dtx |sed 's/.* v\([0-9.]\+[a-z]\{,1\}\) .*/\1/')
+executables=(mk texlog_extract zip getopt pdfseparate pdfcrop pdflatex)
- 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)
+ version=1.00
+ myname=$(basename $0)
-die() {
- echo -e "$*"
- exit 1
-}
+<<'DOC'
+= inst - install ctable
-help() {
- cat <<-EOD
- This is inst - install the $NAME LaTeX $DOCTYPE
- Options:
- -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
-}
+= Synopsis
+inst [options]
+
+Without any options, inst installs ctable in the first writable
+TEXMFMAIN, TEXMFLOCAL or TEXMFHOME tree.
+
+Options:
+-h,--help print this help and exit
+-H,--Help print full documentation via less and exit
+-V,--version print version and exit
+
+
+= Description
+inst must be run in its own directory (|./inst|) and then does the following:
+- generates the documentation for isodoc,
+- installs ctable in one of your TeX trees: TEXMFMAIN, TEXMFLOCAL or TEXMFHOME.
+ The first one writable by you will chosen.
+- creates a zip file named |ctable-x.yy.zip| for upload to CTAN
+- cleans up
+
+= Author and copyright
+Author Wybo Dekker
+Email U{wybo@dekkerdocumenten.nl}{wybo@dekkerdocumenten.nl}
+License Released under the U{www.gnu.org/copyleft/gpl.html}{GNU General Public License}
+DOC
+
+ die() { echo -e "$myname: $Err$@$Nor" 1>&2; exit 1; }
+ help() { sed -n '/^= Synopsis/,/^= /p' $0|sed '1s/.*/Usage:/;/^= /d'; exit; }
+helpall() { sed -n '/^<<.DOC.$/,/^DOC$/p' $0|sed -n '1d;$d;p'|less; exit; }
+version() { echo $version; exit; }
+
+Nor='\e[0m' # reset color ]
+Err='\e[31;1m' # light red ]
setdir() { # create installation directory
for i in MAIN LOCAL HOME; do
- TREE=$(kpsewhich --expand-var \$TEXMF$i)
- test -w $TREE && break
- TREE=
+ 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
+ [[ -n $tree ]] || die "Could not find a writable TeX tree"
+ insttex=${tree}/tex/latex/$dtxname
+ instsrc=$tree/source/latex/$dtxname
+ instdoc=$tree/doc/latex/$dtxname
+ 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
+ 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 |
+ /\\changes{v'$dtxversion'}/,/^% }/p' $dtxname.dtx |
sed 's/^%//;s/\\\\$//
/<.readme>/d
/^ }/d
- s/ \\changes.*/Changes in version '$VERSION':/
+ s/ \\changes.*/Changes in version '$dtxversion':/
s/$\\Rightarrow\$/=>/g
s/\\textbackslash/\\/g
s/\\text\(sl\|it\){\([^}]\+\)}/\/\2\//g # \textsl{...} -> /.../
s/{\([^}]*\)}/\1/g # keep last, removes all {...}
' >README
-}
-
-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.pdf README
+ grep "Changes in version" README >/dev/null || die changes not detected
}
makeall() {
- echo y |tex $NAME.ins >/dev/null
+ grep '%<\*install>' $dtxname.dtx >/dev/null && # for self-extracting dtx files
+ delete+=($dtxname.ins) ||
+ echo y |tex $dtxname.ins >/dev/null
+
# install any .ttf files
mkdir -p ~/.fonts
find doc -name '*.ttf' -exec cp {} ~/.fonts \;
fc-cache ~/.fonts
- # create the README file
- readme
+ readme # create the README file
# compile all examples
cd doc
- ln -sf ../$NAME.sty || exit 1 # use the version to be installed
+ ln -sf ../$dtxname.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
@@ -91,55 +104,47 @@ makeall() {
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
+
+ mk --noprint --noview $dtxname.dtx && mk -c $dtxname.dtx # make $dtxname.pdf
}
installall() {
# install and cleanup
- echo installing in $TREE
-
- 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
-}
-
-mkzip() {
- clean
+ echo installing in $tree
+
+ rm -rf $insttex/* $instsrc/* $instdoc/*
+ find doc \( -type l -o -name '*.pdf' \) -delete
+ cp -f $dtxname.$ext $insttex
+ cp -a $dtxname.{ins,dtx} $instsrc
+ cp -a README inst $dtxname.pdf $instdoc
+ mktexlsr $tree 2>/dev/null
+ for i in ${delete[@]}; do rm -f $i; done
cd ..
- zipfile=$NAME/$NAME-$VERSION.zip
+ zipfile=$dtxname/$dtxname-$dtxversion.zip
rm -f $zipfile
- zip -Drq $zipfile $NAME/* -x $NAME/test/*
- cd $NAME
- Clean
+ zip -rq $zipfile $dtxname/* -x $dtxname/test\*
+ cd $dtxname
}
-testexecs
-setdir
-
-if ! options=$(getopt -o hcz \
- -l help,clean,zip -- "$@"); then exit 1; fi
+options=$(getopt \
+ -n $myname \
+ -o hHV \
+ -l help,Help,version \
+ -- "$@"
+) || exit 1
eval set -- "$options"
-
while [ $# -gt 0 ]; do
case $1 in
- -c|--clean) Clean; exit;;
- -z|--zip) makeall; mkzip; exit;;
- -h|--help) help;;
- (--) shift; break;;
- (*) break;;
+ (-h|--help) help;;
+ (-H|--Help) helpall;;
+ (-V|--version) version;;
+ (--) shift; break;;
+ (*) break;;
esac
- shift
done
-test "$1" = "" || die No arguments expected
+[[ -z $1 ]] || die No arguments expected
+testexecs
+setdir
makeall
installall