paul@985 | 1 | #!/bin/sh |
paul@985 | 2 | |
paul@985 | 3 | DIRNAME=`dirname $0` |
paul@985 | 4 | PROGNAME=`basename $0` |
paul@985 | 5 | OUTDIR=$1 |
paul@985 | 6 | |
paul@985 | 7 | if [ ! "$OUTDIR" ]; then |
paul@985 | 8 | cat 1>&2 <<EOF |
paul@1104 | 9 | Usage: $PROGNAME <output directory> [ <page prefix> ] [ --releases [ --sign ] ] |
paul@985 | 10 | EOF |
paul@985 | 11 | exit 1 |
paul@985 | 12 | fi |
paul@985 | 13 | |
paul@985 | 14 | if [ -e "$OUTDIR" ]; then |
paul@985 | 15 | echo "Please remove $OUTDIR before generating a new package." 1>&2 |
paul@985 | 16 | exit 1 |
paul@985 | 17 | fi |
paul@985 | 18 | |
paul@1104 | 19 | if [ "$2" = '--releases' ]; then |
paul@1104 | 20 | PREFIX= |
paul@1104 | 21 | RELEASES=$2 |
paul@1104 | 22 | SIGN=$3 |
paul@1104 | 23 | else |
paul@1104 | 24 | PREFIX=$2 |
paul@1104 | 25 | RELEASES=$3 |
paul@1104 | 26 | SIGN=$4 |
paul@1104 | 27 | fi |
paul@1104 | 28 | |
paul@1104 | 29 | # Generate release archives. These are held in a separate, semi-permanent |
paul@1104 | 30 | # place so that archives and signatures are not regenerated unnecessarily. |
paul@1104 | 31 | |
paul@1104 | 32 | if [ "$RELEASES" ]; then |
paul@1104 | 33 | "$DIRNAME/make_releases.sh" releases |
paul@1104 | 34 | fi |
paul@1104 | 35 | |
paul@1104 | 36 | if [ "$SIGN" ]; then |
paul@1104 | 37 | "$DIRNAME/sign_releases.sh" releases |
paul@1104 | 38 | fi |
paul@1104 | 39 | |
paul@1104 | 40 | # Generate a manifest for the page package. |
paul@1104 | 41 | |
paul@985 | 42 | MANIFEST="$OUTDIR/MOIN_PACKAGE" |
paul@985 | 43 | |
paul@985 | 44 | mkdir "$OUTDIR" |
paul@985 | 45 | cat > "$MANIFEST" <<EOF |
paul@985 | 46 | MoinMoinPackage|1 |
paul@985 | 47 | EOF |
paul@985 | 48 | |
paul@1104 | 49 | # Add the pages to the manifest. |
paul@1104 | 50 | |
paul@998 | 51 | DOCS="$DIRNAME/../wiki" |
paul@985 | 52 | |
paul@1104 | 53 | cp "$DOCS/"* "$OUTDIR" |
paul@1104 | 54 | |
paul@985 | 55 | for FILENAME in "$DOCS/"* ; do |
paul@985 | 56 | BASENAME=`basename "$FILENAME"` |
paul@985 | 57 | PAGENAME=`echo "$BASENAME" | sed 's/--/\//g'` |
paul@985 | 58 | if [ "$PREFIX" ]; then |
paul@985 | 59 | if [ "$PAGENAME" = "FrontPage" ]; then |
paul@985 | 60 | PAGENAME="$PREFIX" |
paul@985 | 61 | else |
paul@985 | 62 | PAGENAME="$PREFIX/$PAGENAME" |
paul@985 | 63 | fi |
paul@985 | 64 | fi |
paul@985 | 65 | echo "AddRevision|$BASENAME|$PAGENAME" >> "$MANIFEST" |
paul@985 | 66 | done |
paul@985 | 67 | |
paul@1104 | 68 | # Combine the releases with the pages. |
paul@1104 | 69 | |
paul@1104 | 70 | ATTACHMENT="attachment_" |
paul@1104 | 71 | |
paul@1104 | 72 | for FILENAME in releases/* ; do |
paul@1104 | 73 | BASENAME=`basename "$FILENAME"` |
paul@1104 | 74 | cp "$FILENAME" "$OUTDIR/$ATTACHMENT$BASENAME" |
paul@1104 | 75 | done |
paul@1104 | 76 | |
paul@1104 | 77 | # Add the releases to the manifest. |
paul@1104 | 78 | |
paul@1104 | 79 | for FILENAME in releases/* ; do |
paul@1104 | 80 | BASENAME=`basename "$FILENAME"` |
paul@1104 | 81 | PAGENAME="Downloads" |
paul@1104 | 82 | if [ "$PREFIX" ]; then |
paul@1104 | 83 | PAGENAME="$PREFIX/$PAGENAME" |
paul@1104 | 84 | fi |
paul@1104 | 85 | echo "AddAttachment|$ATTACHMENT$BASENAME|$BASENAME|$PAGENAME" >> "$MANIFEST" |
paul@1104 | 86 | done |
paul@1104 | 87 | |
paul@985 | 88 | zip -j "$OUTDIR" "$OUTDIR/"* |