Debian bug 431211: Correct GNU GPL version in debian/copyright.
[elinks.git] / contrib / mkdist
blob0ae0b7b1a4d5a68bbead940b50cffd3fbb19f617
1 #!/bin/bash
3 # This script can be used by a cron to generate snapshots.
4 # For example, use:
5 # 35 0 * * * mkdist elinks-0.11 0.11 >>mkdist.log 2>&1
6 # 40 0 * * * mkdist HEAD 0.12 >>mkdist.log 2>&1
8 # To generate a release (which doesn't have a date in the
9 # top-level directory) also pass -r as the third parameter.
11 # set -x
13 echo "-------------------------------------------------"
14 echo "Date: $(date)"
15 echo "Args: $*"
16 echo "-------------------------------------------------"
18 ub=$1
19 lb=$2
21 GIT_DIR="elinks-repo-directory"
22 DOC_DIR="" # Leave empty for no doc dir
23 TMP_DIR="/tmp/elinks-git.$$"
24 TAR_DIR="elinks-snapshot-directory"
26 [ "$ub" ] || exit 1
27 [ "$lb" ] || exit 1
29 if [ "$3" != "-r" ]; then
30 ver=$lb-`date +%Y%m%d`
31 c="-current";
32 else
33 ver=$lb;
34 c="";
37 mkdir "$TMP_DIR
38 cd "$TMP_DIR"
40 GIT_DIR="$GIT_DIR" cg-export -r "$ub" "$TMP_DIR"/elinks"
42 cd elinks
44 ./autogen.sh
45 ./configure
47 if [ "$ub" = "REL_0_10" ]; then
48 make dist
49 tar xfz elinks-$lb*.tar.gz
50 cd elinks-$ub*
51 else
52 make -C po
55 if test -n "$DOC_DIR"; then
56 mkdir doc/html
57 cp -r "$DOC_DIR"/*.html* doc/html
58 # mkdir doc/pdf
59 # cp "$DOC_DIR"/*.pdf doc/pdf
62 cd ..
64 if [ "$c" ]; then
65 dir=`ls .`
66 mv $dir elinks-$ver
70 tar cfz elinks$c-$lb.tar.gz elinks-$ver && \
71 mv elinks$c-$lb.tar.gz "$TAR_DIR" && \
72 (cd "$TAR_DIR" && md5sum elinks$c-$lb.tar.gz > elinks$c-$lb.tar.gz.md5)
74 tar cfj elinks$c-$lb.tar.bz2 elinks-$ver && \
75 mv elinks$c-$lb.tar.bz2 "$TAR_DIR" && \
76 (cd "$TAR_DIR" && md5sum elinks$c-$lb.tar.bz2 > elinks$c-$lb.tar.gz.md5)
78 rm -rf "$TMP_DIR"