author | Dan Fuhry <dan@enanocms.org> |
Mon, 05 Jul 2010 14:36:48 -0400 | |
changeset 3 | 859eeb3579b2 |
parent 2 | 7dddb5fb1595 |
child 5 | 7d3b7009399d |
permissions | -rwxr-xr-x |
0 | 1 |
#!/bin/bash |
2 |
DATE=`date "+%Y%m%d"` |
|
3 |
VERSION="hg-$DATE" |
|
4 |
REPO="./enano-hg" |
|
5 |
REVISION="tip" |
|
6 |
||
7 |
usage() |
|
8 |
{ |
|
9 |
cat <<EOF |
|
10 |
Usage: $0 [flags] |
|
11 |
Available command-line parameters: |
|
12 |
||
13 |
-h This help |
|
14 |
-v version Specify version of package (default: hg-$DATE) |
|
15 |
-r revision Mercurial revision to pull (default: tip) |
|
16 |
-R repopath Path to Mercurial repository (default: ./enano-hg) |
|
17 |
||
18 |
EOF |
|
19 |
exit 1 |
|
20 |
} |
|
21 |
||
22 |
fail() |
|
23 |
{ |
|
24 |
echo $1 |
|
25 |
exit 1 |
|
26 |
} |
|
27 |
||
28 |
while [ -n "$1" ]; do |
|
29 |
case "$1" in |
|
30 |
-v) |
|
31 |
VERSION="$2" |
|
32 |
shift |
|
33 |
;; |
|
34 |
-r) |
|
35 |
REVISION="$2" |
|
36 |
shift |
|
37 |
;; |
|
38 |
-R) |
|
39 |
REPO="$2" |
|
40 |
shift |
|
41 |
;; |
|
42 |
*) |
|
43 |
usage |
|
44 |
;; |
|
45 |
esac |
|
46 |
shift |
|
47 |
done |
|
48 |
||
49 |
if [ -z "$VERSION" -o -z "$REVISION" -o -z "$REPO" ]; then |
|
50 |
usage |
|
51 |
fi |
|
52 |
||
53 |
if [ ! -d "$REPO/.hg" ]; then |
|
54 |
echo "ERROR: Could not find the Enano Mercurial repository at $REPO." |
|
55 |
echo "Perhaps you need to obtain a copy?" |
|
56 |
echo " $ hg clone http://hg.enanocms.org/repos/enano-1.1 ./enano-hg" |
|
2
7dddb5fb1595
Me and my obsession with getting files to exactly 2048 bytes.
Dan
parents:
1
diff
changeset
|
57 |
echo "If you have a copy somewhere else, make a symlink:" |
0 | 58 |
echo " $ ln -s /path/to/enano/hg ./enano-hg" |
59 |
exit 1 |
|
60 |
fi |
|
61 |
||
1
dbce0b16b0c1
Added shellscript compactor to reduce size of self-extract script
Dan
parents:
0
diff
changeset
|
62 |
printf "Compacting self-extraction script..." |
dbce0b16b0c1
Added shellscript compactor to reduce size of self-extract script
Dan
parents:
0
diff
changeset
|
63 |
sed -f compact-shellscript.sed self-extract-src.sh > self-extract.sh || fail "Failed to generate compacted self-extract script" |
dbce0b16b0c1
Added shellscript compactor to reduce size of self-extract script
Dan
parents:
0
diff
changeset
|
64 |
|
dbce0b16b0c1
Added shellscript compactor to reduce size of self-extract script
Dan
parents:
0
diff
changeset
|
65 |
printf "\nPulling latest code..." |
0 | 66 |
hg -R $REPO archive -r $REVISION -t tgz enano-$VERSION.tar.gz || fail "Could not pull revision $REVISION from Mercurial repo" |
67 |
printf "\nExtracting..." |
|
68 |
tar xzCf `dirname $0`/stage enano-$VERSION.tar.gz || fail "Could not extract tarball" |
|
69 |
rm -f enano-$VERSION.tar.gz |
|
70 |
printf "\nCreating payload..." |
|
71 |
cd stage |
|
3
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
2
diff
changeset
|
72 |
tar cjf ../enano-$VERSION-selfextract.tar.bz2 * || fail "Could not create staging tarball" |
0 | 73 |
rm -rf enano-$VERSION |
74 |
cd .. |
|
75 |
printf "\nWriting output..." |
|
76 |
cat self-extract.sh enano-$VERSION-selfextract.tar.bz2 > enano-$VERSION-bitnami-module.sh || fail "Could not write output" |
|
77 |
chmod +x enano-$VERSION-bitnami-module.sh |
|
78 |
rm -f enano-$VERSION-selfextract.tar.bz2 |
|
79 |
echo -e "\nDone! Output written to enano-$VERSION-bitnami-module.sh" |