equal
deleted
inserted
replaced
|
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" |
|
57 echo "If you already have a copy somewhere else, make a symlink:" |
|
58 echo " $ ln -s /path/to/enano/hg ./enano-hg" |
|
59 exit 1 |
|
60 fi |
|
61 |
|
62 printf "Pulling latest code..." |
|
63 hg -R $REPO archive -r $REVISION -t tgz enano-$VERSION.tar.gz || fail "Could not pull revision $REVISION from Mercurial repo" |
|
64 printf "\nExtracting..." |
|
65 tar xzCf `dirname $0`/stage enano-$VERSION.tar.gz || fail "Could not extract tarball" |
|
66 rm -f enano-$VERSION.tar.gz |
|
67 printf "\nCreating payload..." |
|
68 cd stage |
|
69 tar cjf ../enano-$VERSION-selfextract.tar.bz2 autorun.sh COPYING enano-$VERSION || fail "Could not create staging tarball" |
|
70 rm -rf enano-$VERSION |
|
71 cd .. |
|
72 printf "\nWriting output..." |
|
73 cat self-extract.sh enano-$VERSION-selfextract.tar.bz2 > enano-$VERSION-bitnami-module.sh || fail "Could not write output" |
|
74 chmod +x enano-$VERSION-bitnami-module.sh |
|
75 rm -f enano-$VERSION-selfextract.tar.bz2 |
|
76 echo -e "\nDone! Output written to enano-$VERSION-bitnami-module.sh" |
|
77 |