initial plugin support
This commit is contained in:
60
build.xml
60
build.xml
@ -76,10 +76,70 @@
|
|||||||
</java>
|
</java>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="plugin" depends="jar">
|
||||||
|
<mkdir dir="plugin/lib" />
|
||||||
|
|
||||||
|
<exec executable="grep" outputproperty="versionLine" failonerror="true" >
|
||||||
|
<arg value="public static final String VERSION" />
|
||||||
|
<arg value="src/syndie/Version.java" />
|
||||||
|
</exec>
|
||||||
|
<exec executable="cut" inputstring="${versionLine}" outputproperty="release.number" failonerror="true" >
|
||||||
|
<arg value="-f2" />
|
||||||
|
<arg value="-d"" />
|
||||||
|
</exec>
|
||||||
|
<buildnumber file="scripts/build.number" />
|
||||||
|
|
||||||
|
<!-- make the update xpi2p -->
|
||||||
|
<copy file="LICENSE" todir="plugin" />
|
||||||
|
<copy file="logger.config" todir="plugin" />
|
||||||
|
<copy file="scripts/plugin.config" todir="plugin" overwrite="true" />
|
||||||
|
<exec executable="echo" osfamily="unix" failifexecutionfails="true" output="plugin/plugin.config" append="true">
|
||||||
|
<arg value="version=${release.number}-b${build.number}" />
|
||||||
|
</exec>
|
||||||
|
<exec executable="echo" osfamily="unix" failifexecutionfails="true" output="plugin/plugin.config" append="true">
|
||||||
|
<arg value="update-only=true" />
|
||||||
|
</exec>
|
||||||
|
<exec executable="pack200" failifexecutionfails="true">
|
||||||
|
<arg value="-g" />
|
||||||
|
<arg value="plugin/lib/syndie.jar.pack" />
|
||||||
|
<arg value="${dist.dir}/syndie.jar" />
|
||||||
|
</exec>
|
||||||
|
<exec executable="scripts/makeplugin.sh" >
|
||||||
|
<arg value="plugin" />
|
||||||
|
</exec>
|
||||||
|
<move file="syndie.xpi2p" tofile="syndie-update.xpi2p" />
|
||||||
|
|
||||||
|
<!-- make the install xpi2p -->
|
||||||
|
<copy file="lib/hsqldb_lic.txt" todir="plugin" />
|
||||||
|
<copy file="scripts/plugin.config" todir="plugin" overwrite="true" />
|
||||||
|
<exec executable="echo" osfamily="unix" failifexecutionfails="true" output="plugin/plugin.config" append="true">
|
||||||
|
<arg value="version=${release.number}-b${build.number}" />
|
||||||
|
</exec>
|
||||||
|
<exec executable="pack200" failifexecutionfails="true">
|
||||||
|
<arg value="-g" />
|
||||||
|
<arg value="plugin/lib/hsqldb.jar.pack" />
|
||||||
|
<arg value="${lib.dir}/hsqldb.jar" />
|
||||||
|
</exec>
|
||||||
|
<exec executable="pack200" failifexecutionfails="true">
|
||||||
|
<arg value="-g" />
|
||||||
|
<arg value="plugin/lib/swt.jar.pack" />
|
||||||
|
<arg value="${lib.dir}/swt.jar" />
|
||||||
|
</exec>
|
||||||
|
<exec executable="scripts/makeplugin.sh" >
|
||||||
|
<arg value="plugin" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
<target name="clean" description="clean up">
|
<target name="clean" description="clean up">
|
||||||
<delete dir="${build.dir}" />
|
<delete dir="${build.dir}" />
|
||||||
<delete dir="${dist.dir}" />
|
<delete dir="${dist.dir}" />
|
||||||
|
<delete dir="plugin/lib" />
|
||||||
|
<delete file="plugin/logger.config" />
|
||||||
|
<delete file="plugin/plugin.config" />
|
||||||
|
<delete file="plugin/LICENSE" />
|
||||||
|
<delete file="plugin/hsqldb_lic.txt" />
|
||||||
|
<delete file="syndie.xpi2p" />
|
||||||
|
<delete file="syndie-update.xpi2p" />
|
||||||
</target>
|
</target>
|
||||||
</project>
|
</project>
|
||||||
|
7
plugin/clients.config
Normal file
7
plugin/clients.config
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
# syndie has a lot of System.exit() calls, so
|
||||||
|
# until these are patched, just run in a separate JVM
|
||||||
|
#
|
||||||
|
clientApp.0.main=net.i2p.util.ShellCommand
|
||||||
|
clientApp.0.args=java -Duser.home=$PLUGIN -cp $I2P/lib/i2p.jar:$PLUGIN/lib/hsqldb.jar:$PLUGIN/lib/swt.jar:$PLUGIN/lib/syndie.jar syndie.gui.SWTUI
|
||||||
|
clientApp.0.delay=20
|
105
scripts/makeplugin.sh
Executable file
105
scripts/makeplugin.sh
Executable file
@ -0,0 +1,105 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# basic packaging up of a plugin
|
||||||
|
#
|
||||||
|
# usage: makeplugin.sh plugindir
|
||||||
|
#
|
||||||
|
# zzz 2010-02
|
||||||
|
#
|
||||||
|
PUBKEYDIR=$HOME/.i2p-plugin-keys
|
||||||
|
PUBKEYFILE=$PUBKEYDIR/plugin-public-signing.key
|
||||||
|
PRIVKEYFILE=$PUBKEYDIR/plugin-private-signing.key
|
||||||
|
B64KEYFILE=$PUBKEYDIR/plugin-public-signing.txt
|
||||||
|
export I2P=../i2p/pkg-temp
|
||||||
|
|
||||||
|
# put your files in here
|
||||||
|
PLUGINDIR=${1:-plugin}
|
||||||
|
|
||||||
|
PC=plugin.config
|
||||||
|
PCT=${PC}.tmp
|
||||||
|
|
||||||
|
if [ ! -f $PRIVKEYFILE ]
|
||||||
|
then
|
||||||
|
mkdir -p $PUBKEYDIR
|
||||||
|
java -cp $I2P/lib/i2p.jar net.i2p.crypto.TrustedUpdate keygen $PUBKEYFILE $PRIVKEYFILE
|
||||||
|
java -cp $I2P/lib/i2p.jar net.i2p.data.Base64 encode $PUBKEYFILE $B64KEYFILE
|
||||||
|
rm -rf logs/
|
||||||
|
chmod 444 $PUBKEYFILE $B64KEYFILE
|
||||||
|
chmod 400 $PRIVKEYFILE
|
||||||
|
echo "Created new keys: $PUBKEYFILE $PRIVKEYFILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f plugin.zip
|
||||||
|
if [ ! -d $PLUGINDIR ]
|
||||||
|
then
|
||||||
|
echo "You must have a $PLUGINDIR directory"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
OPWD=$PWD
|
||||||
|
cd $PLUGINDIR
|
||||||
|
|
||||||
|
if [ ! -f $PC ]
|
||||||
|
then
|
||||||
|
echo "You must have a $PC file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
grep -q '^signer=' $PC
|
||||||
|
if [ "$?" -ne "0" ]
|
||||||
|
then
|
||||||
|
echo "You must have a signer in $PC"
|
||||||
|
echo 'For example signer=joe@mail.i2p'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
grep -q '^name=' $PC
|
||||||
|
if [ "$?" -ne "0" ]
|
||||||
|
then
|
||||||
|
echo "You must have a plugin name in $PC"
|
||||||
|
echo 'For example name=foo'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
grep -q '^version=' $PC
|
||||||
|
if [ "$?" -ne "0" ]
|
||||||
|
then
|
||||||
|
echo "You must have a version in $PC"
|
||||||
|
echo 'For example version=0.1.2'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# update the date
|
||||||
|
grep -v '^date=' $PC > $PCT
|
||||||
|
DATE=`date '+%s000'`
|
||||||
|
echo "date=$DATE" >> $PCT
|
||||||
|
mv $PCT $PC
|
||||||
|
|
||||||
|
# add our Base64 key
|
||||||
|
grep -v '^key=' $PC > $PCT
|
||||||
|
B64KEY=`cat $B64KEYFILE`
|
||||||
|
echo "key=$B64KEY" >> $PCT
|
||||||
|
mv $PCT $PC
|
||||||
|
|
||||||
|
# zip it
|
||||||
|
zip -r $OPWD/plugin.zip *
|
||||||
|
|
||||||
|
# get the version and use it for the sud header
|
||||||
|
VERSION=`grep '^version=' $PC | cut -f 2 -d '='`
|
||||||
|
# get the name and use it for the file name
|
||||||
|
NAME=`grep '^name=' $PC | cut -f 2 -d '='`
|
||||||
|
XPI2P=${NAME}.xpi2p
|
||||||
|
cd $OPWD
|
||||||
|
|
||||||
|
# sign it
|
||||||
|
java -cp $I2P/lib/i2p.jar net.i2p.crypto.TrustedUpdate sign plugin.zip $XPI2P $PRIVKEYFILE $VERSION
|
||||||
|
rm -f plugin.zip
|
||||||
|
|
||||||
|
# verify
|
||||||
|
echo 'Verifying. ...'
|
||||||
|
java -cp $I2P/lib/i2p.jar net.i2p.crypto.TrustedUpdate showversion $XPI2P
|
||||||
|
java -cp $I2P/lib/i2p.jar -Drouter.trustedUpdateKeys=$B64KEY net.i2p.crypto.TrustedUpdate verifysig $XPI2P
|
||||||
|
rm -rf logs/
|
||||||
|
|
||||||
|
echo -n 'Plugin created: '
|
||||||
|
wc -c $XPI2P
|
8
scripts/plugin.config
Normal file
8
scripts/plugin.config
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
name=syndie
|
||||||
|
signer=zzz-plugin@mail.i2p
|
||||||
|
updateURL=http://stats.i2p/i2p/plugins/syndie-update.xpi2p
|
||||||
|
description=Distributed messaging
|
||||||
|
author=jrandom (packaged by zzz)
|
||||||
|
license=Public Domain
|
||||||
|
websiteURL=http://syndie.i2p2.de/
|
||||||
|
disableStop=true
|
@ -1,4 +1,4 @@
|
|||||||
package syndie;
|
package syndie;
|
||||||
public class Version {
|
public class Version {
|
||||||
public static final String VERSION = "1.101b-6";
|
public static final String VERSION = "1.101b-7";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user