-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patharchive
executable file
·67 lines (55 loc) · 1.2 KB
/
archive
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
#!/bin/bash
DOC="withargs"
FILES="$DOC.sty \
$DOC.tex \
$DOC.pdf \
$DOC-dry.sty \
$DOC-packagedoc.cls \
README"
VERSION=0.3.1
### Zero out the checksum value
#
sed -r -i.bak 's/\\CheckSum\{[0-9]*\}/\\CheckSum\{0\}/;' ${DOC}.sty
### First compilation
#
pdflatex ${DOC}
### Find and put in the correct checksum
#
CHECKSUM=`cat ${DOC}.log | grep "The checksum should be" \
| sed -r 's/[^0-9]*([0-9]*)[^0-9]*/\1/'`
sed -r -i "s/\\CheckSum\{0\}/\\CheckSum\{$CHECKSUM\}/;" ${DOC}.sty
### Create index
#
makeindex -s gglo.ist -o ${DOC}.gls ${DOC}.glo
makeindex -s gind.ist -o ${DOC}.ind ${DOC}.idx
### Final two compilations
#
pdflatex ${DOC}
pdflatex ${DOC}
### Reuse the README.md file for the archived plain-text README
#
cp ./README.md ./README
### Move all temporary stuff to the tmp folder
#
mkdir -p tmp
mv *.aux tmp
mv *.glo tmp
mv *.gls tmp
mv *.idx tmp
mv *.ilg tmp
mv *.ind tmp
mv *.log tmp
mv *.out tmp
mv *.tmp tmp
mv *.hd tmp
mv *.bak tmp
### Tar it up
#
mkdir ${DOC}
cp ${FILES} ${DOC}
rm README
tar -czf ${DOC}-${VERSION}.tar.gz ${DOC}
rm -rf ${DOC}
### Rename local pdf
#
mv ${DOC}.pdf ${DOC}-${VERSION}.pdf