-
Notifications
You must be signed in to change notification settings - Fork 13
/
create_archive.sh
executable file
·59 lines (50 loc) · 1.95 KB
/
create_archive.sh
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
#!/bin/sh
PROJECT=jsclasses
TMP=/tmp
PWDF=`pwd`
LATESTRELEASEDATE=`git tag | sort -r | head -n 1`
RELEASEDATE=`git tag --points-at HEAD | sort -r | head -n 1`
if [ -z "$RELEASEDATE" ]; then
RELEASEDATE="**not tagged**; later than $LATESTRELEASEDATE?"
fi
echo " * Create $PROJECT.tds.zip"
git archive --format=tar --prefix=$PROJECT/ HEAD | (cd $TMP && tar xf -)
rm $TMP/$PROJECT/.gitignore
rm $TMP/$PROJECT/create_archive.sh
rm -rf $TMP/$PROJECT/tests
rm -rf $TMP/$PROJECT/jis
perl -pi.bak -e "s/\\\$RELEASEDATE/$RELEASEDATE/g" $TMP/$PROJECT/README.md
rm -f $TMP/$PROJECT/README.md.bak
mkdir -p $TMP/$PROJECT/doc/platex/jsclasses
mv $TMP/$PROJECT/LICENSE $TMP/$PROJECT/doc/platex/jsclasses/
mv $TMP/$PROJECT/README.md $TMP/$PROJECT/doc/platex/jsclasses/
mv $TMP/$PROJECT/*.pdf $TMP/$PROJECT/doc/platex/jsclasses/
mkdir -p $TMP/$PROJECT/source/platex/jsclasses
mv $TMP/$PROJECT/Makefile $TMP/$PROJECT/source/platex/jsclasses/
mv $TMP/$PROJECT/*.dtx $TMP/$PROJECT/source/platex/jsclasses/
mv $TMP/$PROJECT/*.ins $TMP/$PROJECT/source/platex/jsclasses/
# winjis.sty should be removed for CTAN
mkdir -p $TMP/$PROJECT/tex/platex/jsclasses
mv $TMP/$PROJECT/*.cls $TMP/$PROJECT/tex/platex/jsclasses/
rm $TMP/$PROJECT/winjis.sty
mv $TMP/$PROJECT/*.sty $TMP/$PROJECT/tex/platex/jsclasses/
cd $TMP/$PROJECT && zip -r $TMP/$PROJECT.tds.zip *
cd $PWDF
rm -rf $TMP/$PROJECT
echo
echo " * Create $PROJECT.zip ($RELEASEDATE)"
git archive --format=tar --prefix=$PROJECT/ HEAD | (cd $TMP && tar xf -)
# Remove generated and auxiliary files
# winjis.sty should be removed for CTAN
rm $TMP/$PROJECT/.gitignore
rm $TMP/$PROJECT/create_archive.sh
rm -rf $TMP/$PROJECT/tests
rm -rf $TMP/$PROJECT/jis
rm $TMP/$PROJECT/*.cls
rm $TMP/$PROJECT/*.sty
perl -pi.bak -e "s/\\\$RELEASEDATE/$RELEASEDATE/g" $TMP/$PROJECT/README.md
rm -f $TMP/$PROJECT/README.md.bak
cd $TMP && zip -r $PWDF/$PROJECT.zip $PROJECT $PROJECT.tds.zip
rm -rf $TMP/$PROJECT $TMP/$PROJECT.tds.zip
echo
echo " * Done: $PROJECT.zip ($RELEASEDATE)"