monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Debian package enhancements


From: Tomas Fasth
Subject: Re: [Monotone-devel] Debian package enhancements
Date: Thu, 19 May 2005 01:26:54 +0200
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matthew, all,

I have a few comments to your suggested patch.

The debian files have changed in repository since the release of
monotone 0.19. You may want to update your patch to reflect those
changes.

I would not recommend to run a monotone service as root. As far as I
know, there's nothing in monotone that require root priviledges.

It seem to me that running monotone in serve mode will only be
applicable to single user machines, right? It seem to me that
monotone can only serve one set of collections given before hand,
and that the network port is not configurable at run time (only at
compile time). In practice this should mean that you can only run
one predefined set of collections on each machine unless you have
more than one ip address bound to the same machine.

Because of this, I am not entirely convinced that the monotone
Debian package should provide a network service "out-of-the-box".

More comments interlaced below.

Matthew A. Nicholson wrote:
> This patch fixes a missing build-dep of texinfo and adds init script
> support for monotone.  This patch is not complete as it does not create
> a hooks file or create a database.  Once I am finished (if ever) I will
> have the necessary postinstall hooks to do those tasks.  If some one
> else feels the need go ahead and build from my work.
> 
> 
> ------------------------------------------------------------------------
> 
> diff -ruN monotone-0.19/debian/control monotone-0.19.new/debian/control
> --- monotone-0.19/debian/control      2005-04-05 00:44:20.000000000 -0500
> +++ monotone-0.19.new/debian/control  2005-05-18 10:31:42.919667632 -0500
> @@ -2,7 +2,7 @@
>  Section: devel
>  Priority: optional
>  Maintainer: graydon hoare <address@hidden>
> -Build-Depends: debhelper (>> 4.0.0), libboost-dev (>= 1.30.2), 
> libboost-regex-dev (>= 1.30.2), libboost-date-time-dev (>= 1.30.2), 
> libboost-test-dev (>= 1.30.2), libboost-filesystem-dev (>= 1.31.0)
> +Build-Depends: debhelper (>> 4.0.0), libboost-dev (>= 1.30.2), 
> libboost-regex-dev (>= 1.30.2), libboost-date-time-dev (>= 1.30.2), 
> libboost-test-dev (>= 1.30.2), libboost-filesystem-dev (>= 1.31.0), texinfo
>  Standards-Version: 3.5.9
>  
>  Package: monotone
> diff -ruN monotone-0.19/debian/monotone.default 
> monotone-0.19.new/debian/monotone.default
> --- monotone-0.19/debian/monotone.default     1969-12-31 18:00:00.000000000 
> -0600
> +++ monotone-0.19.new/debian/monotone.default 2005-05-18 09:58:58.213348392 
> -0500
> @@ -0,0 +1,17 @@
> +# init.d config file for monotone
> +
> +# this must be set to 1 for monotone to start
> +START=0
> +
> +# the address and or port (ADDRESS[:PORT]) monotone should listen on
> +ADDRESS=0.0.0.0
> +
> +# the database to use
> +DB=/var/lib/monotone/default.db
> +
> +# Collections that monotone should serve (seperated by white space)
> +COLLECTIONS="com.collection                     \
> +             com.collection.branch              \
> +             collection.com                     \
> +             collection.com/branch"
> +
> diff -ruN monotone-0.19/debian/monotone.init 
> monotone-0.19.new/debian/monotone.init
> --- monotone-0.19/debian/monotone.init        1969-12-31 18:00:00.000000000 
> -0600
> +++ monotone-0.19.new/debian/monotone.init    2005-05-18 10:02:47.287523824 
> -0500
> @@ -0,0 +1,114 @@
> +#! /bin/sh
> +#
> +# monotone   Monotone server init script.
> +#
> +# Author:    Matthew A. Nicholson <address@hidden>.
> +#
> +# Version:   v0.0.1  March 29, 2005  address@hidden
> +#
> +### BEGIN INIT INFO
> +# Provides: monotone
> +# Required-Start: $network $local_fs
> +# Required-Stop: $network $local_fs
> +# Default-Start: 3 4 5
> +# Default-Stop: 0 1 2 6

Just a side note; The default runlevel in Debian is 2. But you
probably knew that already. I'm not sure why Debian wasn't designed
to use run level 2 for local services and 3 for network services.

> +# Short-Description: Monotone server.
> +### END INIT INFO
> +
> +set -e
> +
> +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
> +DESC="Monotone Server"
> +NAME=monotone
> +DAEMON=/usr/bin/$NAME
> +PIDFILE=/var/run/$NAME.pid
> +SCRIPTNAME=/etc/init.d/$NAME
> +
> +# Gracefully exit if the package has been removed.
> +test -x $DAEMON || exit 0
> +
> +# Read config file 
> +. /etc/default/$NAME

You should not try to read the file if it does not exist. The
following construct is suggested in /etc/init.d/skeleton.

# Read config file if it is present.
#if [ -r /etc/default/$NAME ]
#then
#       . /etc/default/$NAME
#fi

> +
> +if [ $START -ne 1 ]; then

You should test that the $START variable is defined, or at least put
it inside quotes like this:

if [ "$START" -ne 1 ]; then

> +   echo "$NAME configured in /etc/default/monotone not to start."
> +   exit 0
> +fi
> +
> +#
> +#    Function that starts the daemon/service.
> +#
> +d_start() {
> +     start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE \
> +             --exec $DAEMON -- --db=$DB --norc \
> +             --rcfile=/etc/monotone/hooks.lua serve \
> +             $ADDRESS $COLLECTIONS >> /var/log/monotone.log 2>&1 &

There are several things that can break the execution here. Since
the config file is optional you need to check each variable that is
not explicitly set in the script.

Again, there is no need to run this service as root. You could very
well use start-stop-daemon options --chuid and --chroot to minimize
the exposure.

(The rest of the patch have been left out)

Regards
- --
Tomas Fasth <address@hidden>
GnuPG KeyId: 0x9FE8D504
Fingerprint: DC7B 9453 7F26 1BF9 6B21 9F90 C187 7355 9FE8 D504
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCi889wYdzVZ/o1QQRAmPkAJ9bg3YMYrCAU6Ni/iWc+8NKT8ccZwCdHbET
IdAEupgmQ/nEdkJiErk/aHs=
=n3N+
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]