8058
|
1 |
#!/bin/bash
|
|
2 |
#
|
|
3 |
# $Id$
|
|
4 |
#
|
|
5 |
# filesizes -- calculate and substitute file sizes in isabelle web pages
|
|
6 |
#
|
|
7 |
# needs:
|
|
8 |
# working directory in dist, rpms + webpages generated and copied to dist
|
|
9 |
# $DISTNAME
|
|
10 |
#
|
|
11 |
# substitutes:
|
|
12 |
# -norpm:
|
|
13 |
# {PACKED_SIZE} {PACKED_SIZE_PDF} {UNPACKED_SIZE}
|
|
14 |
# -rpm:
|
|
15 |
# {RPM_SML_SIZE} {RPM_BASE_SIZE} {RPM_HOL_SIZE} {RPM_REAL_SIZE}
|
|
16 |
# {RPM_ZF_SIZE} {RPM_DOCS_SIZE}
|
|
17 |
|
|
18 |
|
|
19 |
PRG=$(basename $0)
|
|
20 |
|
|
21 |
function usage()
|
|
22 |
{
|
|
23 |
echo
|
|
24 |
echo "Usage: $PRG [-rpm|-norpm]"
|
|
25 |
echo
|
|
26 |
echo "fill in file sizes and distname in isabelle dist web pages"
|
|
27 |
echo
|
|
28 |
echo " Options are:"
|
|
29 |
echo " -rpm only fill in rpm sizes"
|
|
30 |
echo " -norpm only fille in other sizes"
|
|
31 |
echo " (do both by default)"
|
|
32 |
echo
|
|
33 |
echo "needs \$DISTNAME environment variable"
|
|
34 |
echo "expects to be startet in isabelle dist dir"
|
|
35 |
echo
|
|
36 |
exit 1
|
|
37 |
}
|
|
38 |
|
|
39 |
function fail()
|
|
40 |
{
|
|
41 |
echo "$1" >&2
|
|
42 |
exit 2
|
|
43 |
}
|
|
44 |
|
|
45 |
# check options
|
|
46 |
|
|
47 |
if [ $# -ge 2 ]; then
|
|
48 |
usage
|
|
49 |
fi
|
|
50 |
|
|
51 |
if [ $# -eq 1 -a "$1" != "-rpm" -a "$1" != "-norpm" ]; then
|
|
52 |
usage
|
|
53 |
fi
|
|
54 |
|
|
55 |
|
|
56 |
# begin work
|
|
57 |
|
|
58 |
if [ $# -eq 0 -o "$1" = "-norpm" ]; then
|
|
59 |
|
|
60 |
# check for $DISTNAME
|
|
61 |
if [ "$DISTNAME" = "" ]; then
|
|
62 |
echo "Error: \$DISTNAME not set"
|
|
63 |
usage
|
|
64 |
fi
|
|
65 |
|
|
66 |
PACKED_SIZE=$[ $(wc -c < $DISTNAME.tar.gz) / 1024 ]
|
|
67 |
PACKED_SIZE_PDF=$[ $(wc -c < ${DISTNAME}_pdf.tar.gz) / 1024 ]
|
|
68 |
|
|
69 |
UNPACKED_SIZE=$[ $(cat $DISTNAME.tar.gz ${DISTNAME}_pdf.tar.gz | gunzip | wc -c) / 1024 ]
|
|
70 |
|
|
71 |
perl -pi -e \
|
|
72 |
"s/{UNPACKED_SIZE}/$UNPACKED_SIZE/g; \
|
|
73 |
s/{PACKED_SIZE}/$PACKED_SIZE/g; \
|
|
74 |
s/{PACKED_SIZE_PDF}/$PACKED_SIZE_PDF/g;" \
|
|
75 |
*.html
|
|
76 |
fi
|
|
77 |
|
|
78 |
if [ $# -eq 0 -o "$1" = "-rpm" ]; then
|
8852
|
79 |
RPM_SML_SIZE=$[ $(wc -c < rpm/polyml-3X-1.i386.rpm) / 1024 ]
|
8058
|
80 |
RPM_BASE_SIZE=$[ $(wc -c < rpm/isabelle.rpm) / 1024 ]
|
|
81 |
RPM_HOL_SIZE=$[ $(wc -c < rpm/isabelle-HOL.i386.rpm) / 1024 ]
|
|
82 |
RPM_REAL_SIZE=$[ $(wc -c < rpm/isabelle-HOL-Real.i386.rpm) / 1024 ]
|
|
83 |
RPM_ZF_SIZE=$[ $(wc -c < rpm/isabelle-ZF.i386.rpm) / 1024 ]
|
|
84 |
RPM_DOCS_SIZE=$[ $(wc -c < rpm/isabelle-pdfdocs.rpm) / 1024 ]
|
|
85 |
|
|
86 |
perl -pi -e \
|
|
87 |
"s/{RPM_SML_SIZE}/$RPM_SML_SIZE/g; \
|
|
88 |
s/{RPM_BASE_SIZE}/$RPM_BASE_SIZE/g; \
|
|
89 |
s/{RPM_HOL_SIZE}/$RPM_HOL_SIZE/g; \
|
|
90 |
s/{RPM_REAL_SIZE}/$RPM_REAL_SIZE/g; \
|
|
91 |
s/{RPM_ZF_SIZE}/$RPM_ZF_SIZE/g; \
|
|
92 |
s/{RPM_DOCS_SIZE}/$RPM_DOCS_SIZE/g;" \
|
|
93 |
*.html
|
|
94 |
fi
|