author | Dan Fuhry <dan@enanocms.org> |
Mon, 05 Jul 2010 23:57:56 -0400 | |
changeset 5 | 7d3b7009399d |
parent 3 | 859eeb3579b2 |
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" |
|
5
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
6 |
MINIMAL= |
0 | 7 |
|
8 |
usage() |
|
9 |
{ |
|
10 |
cat <<EOF |
|
11 |
Usage: $0 [flags] |
|
12 |
Available command-line parameters: |
|
13 |
||
14 |
-h This help |
|
15 |
-v version Specify version of package (default: hg-$DATE) |
|
16 |
-r revision Mercurial revision to pull (default: tip) |
|
17 |
-R repopath Path to Mercurial repository (default: ./enano-hg) |
|
5
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
18 |
-m If set, installer doesn't pack a copy of Enano. Instead, |
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
19 |
it downloads and runs mkenanodev.sh. |
0 | 20 |
|
21 |
EOF |
|
22 |
exit 1 |
|
23 |
} |
|
24 |
||
25 |
fail() |
|
26 |
{ |
|
27 |
echo $1 |
|
28 |
exit 1 |
|
29 |
} |
|
30 |
||
31 |
while [ -n "$1" ]; do |
|
32 |
case "$1" in |
|
33 |
-v) |
|
34 |
VERSION="$2" |
|
35 |
shift |
|
36 |
;; |
|
37 |
-r) |
|
38 |
REVISION="$2" |
|
39 |
shift |
|
40 |
;; |
|
41 |
-R) |
|
42 |
REPO="$2" |
|
43 |
shift |
|
44 |
;; |
|
5
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
45 |
-m) |
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
46 |
MINIMAL=true |
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
47 |
;; |
0 | 48 |
*) |
49 |
usage |
|
50 |
;; |
|
51 |
esac |
|
52 |
shift |
|
53 |
done |
|
54 |
||
55 |
if [ -z "$VERSION" -o -z "$REVISION" -o -z "$REPO" ]; then |
|
56 |
usage |
|
57 |
fi |
|
58 |
||
5
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
59 |
if [ ! -d "$REPO/.hg" -a -z "$MINIMAL" ]; then |
0 | 60 |
echo "ERROR: Could not find the Enano Mercurial repository at $REPO." |
61 |
echo "Perhaps you need to obtain a copy?" |
|
62 |
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
|
63 |
echo "If you have a copy somewhere else, make a symlink:" |
0 | 64 |
echo " $ ln -s /path/to/enano/hg ./enano-hg" |
65 |
exit 1 |
|
66 |
fi |
|
67 |
||
1
dbce0b16b0c1
Added shellscript compactor to reduce size of self-extract script
Dan
parents:
0
diff
changeset
|
68 |
printf "Compacting self-extraction script..." |
dbce0b16b0c1
Added shellscript compactor to reduce size of self-extract script
Dan
parents:
0
diff
changeset
|
69 |
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
|
70 |
|
5
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
71 |
if [ -z "$MINIMAL" ]; then |
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
72 |
printf "\nPulling latest code..." |
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
73 |
hg -R $REPO archive -r $REVISION -t tgz enano-$VERSION.tar.gz || fail "Could not pull revision $REVISION from Mercurial repo" |
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
74 |
printf "\nExtracting..." |
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
75 |
tar xzCf `dirname $0`/stage enano-$VERSION.tar.gz || fail "Could not extract tarball" |
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
76 |
rm -f enano-$VERSION.tar.gz |
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
77 |
fi |
0 | 78 |
printf "\nCreating payload..." |
79 |
cd stage |
|
3
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
2
diff
changeset
|
80 |
tar cjf ../enano-$VERSION-selfextract.tar.bz2 * || fail "Could not create staging tarball" |
5
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
81 |
if [ -z "$MINIMAL" ]; then |
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
82 |
rm -rf enano-$VERSION |
7d3b7009399d
Added OS X tr workaround; added support for making Mercurial-only packages that pull Enano from Mercurial and install it using mkenanodev
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
83 |
fi |
0 | 84 |
cd .. |
85 |
printf "\nWriting output..." |
|
86 |
cat self-extract.sh enano-$VERSION-selfextract.tar.bz2 > enano-$VERSION-bitnami-module.sh || fail "Could not write output" |
|
87 |
chmod +x enano-$VERSION-bitnami-module.sh |
|
88 |
rm -f enano-$VERSION-selfextract.tar.bz2 |
|
89 |
echo -e "\nDone! Output written to enano-$VERSION-bitnami-module.sh" |