-
Notifications
You must be signed in to change notification settings - Fork 2
/
create_archive.sh
executable file
·34 lines (28 loc) · 1001 Bytes
/
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
#!/bin/sh
PROJECT=chemobabel
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.zip ($RELEASEDATE)"
git archive --format=tar --prefix=$PROJECT/ HEAD | (cd $TMP && tar xf -)
rm $TMP/$PROJECT/.gitignore
rm $TMP/$PROJECT/create_archive.sh
rm $TMP/$PROJECT/Makefile
rm -rf $TMP/$PROJECT/tests
perl -pi.bak -e "s/\\\$RELEASEDATE/$RELEASEDATE/g" $TMP/$PROJECT/README.md
rm -f $TMP/$PROJECT/README.md.bak
# chemobabel specific
rm -rf $TMP/$PROJECT/00archives
rm -f $TMP/$PROJECT/chemobabel-161023.pdf
# make CTAN happy (filename with spaces, CRLF in MDL Molfiles)
cd $TMP/$PROJECT && tar zcf images-for-doc.tar.gz draw figures
rm -rf $TMP/$PROJECT/draw
rm -rf $TMP/$PROJECT/figures
cd $TMP && zip -r $PWDF/$PROJECT.zip $PROJECT
rm -rf $TMP/$PROJECT
echo
echo " * Done: $PROJECT.zip ($RELEASEDATE)"