rev |
line source |
dongsheng@634
|
1 #!/bin/sh
|
dongsheng@634
|
2
|
dongsheng@634
|
3 build_dir=`dirname "$0"`/../build
|
dongsheng@634
|
4 rev_id=`hg parents --template '{date|shortdate}' | sed 's/-//g'`
|
dongsheng@634
|
5
|
dongsheng@634
|
6 for l in en zh; do
|
dongsheng@637
|
7 (
|
dongsheng@637
|
8 if [ ! -d "${build_dir}/${l}" ] ; then
|
dongsheng@637
|
9 continue
|
dongsheng@637
|
10 fi
|
dongsheng@637
|
11
|
dongsheng@637
|
12 cd ${build_dir}/${l};
|
dongsheng@634
|
13
|
dongsheng@634
|
14 f='html'
|
dongsheng@634
|
15 if [ -f "${f}/index.html" ] ; then
|
dongsheng@634
|
16 d=hgbook-${l}-${f}
|
dongsheng@634
|
17 rm -fr ${d} && cp -r ${f} ${d} && tar czf ../${d}-${rev_id}.tar.gz ${d}
|
dongsheng@634
|
18 fi
|
dongsheng@634
|
19
|
dongsheng@634
|
20 f='html-single'
|
dongsheng@634
|
21 if [ -f "${f}/hgbook.html" ] ; then
|
dongsheng@634
|
22 d=hgbook-${l}-${f}
|
dongsheng@634
|
23 rm -fr ${d} && cp -r ${f} ${d} && tar czf ../${d}-${rev_id}.tar.gz ${d}
|
dongsheng@634
|
24 fi
|
dongsheng@634
|
25
|
dongsheng@634
|
26 if [ -f "pdf/hgbook.pdf" ] ; then
|
dongsheng@634
|
27 cp pdf/hgbook.pdf ../hgbook-${l}-${rev_id}.pdf
|
dongsheng@634
|
28 gzip -f9 ../hgbook-${l}-${rev_id}.pdf
|
dongsheng@634
|
29 fi
|
songdongsheng@663
|
30
|
songdongsheng@663
|
31 if [ -f "epub/hgbook.epub" ] ; then
|
songdongsheng@663
|
32 cp epub/hgbook.epub ../hgbook-${l}-${rev_id}.epub
|
songdongsheng@663
|
33 fi
|
dongsheng@634
|
34 )
|
dongsheng@634
|
35 done
|
dongsheng@634
|
36
|
dongsheng@634
|
37 upload_pass=$1
|
dongsheng@634
|
38 upload_user=$2
|
dongsheng@634
|
39
|
songdongsheng@663
|
40 # echo "upload_pass: ${upload_pass}"
|
songdongsheng@663
|
41 # echo "upload_user: ${upload_user}"
|
songdongsheng@663
|
42
|
dongsheng@634
|
43 if [ "${upload_user}x" == "x" ]; then
|
dongsheng@634
|
44 upload_user="dongsheng.song"
|
dongsheng@634
|
45 fi
|
dongsheng@634
|
46
|
dongsheng@634
|
47 if [ "${upload_pass}x" != "x" ]; then
|
dongsheng@634
|
48 (
|
dongsheng@634
|
49 cd ${build_dir}
|
dongsheng@637
|
50 curl -s -O http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py
|
dongsheng@637
|
51 if [[ "0" != $? ]]; then
|
dongsheng@637
|
52 exit 1
|
dongsheng@637
|
53 fi
|
dongsheng@634
|
54
|
dongsheng@634
|
55 for l in en zh; do
|
songdongsheng@663
|
56 if [ -f "hgbook-${l}-${rev_id}.epub" ] ; then
|
songdongsheng@663
|
57 python googlecode_upload.py --user="${upload_user}" --password="${upload_pass}" \
|
songdongsheng@663
|
58 -p "i18n-zh" -l "Type-Docs,book,hgbook,hg,mercurial,ebook" \
|
songdongsheng@663
|
59 -s "Distributed revision control with Mercurial - ${l} - ePub" \
|
songdongsheng@663
|
60 hgbook-${l}-${rev_id}.epub
|
songdongsheng@663
|
61 fi
|
songdongsheng@663
|
62
|
dongsheng@637
|
63 if [ -f "hgbook-${l}-${rev_id}.pdf.gz" ] ; then
|
songdongsheng@663
|
64 python googlecode_upload.py --user="${upload_user}" --password="${upload_pass}" \
|
songdongsheng@663
|
65 -p "i18n-zh" -l "Type-Docs,book,hgbook,hg,mercurial" \
|
dongsheng@637
|
66 -s "Distributed revision control with Mercurial - ${l} - pdf" \
|
dongsheng@637
|
67 hgbook-${l}-${rev_id}.pdf.gz
|
dongsheng@637
|
68 fi
|
dongsheng@634
|
69
|
dongsheng@634
|
70 for f in html html-single; do
|
songdongsheng@663
|
71 if [ -f "hgbook-${l}-${f}-${rev_id}.tar.gz" ] ; then
|
songdongsheng@663
|
72 python googlecode_upload.py --user="${upload_user}" --password="${upload_pass}" \
|
songdongsheng@663
|
73 -p "i18n-zh" -l "Type-Docs,book,hgbook,hg,mercurial" \
|
dongsheng@637
|
74 -s "Distributed revision control with Mercurial - ${l} - ${f}" \
|
dongsheng@637
|
75 hgbook-${l}-${f}-${rev_id}.tar.gz
|
dongsheng@637
|
76 fi
|
dongsheng@634
|
77 done
|
dongsheng@634
|
78 done
|
dongsheng@634
|
79 )
|
dongsheng@634
|
80 fi
|