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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
#!/bin/bash
NAME=ctable
LOCAL=`kpsewhich --expand-var '$TEXMFLOCAL'`/tex/latex/$NAME
# 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 {
echo -e "$*"
exit 1
}
function help {
cat <<-EOD
Usage: inst [option]
Options:
-h, --help Print this help
-c, --clean Clean up, but keep $NAME.{sty,pdf}
-C, --Clean Clean up all files that can be regenerated
-z, --zip Create zip for CTAN (developer only)
EOD
exit
}
function clean {
rm -f {$NAME,doc/*}.{aux,idx,ilg,chk,fls,ind,log,glo,gls,out,tex}
rm -f doc/*.pdf
}
function Clean {
clean
rm -f {$NAME,doc/*}.{sty,cls,pdf}
}
function 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
}
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
# is README updated?
grep "v$version relative to" README >/dev/null || die README not updated - quitting...
# 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
cd ..
zip=$NAME-$version.zip
zip -Dqr $NAME/$zip ${files[@]}
echo " created: $zip"
}
if ! options=$(getopt -o hcCz \
-l help,clean,Clean,zip -- "$@"); then exit 1; fi
eval set -- "$options"
while [ $# -gt 0 ]; do
case $1 in
-c|--clean) clean; exit;;
-C|--Clean) Clean; exit;;
-z|--zip) makeall; mkzip; exit;;
-h|--help) help;;
(--) shift; break;;
(*) break;;
esac
shift
done
makeall
# $Id: inst,v 1.31 2013/04/28 12:25:00 wybo Exp $
|