* Debian: Fixup, update, enhance dream's scripts

* build.xml: Speed up sponge's distclean additions
This commit is contained in:
zzz
2010-01-26 15:21:41 +00:00
parent 474691927a
commit b97197c0fa
12 changed files with 127 additions and 42 deletions

View File

@@ -197,6 +197,8 @@
<delete file="BOB-one.jar" failonerror="false" quiet="true" /> <delete file="BOB-one.jar" failonerror="false" quiet="true" />
</target> </target>
<target name="distclean" depends="clean"> <target name="distclean" depends="clean">
<delete dir="debian/tmp" />
<delete file="debian/files" />
<ant dir="core/java/" target="distclean" /> <ant dir="core/java/" target="distclean" />
<ant dir="router/java/" target="distclean" /> <ant dir="router/java/" target="distclean" />
<ant dir="apps/ministreaming/java/" target="distclean" /> <ant dir="apps/ministreaming/java/" target="distclean" />
@@ -237,8 +239,7 @@
<defaultexcludes remove="**/*~"/> <defaultexcludes remove="**/*~"/>
<delete> <delete>
<fileset dir="." includes="**/*.class" /> <fileset dir="." includes="**/*.class **/*.java~ **/*.txt~ **/*.xml~ **/*.sh~ **/*.SlackBuild~" />
<fileset dir="." includes="**/*.java~" />
<!-- <!--
Less common, but they pollute my workspace here, so we Less common, but they pollute my workspace here, so we
might as well nuke these as well. Are there any others? might as well nuke these as well. Are there any others?
@@ -247,10 +248,6 @@
++Sponge ++Sponge
--> -->
<fileset dir="." includes="**/*.txt~" />
<fileset dir="." includes="**/*.xml~" />
<fileset dir="." includes="**/*.sh~" />
<fileset dir="." includes="**/*.SlackBuild~" />
</delete> </delete>
<!-- <!--
Now we put the defaults back Now we put the defaults back
@@ -771,4 +768,15 @@
<echo message="Don't forget to mtn tag w: i2p-${release.number}" /> <echo message="Don't forget to mtn tag w: i2p-${release.number}" />
<echo message="... and mtn cert t:i2p-${release.number} branch i2p.i2p.release" /> <echo message="... and mtn cert t:i2p-${release.number} branch i2p.i2p.release" />
</target> </target>
<target name="debian">
<echo message="Did you update the version in these files?" />
<exec executable="ls" failonerror="true">
<arg value="-l" />
<arg value="debian/changelog" />
</exec>
<echo message="====================" />
<exec executable="dpkg-buildpackage" failifexecutionfails="true" >
<arg value="-b" />
</exec>
</target>
</project> </project>

22
debian/README.txt vendored Normal file
View File

@@ -0,0 +1,22 @@
This sets up a binary package with the following:
- A new user i2psvc (a lot of people already have an i2p user)
- i2psvc home is /var/lib/i2p
- $I2P is /usr/lib/i2p, owned by i2psvc
- i2psvc router directory is /var/lib/i2p/i2p-config (hack in WorkingDir.java)
- i2p daemon script in /etc/init.d/i2p
- i2prouter and eepget scripts in /usr/bin for other users to run it
- Users other than i2psvc cannot update via i2p, as they don't have
write permissions in $I2P
- Configured temp directory is /tmp
- linux and linux64 (i386) wrapper libs only
Todo:
- Remove 1MB lib/jbigi.jar, just build and include dynamic libjbigi
and the linux libjcpuid (and add dependency on libgmp)
- Initial router.config for i2psvc (without confusing i2p that
the router directory already exists):
* Disable browser launch at startup
* Move i2psnark dir, eepsite dir, log dir, etc. up one level

5
debian/changelog vendored
View File

@@ -1,3 +1,8 @@
i2p (0.7.10-0) testing; urgency=low
* tweaks
um...
-- zzz <nobody@nowhere.invalid> Wed, 31 Jan 2010 17:14:57 +0000
i2p (0.7-0) testing; urgency=low i2p (0.7-0) testing; urgency=low
* just setting this debian thing up * just setting this debian thing up
um... um...

14
debian/control vendored
View File

@@ -1,24 +1,18 @@
Source: i2p Source: i2p
Maintainer: jrandom Maintainer: i2p
Section: net Section: net
Priority: optional Priority: optional
Homepage: http://dev.i2p2.de Homepage: http://www.i2p2.de/
Build-Depends: java-sdk, ant Build-Depends: java-sdk, ant, gettext
Recommends: libgmp3c2
Version: 0.7-0
Tags: implemented-in::java, interface::daemon, network::client, network::server, role::program, security::cryptography
Package: i2p Package: i2p
Architecture: all Architecture: all
Section: net Section: net
Priority: optional Priority: optional
Depends: java-runtime Depends: java-runtime
Recommends: libgmp3c2
Description: load-balanced unspoofable packet switching network Description: load-balanced unspoofable packet switching network
I2P is an anonymizing network, offering a simple layer that identity-sensitive I2P is an anonymizing network, offering a simple layer that identity-sensitive
applications can use to securely communicate. All data is wrapped with several applications can use to securely communicate. All data is wrapped with several
layers of encryption, and the network is both distributed and dynamic, with no layers of encryption, and the network is both distributed and dynamic, with no
trusted parties. trusted parties.
Homepage: http://www.i2p2.de Homepage: http://www.i2p2.de/
Version: 0.7-0
Tags: implemented-in::java, interface::daemon, network::client, network::server, role::program, security::cryptography

46
debian/rules vendored
View File

@@ -1,20 +1,44 @@
#!/usr/bin/make -f #!/usr/bin/make -f
build: build:
ant preppkg && \ ant preppkg
(cd pkg-temp; chmod +x postinstall.sh) && \ mkdir -p debian/tmp/usr/lib
mkdir -p debian/tmp/var/lib && \ mkdir -p debian/tmp/etc/init.d
mkdir -p debian/tmp/etc/init.d && \ cp -a debian/scripts/init debian/tmp/etc/init.d/i2p
cp -a debian/scripts/init debian/tmp/etc/init.d/i2p && \ cp -a pkg-temp debian/tmp/usr/lib/i2p
cp -a pkg-temp debian/tmp/var/lib/i2p && \ rm -f debian/tmp/usr/lib/i2p/*.bat
rm -f debian/tmp/usr/lib/i2p/i2p.exe
rm -rf debian/tmp/usr/lib/i2p/icons
rm -f debian/tmp/usr/lib/i2p/lib/systray4j.dll
rm -rf debian/tmp/usr/lib/i2p/lib/wrapper/freebsd
rm -rf debian/tmp/usr/lib/i2p/lib/wrapper/macosx
rm -rf debian/tmp/usr/lib/i2p/lib/wrapper/solaris
rm -rf debian/tmp/usr/lib/i2p/lib/wrapper/win32
chmod +x debian/tmp/usr/lib/i2p/postinstall.sh
sed 's|$$INSTALL_PATH|/usr/lib/i2p|g' debian/tmp/usr/lib/i2p/wrapper.config > debian/tmp/usr/lib/i2p/a
sed 's|$$SYSTEM_java_io_tmpdir|/tmp|g' debian/tmp/usr/lib/i2p/a > debian/tmp/usr/lib/i2p/wrapper.config
mkdir -p debian/tmp/usr/bin
sed 's|%INSTALL_PATH|/usr/lib/i2p|g' debian/tmp/usr/lib/i2p/eepget > debian/tmp/usr/lib/i2p/a
mv debian/tmp/usr/lib/i2p/a debian/tmp/usr/lib/i2p/eepget
cp debian/tmp/usr/lib/i2p/eepget debian/tmp/usr/bin/eepget
chmod +x debian/tmp/usr/bin/eepget
sed 's|%INSTALL_PATH|/usr/lib/i2p|g' debian/tmp/usr/lib/i2p/runplain.sh > debian/tmp/usr/lib/i2p/a
sed 's|%SYSTEM_java_io_tmpdir|/tmp|g' debian/tmp/usr/lib/i2p/a > debian/tmp/usr/lib/i2p/runplain.sh
sed 's|%INSTALL_PATH|/usr/lib/i2p|g' debian/tmp/usr/lib/i2p/i2prouter > debian/tmp/usr/lib/i2p/a
sed 's|%SYSTEM_java_io_tmpdir|/tmp|g' debian/tmp/usr/lib/i2p/a > debian/tmp/usr/lib/i2p/i2prouter
cp debian/tmp/usr/lib/i2p/i2prouter debian/tmp/usr/bin/i2prouter
chmod +x debian/tmp/usr/bin/i2prouter
rm debian/tmp/usr/lib/i2p/a
touch debian/build touch debian/build
binary: build binary: build
mkdir -p debian/tmp/DEBIAN && \ mkdir -p debian/tmp/DEBIAN
dpkg-gencontrol && \ dpkg-gencontrol
cp -a debian/scripts/postinst debian/scripts/postrm debian/scripts/prerm debian/tmp/DEBIAN && \ cp -a debian/scripts/postinst debian/scripts/postrm debian/scripts/prerm debian/tmp/DEBIAN
dpkg-deb -b debian/tmp .. dpkg-deb -b debian/tmp ..
clean: clean:
rm -f debian/build rm -f debian/build
ant clean rm -rf debian/tmp/
rm -Rf pkg-temp ant distclean
@exit 0 @exit 0

6
debian/scripts/init vendored
View File

@@ -1,4 +1,4 @@
#! /bin/sh #!/bin/sh
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: i2p # Provides: i2p
@@ -13,8 +13,8 @@ set -e
. /lib/lsb/init-functions . /lib/lsb/init-functions
function I2P { I2P () {
su i2p -c "/var/lib/i2p/i2prouter $1" su i2psvc -c "/usr/lib/i2p/i2prouter $1"
} }
case "$1" in case "$1" in

View File

@@ -1,9 +1,14 @@
#!/bin/sh #!/bin/sh
TOP=/var/lib/i2p SVCHOME=/var/lib/i2p
useradd -b $TOP -r i2p 2>/dev/null I2P=/usr/lib/i2p
chown i2p $TOP -R I2PUSER=i2psvc
update-rc.d useradd -d $SVCHOME -r $I2PUSER
chown $I2PUSER:$I2PUSER $I2P -R
mkdir -p $SVCHOME
chown $I2PUSER:$I2PUSER $SVCHOME
cd $TOP update-rc.d i2p defaults
exec su i2p -c ./postinstall.sh
cd $I2P
exec su $I2PUSER ./postinstall.sh

View File

@@ -1,2 +1,9 @@
#!/bin/sh #!/bin/sh
exec userdel i2p I2PUSER=i2psvc
exec userdel $I2PUSER
# if somebody did updates in-network, there may be new files that dpkg
# doesn't know about, so just to be sure
I2P=/usr/lib/i2p
rm -rf $I2P

19
debian/scripts/prerm vendored
View File

@@ -1,2 +1,19 @@
#!/bin/sh #!/bin/sh
exec /etc/init.d/i2p stop /etc/init.d/i2p stop
# stuff in /tmp
rm -f /tmp/wrapper.log /tmp/wrapper.log.1 /tmp/wrapper.log.2 /tmp/i2p.pid /tmp/routerjvm.pid /tmp/router.ping
# /etc/rc*.d/*i2p files
update-rc.d -f i2p remove
# dpkg doesn't know about these files, created by postinstall.sh
I2P=/usr/lib/i2p
rm -f $I2P/i2psvc $I2P/lib/libwrapper.so $I2P/lib/wrapper.jar
# the home directory for the i2p daemon
SVCHOME=/var/lib/i2p
rm -rf $SVCHOME
# if any user other than i2psvc has run i2p, the files in ~user/.i2p are not removed
exit 0

View File

@@ -1,4 +1,4 @@
#! /bin/sh #!/bin/sh
# #
# Skeleton sh script suitable for starting and stopping # Skeleton sh script suitable for starting and stopping

View File

@@ -66,8 +66,6 @@ cp $wrapperpath/wrapper.jar ./lib/
cp $wrapperpath/i2psvc . cp $wrapperpath/i2psvc .
chmod 744 ./eepget chmod 744 ./eepget
chmod 744 ./i2psvc chmod 744 ./i2psvc
chmod 744 ./scripts/i2pbench.sh
chmod 744 ./scripts/i2ptest.sh
rm -rf ./icons rm -rf ./icons
rm -rf ./lib/wrapper rm -rf ./lib/wrapper
rm -f ./lib/*.dll rm -f ./lib/*.dll

View File

@@ -47,6 +47,8 @@ public class WorkingDir {
private final static String PROP_WORKING_DIR = "i2p.dir.config"; private final static String PROP_WORKING_DIR = "i2p.dir.config";
private final static String WORKING_DIR_DEFAULT_WINDOWS = "I2P"; private final static String WORKING_DIR_DEFAULT_WINDOWS = "I2P";
private final static String WORKING_DIR_DEFAULT = ".i2p"; private final static String WORKING_DIR_DEFAULT = ".i2p";
private final static String WORKING_DIR_DEFAULT_DAEMON = "i2p-config";
private final static String DAEMON_USER = "i2psvc";
/** /**
* Only call this once on router invocation. * Only call this once on router invocation.
@@ -70,7 +72,10 @@ public class WorkingDir {
home = appdata; home = appdata;
dirf = new File(home, WORKING_DIR_DEFAULT_WINDOWS); dirf = new File(home, WORKING_DIR_DEFAULT_WINDOWS);
} else { } else {
dirf = new File(home, WORKING_DIR_DEFAULT); if (DAEMON_USER.equals(System.getProperty("user.name")))
dirf = new File(home, WORKING_DIR_DEFAULT_DAEMON);
else
dirf = new File(home, WORKING_DIR_DEFAULT);
} }
} }