-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall
executable file
·87 lines (72 loc) · 1.48 KB
/
install
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
#!/usr/bin/env bash
USAGE="</path/to/texmf>"
LONG_USAGE="Installs starType package to </path/to/texmf/tex/latex> and the
documentation to </path/to/texmf/doc/latex/starType/>."
LATEX=`which pdflatex`
LATEXOPS="--file-line-error"
DOCBASE='starType'
DOCSTY="$DOCBASE.sty"
DOCMAN="$DOCBASE.tex"
ROOTPATH=""
SRCDIR=""
DOCDIR=""
THISDIR=`pwd`
function show_help {
echo "usage: $(basename "$0") $USAGE"
echo
echo "$LONG_USAGE"
exit 0
}
function check_okay {
if [ $? -ne 0 ]; then
echo
echo "processing failed..."
exit 1
fi
}
function rerun_if_necessary {
grep -i --regexp="Rerun" $DOCBASE.log
if [ $? -eq 0 ]; then
echo "rerunning latex"
$LATEX $LATEXOPS $DOCBASE
check_okay
fi
}
# must have one argument: the path name to the texmf directory or a --help flag
if [ "$#" -ne 1 ]; then
show_help
fi
# process options
case "$1" in
-h|--help)
show_help
esac
ROOTDIR="$1"
SRCDIR=$ROOTDIR/tex/latex/starType
DOCDIR=$ROOTDIR/doc/latex/starType
if [ ! -d $SRCDIR ]; then
echo "making $SRCDIR"
mkdir -p $SRCDIR
check_okay
fi
echo "copying macros to $SRCDIR"
cp macros/*.tex $SRCDIR
check_okay
echo "copying $DOCSTY to $SRCDIR"
cp $DOCSTY $SRCDIR
check_okay
if [ ! -d $DOCDIR ]; then
echo "making $DOCDIR"
mkdir -p $DOCDIR
check_okay
fi
echo "copying $DOCMAN to $DOCDIR"
cp doc/$DOCMAN $DOCDIR
check_okay
cd $DOCDIR
$LATEX $LATEXOPS $DOCBASE
rerun_if_necessary
rerun_if_necessary
#cleanup
rm -f $DOCBASE.{aux,log,out}
cd $THISDIR