File: update_src.sh

package info (click to toggle)
tex4ht 20060913-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 30,368 kB
  • ctags: 2,281
  • sloc: ansic: 11,659; sh: 556; perl: 302; java: 172; makefile: 98
file content (110 lines) | stat: -rw-r--r-- 2,306 bytes parent folder | download
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
#!/bin/sh
# Created by Kapil Hari Paranjape <kapil@imsc.res.in>
# Based on inputs from Antonio Ospite <ospite@studenti.unina.it>
# This creates the new .orig.tar.gz if there is an update

CHANGELOGS="bugfixes2.html bugfixes3.html"
NEWS="bugfixes.html"
STYFILES="DraTex.sty AlDraTex.sty ProTex.sty AlProTex.sty"

# Use the watch file and uscan
USCANOUT=$(uscan --report)

if [ -z "$USCANOUT" ] 
then
	echo "Existing source is up-to-date."
	exit 0
fi

# Extract information from the uscan report

URL=$(expr "$USCANOUT" : '.*\(http:\/\/.*\.tar\.gz\).*')
VERSION=$(expr "$USCANOUT" : '.*Newer version (\([0-9]*\)).*')

T4HTFIXURL=$(dirname "$URL")
T4HTURL=$(dirname "$T4HTFIXURL")
LIT="$T4HTFIXURL/tex4ht-lit.zip"
STYURL=$(expr "$T4HTURL" : '\(.*~[^/]*\)/.*')/tpf

ARCHIVE=$(basename $URL)
DIR=$(basename $ARCHIVE .tar.gz)

echo -n "Creating temporary directory for download ..."
TMPDIR=$(mktemp -d)
echo "Done."

OLDIR=$PWD

echo -n "Downloading the new sources ..."
cd $TMPDIR
if ! (wget -q $URL)
then
	echo "Error: Could not download $URL"
	exit 201
fi
if ! (wget -q $LIT)
then
	echo "Error: Could not download $LIT"
	exit 202
fi
for html in $NEWS $CHANGELOGS 
do
	if ! (wget -q $T4HTURL/$html)
	then
		echo "Error: Could not download $T4HTURL/$html"
		exit 203
	fi
done
for sty in $STYFILES
do
	if ! (wget -q $STYURL/$sty)
	then
		echo "Error: Could not download $STYURL/$sty"
		exit 204
	fi
done
echo "Done."

echo -n "Unpacking the source ..."
if [ -e $ARCHIVE ]
then
	tar xzf $ARCHIVE

	# Fix unnecessary execute permissions
	chmod -x $DIR/src/*

	# Fix unnecessary execute permissions
	find $DIR/texmf ! -type d | xargs -i chmod -x \{\}
else
	echo "Error: $ARCHIVE not found"
	exit 211
fi

if [ -e tex4ht-lit.zip ]
then
	unzip -d $DIR/lit -aqq tex4ht-lit.zip
	mv $STYFILES $NEWS $CHANGELOGS $DIR/lit

	# Fix unnecessary execute permissions
	chmod -x $DIR/lit/*
else
	echo "Error: tex4ht-lit.zip not found"
	echo 212
fi
echo "Done."

echo -n "Creating the new orig.tar.gz..."
mv $DIR tex4ht-${VERSION}.orig
GZIP="--best" tar czf $OLDIR/../tex4ht_${VERSION}.orig.tar.gz tex4ht-${VERSION}.orig
#tar czf $OLDIR/../tex4ht_${VERSION}.orig.tar.gz ${DIR}
echo "Done."

echo "Cleaning up ..."
cd $OLDIR
rm -rf $TMPDIR
echo "Done."

echo "New original sources are at ../tex4ht_${VERSION}.orig.tar.gz".

exit 0