Merge lp:~johnf-inodes/bzr/serve-init into lp:~bzr/bzr/trunk-old

Proposed by John Ferlito
Status: Superseded
Proposed branch: lp:~johnf-inodes/bzr/serve-init
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: None lines
To merge this branch: bzr merge lp:~johnf-inodes/bzr/serve-init
Reviewer Review Type Date Requested Status
John A Meinel Needs Information
Review via email: mp+11046@code.launchpad.net

This proposal has been superseded by a proposal from 2009-10-06.

To post a comment you must log in.
Revision history for this message
John Ferlito (johnf-inodes) wrote :

At a debian init script to contrib to run bzr --serve at boot

Revision history for this message
John A Meinel (jameinel) wrote :

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

johnf wrote:
> johnf has proposed merging lp:~johnf-inodes/bzr/serve-init into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
>
> At a debian init script to contrib to run bzr --serve at boot
>

 review: needs_information

If this is just a suggestion script, it seems fine. However, I don't
think we want to default to installing it whenever someone installs bzr.
And from my experience in the past, stuff that gets put into contrib
somehow magically makes its way into my /etc directory. (Witness the
previous 'bash autocompletion' issue.)

So if you can confirm that after adding this the built deb will put it
somewhere in '/usr/share/doc' or something similar rather than directly
into /etc/init.d then I'm happy to bring it in.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqet9AACgkQJdeBCYSNAANIMACgmJmZky7E07T7UIuVvHoozrqL
bVcAn3YAc91z8X0UH/7HR+eHxkIbicyL
=gVS1
-----END PGP SIGNATURE-----

review: Needs Information
Revision history for this message
John Ferlito (johnf-inodes) wrote :

> If this is just a suggestion script, it seems fine. However, I don't
> think we want to default to installing it whenever someone installs bzr.
> And from my experience in the past, stuff that gets put into contrib
> somehow magically makes its way into my /etc directory. (Witness the
> previous 'bash autocompletion' issue.)
>
>
> So if you can confirm that after adding this the built deb will put it
> somewhere in '/usr/share/doc' or something similar rather than directly
> into /etc/init.d then I'm happy to bring it in.

So my intention is indeed to put this into the debian package unless there is serious opposition to it.

I've updated my patch with the bit I forgot which is to make it disabled by default. (Not sure if I need to ask for another merge request since it isn't showing up in the diff).

My opinion is that it is the sort of thing that isn't worth bothering with unless it is easily enabled by editing something like /etc/default/bzr. If it sits in /usr/doc then as a sysadmin I need to check that everytime I upgrade for bigfixes and new functionality etc.

I think having it disabled by default, where enabling it is as simple as editing /etc/default/bzr is an acceptable alternative.

Revision history for this message
Martin Pool (mbp) wrote :

2009/9/3 johnf <email address hidden>:
> I think having it disabled by default, where enabling it is as simple as editing /etc/default/bzr is an acceptable alternative.

I think you want to be pretty careful that people understand it will
make the relevant directory world-readable, unless limited. But aside
from that, it does seem reasonably consistent with debian practice.

--
Martin <http://launchpad.net/~mbp/>

Revision history for this message
Robert Collins (lifeless) wrote :

you need to 'resubmit' to make the diff update.

Policy for Ubuntu is that things installed by default should not listen
on the net, and I definitely think that installing bzr shouldn't start a
server by default.

Either a server specific package, or editing /etc/default/bzr sound fine
to me.

-Rob

Revision history for this message
John Ferlito (johnf-inodes) wrote :

> Policy for Ubuntu is that things installed by default should not listen
> on the net, and I definitely think that installing bzr shouldn't start a
> server by default.

I've added a warning on the defaults file and changed it to listening on localhost by default

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'contrib/debian'
2=== added file 'contrib/debian/default'
3--- contrib/debian/default 1970-01-01 00:00:00 +0000
4+++ contrib/debian/default 2009-09-02 04:31:45 +0000
5@@ -0,0 +1,13 @@
6+# Specify startup options for bzr --serve
7+
8+
9+# Specify a user and group to run as
10+#USER=bzr
11+#GROUP=bzr
12+
13+# Specify the path to the repository
14+#REPO=/srv/bzr
15+
16+# Other arguments
17+# Add --allow-writes for RW access
18+DAEMON_ARGS="--port=0.0.0.0:4155"
19
20=== added file 'contrib/debian/init.d'
21--- contrib/debian/init.d 1970-01-01 00:00:00 +0000
22+++ contrib/debian/init.d 2009-09-02 04:31:45 +0000
23@@ -0,0 +1,132 @@
24+#! /bin/sh
25+### BEGIN INIT INFO
26+# Provides: bzr
27+# Required-Start: $local_fs $remote_fs
28+# Required-Stop: $local_fs $remote_fs
29+# Default-Start: 2 3 4 5
30+# Default-Stop: S 0 1 6
31+# Short-Description: bazaar Smart Server
32+# Description: bazaar Smart Server
33+### END INIT INFO
34+
35+# Author: John Ferlito <johnf@inodes.org>
36+
37+# PATH should only include /usr/* if it runs after the mountnfs.sh script
38+PATH=/usr/sbin:/usr/bin:/sbin:/bin
39+DESC="Bazaar Smart Server"
40+NAME=bzr
41+DAEMON=/usr/bin/$NAME
42+DAEMON_ARGS=""
43+PIDFILE=/var/run/$NAME.pid
44+SCRIPTNAME=/etc/init.d/$NAME
45+
46+USER=bzr
47+GROUP=bzr
48+REPO=/srv/bzr
49+
50+# Exit if the package is not installed
51+[ -x "$DAEMON" ] || exit 0
52+
53+# Read configuration variable file if it is present
54+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
55+
56+# Load the VERBOSE setting and other rcS variables
57+[ -f /etc/default/rcS ] && . /etc/default/rcS
58+
59+# Define LSB log_* functions.
60+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
61+. /lib/lsb/init-functions
62+
63+#
64+# Function that starts the daemon/service
65+#
66+do_start()
67+{
68+ # Return
69+ # 0 if daemon has been started
70+ # 1 if daemon was already running
71+ # 2 if daemon could not be started
72+ start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE \
73+ --chuid $USER:$GROUP --background --exec $DAEMON --test > /dev/null \
74+ || return 1
75+ start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE \
76+ --chuid $USER:$GROUP --background --exec $DAEMON -- \
77+ serve $DAEMON_ARGS --directory $REPO \
78+ || return 2
79+ # Add code here, if necessary, that waits for the process to be ready
80+ # to handle requests from services started subsequently which depend
81+ # on this one. As a last resort, sleep for some time.
82+}
83+
84+#
85+# Function that stops the daemon/service
86+#
87+do_stop()
88+{
89+ # Return
90+ # 0 if daemon has been stopped
91+ # 1 if daemon was already stopped
92+ # 2 if daemon could not be stopped
93+ # other if a failure occurred
94+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
95+ RETVAL="$?"
96+ [ "$RETVAL" = 2 ] && return 2
97+ # Wait for children to finish too if this is a daemon that forks
98+ # and if the daemon is only ever run from this initscript.
99+ # If the above conditions are not satisfied then add some other code
100+ # that waits for the process to drop all resources that could be
101+ # needed by services started subsequently. A last resort is to
102+ # sleep for some time.
103+ start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
104+ [ "$?" = 2 ] && return 2
105+ # Many daemons don't delete their pidfiles when they exit.
106+ rm -f $PIDFILE
107+ return "$RETVAL"
108+}
109+
110+case "$1" in
111+ start)
112+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
113+ do_start
114+ case "$?" in
115+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
116+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
117+ esac
118+ ;;
119+ stop)
120+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
121+ do_stop
122+ case "$?" in
123+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
124+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
125+ esac
126+ ;;
127+ restart|force-reload)
128+ #
129+ # If the "reload" option is implemented then remove the
130+ # 'force-reload' alias
131+ #
132+ log_daemon_msg "Restarting $DESC" "$NAME"
133+ do_stop
134+ case "$?" in
135+ 0|1)
136+ do_start
137+ case "$?" in
138+ 0) log_end_msg 0 ;;
139+ 1) log_end_msg 1 ;; # Old process is still running
140+ *) log_end_msg 1 ;; # Failed to start
141+ esac
142+ ;;
143+ *)
144+ # Failed to stop
145+ log_end_msg 1
146+ ;;
147+ esac
148+ ;;
149+ *)
150+ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
151+ exit 3
152+ ;;
153+esac
154+
155+: