Lichen

docs/tools/make_pages.sh

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