Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create a new JSPWiki instance
#!/bin/bash
SRCDIR=/root/build/JSPWiki
WIKIDIR=/jspwiki
CONFDIR=/etc/jspwiki
DEPLOYDIR=/opt/java/tomcat/conf/Catalina/localhost
test -z $1 && echo "USAGE: $(basename $0) wikiname" && exit 1
test -d $WIKIDIR/$1 && echo "The name $1 is already used" && exit 1
test ! -d $WIKIDIR && mkdir $WIKIDIR
test ! -d $CONFDIR && mkdir $CONFDIR
sed -e "s%^\(jspwiki.applicationName = \).*%\1$1%" \
-e "s%^\(jspwiki.fileSystemProvider.pageDir = \).*%\1$WIKIDIR/$1%" \
-e "s%^#\(jspwiki.workDir =\).*%\1 /tmp/$1%" \
-e "s%^\(jspwiki.basicAttachmentProvider.storageDir = \).*%\1$WIKIDIR/$1%" \
-e "s%^#\(jspwiki.xmlGroupDatabaseFile = \).*%\1$CONFDIR/$1-groupdatabase.xml%" \
-e "s%^#\(jspwiki.xmlUserDatabaseFile = \).*%\1$CONFDIR/$1-userdatabase.xml%" \
-e "s%^\(log4j.appender.FileLog.File = \).*%\1/tmp/$1/jspwiki.log%" \
$SRCDIR/jspwiki.properties > $CONFDIR/$1.properties
cp $SRCDIR/userdatabase.xml $CONFDIR/$1-userdatabase.xml
cp $SRCDIR/groupdatabase.xml $CONFDIR/$1-groupdatabase.xml
unzip $SRCDIR/JSPWiki-corepages.zip -d $WIKIDIR/$1
cat << EOD > $DEPLOYDIR/$1.xml
<Context path="/$1" docBase="$WIKIDIR/JSPWiki.war" debug="0">
<Parameter name="jspwiki.propertyfile"
value="$CONFDIR/$1.properties"
override="false"/>
</Context>
EOD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment