Debianization

Add debian directory and configuration file to build a Debian package

darcs-hash:20060731213546-86b55-bbbde5940d66f28aa64317cc993906e14b39b229.gz
This commit is contained in:
David Rousselie
2006-07-31 23:35:46 +02:00
parent dba8267b62
commit d3662e34b8
18 changed files with 544 additions and 0 deletions

49
debian/README.Debian vendored Normal file
View File

@@ -0,0 +1,49 @@
jmc for Debian
--------------
- edit /etc/jabber/jmc.xml to match jabber server configuration :
- for jabberd2, port must match router.xml port
- for ejabberd, add new listening port :
{5347, ejabberd_service, [{access, all},
{host, "jmc.localhost",
[{password, "secret"}]}]}
- then run:
# /etc/init.d/jmc start
Usage:
- Now you can register new mail server connection with your favorite
jabber client.
- all connection are then listed under your service browser and you
can edit mail server parameters by registering on listed connection.
Feedback:
Send me feedback and comments to dax at happycoders dot org
Utils:
- jmc_converter convert from one storage type to another.
$ jmc_converter
-> give you the list of supported types.
Example of usage :
$ jmc_converter \
DBM \
registered.db \
SQLite \
registered.sqlite
-> converts a DBM file (registered.db) to a SQLite file
(registered.sqlite). Once converted, the new file copied in
${spool_dir}/${service}/registered.db where ${spool_dir} and
${service} are defined in jmc.xml configuration file.
- jmc_dump dump a db file. example :
$ jmc_dump DBM registered.db
-- David Rousselie <dax@happycoders.org>, Wed, 26 Jul 2006 22:04:38 +0200

6
debian/changelog vendored Normal file
View File

@@ -0,0 +1,6 @@
jmc (0.2.2-1) unstable; urgency=low
* Initial Debian release
-- David Rousselie <dax@happycoders.org> Wed, 26 Jul 2006 23:07:24 +0200

1
debian/compat vendored Normal file
View File

@@ -0,0 +1 @@
4

2
debian/conffiles vendored Normal file
View File

@@ -0,0 +1,2 @@
/etc/default/jmc
/etc/jabber/jmc.conf

13
debian/control vendored Normal file
View File

@@ -0,0 +1,13 @@
Source: jmc
Section: python
Priority: optional
Maintainer: David Rousselie <dax@happycoders.org>
Build-Depends: debhelper (>= 4.1.0)
Standards-Version: 3.6.2
Package: jmc
Architecture: all
Depends: ${python:Depends}, python-pyxmpp (>= 0.5)
Recommends: python2.4-pysqlite2 (>= 2.0)
Description: JMC is an email gateway for Jabber
JMC is a jabber service to check email from POP3 and IMAP4 server and retrieve them or just a notification of new emails. Jabber users can register multiple email accounts.

26
debian/copyright vendored Normal file
View File

@@ -0,0 +1,26 @@
This package was debianized by David Rousselie <dax@happycoders.org> on
Wed, 26 Jul 2006 22:04:38 +0200.
It was downloaded from http://people.happycoders.org/dax/jabber/jmc.html
Copyright Holder: David Rousselie <dax@happycoders.org>
License:
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this package; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.

7
debian/dirs vendored Normal file
View File

@@ -0,0 +1,7 @@
var/run/jabber
var/log/jabber
var/spool/jabber
etc/default
etc/jabber
usr/share/jmc
usr/bin

2
debian/docs vendored Normal file
View File

@@ -0,0 +1,2 @@
README
TODO

147
debian/init.d vendored Executable file
View File

@@ -0,0 +1,147 @@
#! /bin/bash -e
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
# ----- load init-functions if they exist -----
if [ -f /lib/lsb/init-functions ]; then
. /etc/lsb-release
. /lib/lsb/init-functions
fi
# ----- Functions for printing messages (Works for debian and looks good in ubuntu too)
log_start()
{
case $DISTRIB_ID.$DISTRIB_RELEASE in
Ubuntu.[0-4].*|Ubuntu.5.[0-9]|Ubuntu.5.10)
log_begin_msg $1
;;
Ubuntu.*.*)
log_daemon_msg $1
;;
*)
echo -n $1
;;
esac
}
log_end()
{
case $DISTRIB_ID.$DISTRIB_RELEASE in
Ubuntu.*.*)
log_end_msg $1
;;
*)
if [ "$1" = "0" ]; then
echo "Started"
else
echo "Error starting daemon, check the logs."
fi
;;
esac
}
log_failure()
{
case $DISTRIB_ID.$DISTRIB_RELEASE in
Ubuntu.*.*)
log_failure_msg $1
;;
*)
echo $1
;;
esac
}
# ----- set required environment -----
TRANS_NAME=jmc
TRANS_DESC="Jabber Mail Component"
TRANS_HOME=/usr/share/$TRANS_NAME
TRANS_CONFIG=/etc/jabber/$TRANS_NAME.conf
TRANS_USER=jabber
TRANS_GROUP=daemon
TRANS_PID=`grep "<pidfile>.*</pidfile>" $TRANS_CONFIG | sed 's:.*<pidfile>\(.*\)</pidfile>.*:\1:'`
TRANS_DAEMON=/usr/bin/jmc
TRANS_START="--chuid $TRANS_USER:$TRANS_GROUP --chdir $TRANS_HOME --pidfile $TRANS_PID"
TRANS_STOP="--pidfile $TRANS_PID"
TRANS_OPTIONS="-c $TRANS_CONFIG"
TRANSPORT_DEFAULTS_FILE=/etc/default/$TRANS_NAME
# ----- Check if transport is enabled -----
if [ -s $TRANSPORT_DEFAULTS_FILE ]; then
. $TRANSPORT_DEFAULTS_FILE
case "x$ENABLE" in
xtrue) ;;
xfalse)
exit 0
;;
*)
log_failure "Value of ENABLE in $TRANSPORT_DEFAULTS_FILE must be either 'true' or 'false';"
log_failure "not starting $TRANS_NAME daemon."
exit 0
;;
esac
else
log_failure "$TRANSPORT_DEFAULTS_FILE not found. Not starting $TRANS_NAME daemon."
exit 1
fi
# ----- do the action -----
case "$1" in
config)
echo "Configuration:"
echo " TRANS_NAME=$TRANS_NAME"
echo " TRANS_DESC=$TRANS_DESC"
echo " TRANS_HOME=$TRANS_HOME"
echo " TRANS_CONFIG=$TRANS_CONFIG"
echo " TRANS_USER=$TRANS_USER"
echo " TRANS_PID=$TRANS_PID"
echo " TRANS_DAEMON=$TRANS_DAEMON"
echo " TRANS_OPTIONS=$TRANS_OPTIONS"
;;
console)
$TRANS_DAEMON $TRANS_OPTIONS
;;
start)
log_start "Starting $TRANS_DESC: "
if start-stop-daemon $TRANS_START --start --oknodo --exec $TRANS_DAEMON -- $TRANS_OPTIONS $DAEMON_OPTS >/dev/null 2>&1; then
log_end 0
else
log_end 1
fi
;;
stop)
log_start "Stopping $TRANS_DESC: "
if start-stop-daemon --stop $TRANS_STOP --retry 10 --oknodo 2>&1; then
log_end 0
else
log_end 1
fi
;;
reload|force-reload)
log_start "Reloading $TRANS_DESC: "
if start-stop-daemon --stop $TRANS_STOP --signal HUP >/dev/null 2>&1; then
log_end 0
else
log_end 1
fi
;;
restart)
$0 stop
sleep 5
$0 start
;;
*)
echo "Usage: /etc/init.d/$TRANS_NAME {config|console|start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0

10
debian/jmc-default vendored Normal file
View File

@@ -0,0 +1,10 @@
# Defaults for jmc initscript
# sourced by /etc/init.d/jmc
# installed at /etc/default/jmc by the maintainer scripts
ENABLE="false"
# Additional options that are passed to the Daemon.
# use this line to activate debug
#DAEMON_OPTS="-D"
DAEMON_OPTS=""

22
debian/jmc.conf vendored Normal file
View File

@@ -0,0 +1,22 @@
<config>
<jabber>
<server>127.0.0.1</server>
<port>5347</port>
<secret>secret</secret>
<service>jmc.localhost</service>
<connectsleep>5</connectsleep>
<!-- check jmc/utils/lang.py for available languages -->
<language>en</language>
<vCard>
<FN>Jabber Mail Component</FN>
<DESC>A Jabber mail server component</DESC>
<URL>http://people.happycoders.org/dax/jabber/jmc/</URL>
</vCard>
</jabber>
<storage>DBM</storage>
<spooldir>/var/spool/jabber</spooldir>
<pidfile>/var/run/jabber/jmc.pid</pidfile>
<!-- default check interval in minutes -->
<check_interval>5</check_interval>
<mail_default_encoding>iso-8859-1</mail_default_encoding>
</config>

3
debian/jmc.sh vendored Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
python /usr/share/jmc/jmc.py $* &

65
debian/postinst vendored Executable file
View File

@@ -0,0 +1,65 @@
#! /bin/sh
# postinst script for jabber-pyaim
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
case "$1" in
configure)
uid=`getent passwd jabber | cut -d ":" -f 3`
# if there is the uid the account is there and we can do
# the sanit(ar)y checks otherwise we can safely create it.
if [ "$uid" ]; then
# guess??? the checks!!!
if [ $uid -ge 100 ] && [ $uid -le 999 ]; then
echo "jabber uid check: ok"
else
echo "ERROR: jabber account has a non-system uid!"
exit 1
fi
else
adduser --quiet \
--system \
--disabled-password \
--home /var/run/jabber \
--no-create-home \
--shell /bin/false \
jabber
fi
chown jabber:daemon /var/spool/jabber
chown jabber:daemon /var/run/jabber
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

38
debian/postrm vendored Executable file
View File

@@ -0,0 +1,38 @@
#! /bin/sh
# postrm script for jabber-pyaim
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

38
debian/preinst vendored Executable file
View File

@@ -0,0 +1,38 @@
#! /bin/sh
# preinst script for jabber-pyaim
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
#
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
install|upgrade)
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

38
debian/prerm vendored Executable file
View File

@@ -0,0 +1,38 @@
#! /bin/sh
# prerm script for jabber-pyaim
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
remove|upgrade|deconfigure)
;;
failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

76
debian/rules vendored Executable file
View File

@@ -0,0 +1,76 @@
#!/usr/bin/make -f
# jmc debian/rules file
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
configure: configure-stamp
configure-stamp:
dh_testdir
touch configure-stamp
build: build-stamp
build-stamp: configure-stamp
dh_testdir
touch build-stamp
clean:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
# Clean up package tree
rm -f -R $(CURDIR)/debian/jmc
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
# Create directory tree for package
cp -R $(CURDIR)/debian/jmc.conf $(CURDIR)/debian/jmc/etc/jabber/jmc.conf
cp -R $(CURDIR)/debian/jmc-default $(CURDIR)/debian/jmc/etc/default/jmc
cp -R $(CURDIR)/debian/jmc.sh $(CURDIR)/debian/jmc/usr/bin/jmc
cp -R $(CURDIR)/src/* $(CURDIR)/debian/jmc/usr/share/jmc
# Build architecture-independent files here.
binary-indep: build install
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
# dh_installexamples
dh_install
# dh_installmenu
# dh_installdebconf
dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
dh_installinit
# dh_installcron
# dh_installinfo
# dh_installman
dh_link
# dh_strip
# dh_compress
dh_fixperms
# dh_perl
dh_python /usr/share/jmc
# dh_makeshlibs
dh_installdeb
# dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
# Build architecture-dependent files here.
binary-arch: build install
# We have nothing to do by default.
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

View File

@@ -64,6 +64,7 @@ def main(config_file = "jmc.xml", isDebug = 0):
print "starting..." print "starting..."
mailcomp.run(1) mailcomp.run(1)
os.remove(config.get_content("config/pidfile"))
except ComponentFatalError,e: except ComponentFatalError,e:
print e print e
print "Aborting." print "Aborting."