From 7365ca849f6c0756dda56b21f13c6620ed5b083a Mon Sep 17 00:00:00 2001 From: dream <dream@mail.i2p> Date: Fri, 30 Jan 2009 22:32:52 +0000 Subject: [PATCH] preliminary debian package support This sets i2p up as a functional Debian source package. dpkg-buildpackage will build i2p using ant preppkg (tarball takes too long and not helpful). It creates a binary .deb archive of the i2p installation, which when installed goes into /var/lib/i2p as the non-root user i2p, and adds an /etc/init.d script to start it up. Some problems not yet solved: 1) under Debian the conf should go into /etc/i2p, but since it doesn't things like the eepsite index file get overwritten if you reinstall. should check for those somehow and not replace them, or ask the user. 2) under Debian they like it if you split the generated data from the static code, so i2p should go into /usr/lib/i2p maybe, but its netDB and any other cache files into /var/cache/i2p that's important not just for organization, but also /var is often on a filesystem optimized for churn. For now just put it in /var/lib 3) i2p is supposedly architecture independant, but it does choose a native jbigi library on postinstall, so does that really count as architecture independant? --- debian/changelog | 4 +++ debian/control | 24 ++++++++++++++++++ debian/copyright | 8 ++++++ debian/rules | 20 +++++++++++++++ debian/scripts/init | 54 +++++++++++++++++++++++++++++++++++++++++ debian/scripts/postinst | 9 +++++++ debian/scripts/postrm | 2 ++ debian/scripts/prerm | 2 ++ 8 files changed, 123 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100755 debian/scripts/init create mode 100755 debian/scripts/postinst create mode 100755 debian/scripts/postrm create mode 100755 debian/scripts/prerm diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000000..bb17d98aed --- /dev/null +++ b/debian/changelog @@ -0,0 +1,4 @@ +i2p (0.7-0) testing; urgency=low + * just setting this debian thing up + um... + -- dream <nobody@nowhere.invalid> Wed, 01 Jan 2009 17:14:57 +0000 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000000..5c9d9f1121 --- /dev/null +++ b/debian/control @@ -0,0 +1,24 @@ +Source: i2p +Maintainer: jrandom +Section: net +Priority: optional +Homepage: http://dev.i2p2.de +Build-Depends: java-sdk, ant +Recommends: libgmp3c2 +Version: 0.7-0 +Tags: implemented-in::java, interface::daemon, network::client, network::server, role::program, security::cryptography + +Package: i2p +Architecture: all +Section: net +Priority: optional +Depends: java-runtime +Recommends: libgmp3c2 +Description: load-balanced unspoofable packet switching network + I2P is an anonymizing network, offering a simple layer that identity-sensitive + 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 + trusted parties. +Homepage: http://www.i2p2.de +Version: 0.7-0 +Tags: implemented-in::java, interface::daemon, network::client, network::server, role::program, security::cryptography diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000000..0b434e1750 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,8 @@ +everything is released according to the +terms of the I2P license policy. For the I2P SDK, +that means everything contained within this +module is released into the public domain unless +otherwise marked. Alternate licenses that may be +used include BSD (used by thecrypto's DSA, ElGamal, +and SHA256 implementations), Cryptix (used by cryptix's +AES implementation), and MIT. diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000000..6f8aa2c9bf --- /dev/null +++ b/debian/rules @@ -0,0 +1,20 @@ +#!/usr/bin/make -f + +build: + ant preppkg && \ + (cd pkg-temp; chmod +x postinstall.sh) && \ + mkdir -p debian/tmp/var/lib && \ + mkdir -p debian/tmp/etc/init.d && \ + cp -a debian/scripts/init debian/tmp/etc/init.d/i2p && \ + cp -a pkg-temp debian/tmp/var/lib/i2p && \ + touch debian/build +binary: build + mkdir -p debian/tmp/DEBIAN && \ + dpkg-gencontrol && \ + cp -a debian/scripts/postinst debian/scripts/postrm debian/scripts/prerm debian/tmp/DEBIAN && \ + dpkg-deb -b debian/tmp .. +clean: + rm -f debian/build + ant clean + rm -Rf pkg-temp + @exit 0 diff --git a/debian/scripts/init b/debian/scripts/init new file mode 100755 index 0000000000..5d04ac8fed --- /dev/null +++ b/debian/scripts/init @@ -0,0 +1,54 @@ +#! /bin/sh + +### BEGIN INIT INFO +# Provides: i2p +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: +# Default-Stop: 1 2 3 4 5 +# Short-Description: I2P anonymizing mixnet +### END INIT INFO + +set -e + +. /lib/lsb/init-functions + +function I2P { + su i2p -c "/var/lib/i2p/i2prouter $1" +} + +case "$1" in + start) + log_daemon_msg "Starting I2P" "i2p" + if I2P start; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping I2P" "i2p" + if I2P stop; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + restart) + log_daemon_msg "Restarting I2P" "i2p" + if I2P restart; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + status) + I2P status + ;; + + *) + log_action_msg "Usage: /etc/init.d/i2p {start|stop|restart|status}" + exit 1 +esac + +exit 0 diff --git a/debian/scripts/postinst b/debian/scripts/postinst new file mode 100755 index 0000000000..a1f03b83a8 --- /dev/null +++ b/debian/scripts/postinst @@ -0,0 +1,9 @@ +#!/bin/sh +TOP=/var/lib/i2p +useradd -b $TOP -r i2p 2>/dev/null +chown i2p $TOP -R + +update-rc.d + +cd $TOP +exec su i2p -c ./postinstall.sh diff --git a/debian/scripts/postrm b/debian/scripts/postrm new file mode 100755 index 0000000000..633f3a9f42 --- /dev/null +++ b/debian/scripts/postrm @@ -0,0 +1,2 @@ +#!/bin/sh +exec userdel i2p diff --git a/debian/scripts/prerm b/debian/scripts/prerm new file mode 100755 index 0000000000..cd32c37542 --- /dev/null +++ b/debian/scripts/prerm @@ -0,0 +1,2 @@ +#!/bin/sh +exec /etc/init.d/i2p stop -- GitLab