# # # patch "debian/control" # from [fb9efb32c62dd77b37e7e8754e738909c93ff3ec] # to [172323f3eba197bb2a58646fa44b356476b8bbda] # # patch "debian/monotone-server.config" # from [b6ba33d256ae2e8df67ad7bab9a82d7960567278] # to [5cd3762e06ce71153bcfc7c9a79f7b886c5983e0] # # patch "debian/monotone-server.monotone.init" # from [d852cc0f4ba3cc0ef19f67892fe3454139b27747] # to [d075415b2d178503d07eed4d20ff3aa2a9cf4025] # # patch "debian/monotone-server.postinst" # from [d43fc42c6b51df67744169eb7bf9b29b5fa43a08] # to [c38ae4df23546d72e263ab1a954ef43946d8a2aa] # ============================================================ --- debian/control fb9efb32c62dd77b37e7e8754e738909c93ff3ec +++ debian/control 172323f3eba197bb2a58646fa44b356476b8bbda @@ -22,7 +22,8 @@ Architecture: all Package: monotone-server Architecture: all -Depends: monotone (>= ${source:Version}), adduser, ucf (>= 0.28), ${misc:Depends} +Depends: monotone (>= ${source:Version}), adduser, ucf (>= 0.28), + lsb-base (>= 3.0-6), ${misc:Depends} Description: A distributed version (revision) control system Monotone is a free, distributed version control system. It provides fully disconnected operation, manages complete tree versions, keeps ============================================================ --- debian/monotone-server.config b6ba33d256ae2e8df67ad7bab9a82d7960567278 +++ debian/monotone-server.config 5cd3762e06ce71153bcfc7c9a79f7b886c5983e0 @@ -12,22 +12,23 @@ gen_pass () # we only want to change these values on the initial configuration gen_pass () - { - # this algorithm was taken from the advanced bash scripting howto - MATRIX="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" +{ + # this used to use $RANDOM, but dash doesn't have that + # also, the perl version is clearer + MATRIX="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" LENGTH="$1" if [ -z "$LENGTH" ]; then LENGTH=8 fi - PASS="" - n=1 - while [ "$n" -le "$LENGTH" ]; do - PASS="$PASS${MATRIX:$(($RANDOM%${#MATRIX})):1}" - let n+=1 - done - } + PASS=`perl -e ' + @matrix = split //, $ARGV[0]; + $length = $ARGV[1]; + print $matrix[int(rand($#matrix + 1))] for 1..$length; + print "\n"; + ' "$MATRIX" "$LENGTH"` +} case "$1" in configure) ============================================================ --- debian/monotone-server.monotone.init d852cc0f4ba3cc0ef19f67892fe3454139b27747 +++ debian/monotone-server.monotone.init d075415b2d178503d07eed4d20ff3aa2a9cf4025 @@ -1,11 +1,9 @@ #! /bin/sh # # monotone Monotone server init script. # -# Author: Matthew A. Nicholson . +# Author: Matthew A. Nicholson . # -# Version: v0.0.1 March 29, 2005 address@hidden -# ### BEGIN INIT INFO # Provides: monotone # Required-Start: $network $local_fs @@ -27,102 +25,81 @@ ERRORLOG=/var/log/$NAME/error.log MAINLOG=/var/log/$NAME/$EXECNAME.log ERRORLOG=/var/log/$NAME/error.log +# defaults for /etc/default/monotone +START=1 +ADDRESS=0.0.0.0 MTN_HOME=/var/lib/monotone MTN_CONFDIR=/etc/monotone MTN_KEYDIR=$MTN_HOME/keys MTN_DB=$MTN_HOME/default.mtn -START=1 -ADDRESS=0.0.0.0 - # Gracefully exit if the package has been removed. test -x $DAEMON || exit 0 +# Get the logging helpers. +. /lib/lsb/init-functions + # Read config file if [ -r /etc/default/$NAME ]; then . /etc/default/$NAME fi -# -# Function that starts the daemon/service. -# -d_start() { - if [ "$START" -ne 1 ]; then - echo -ne "\n$NAME configured in /etc/default/$NAME not to start" - return 0 - fi +# Function that starts the daemon. +d_start() +{ + if [ "$START" -ne 1 ]; then + log_action_msg "$NAME configured in /etc/default/$NAME not to start" + return 0 + fi - start-stop-daemon --start --quiet --pidfile $PIDFILE --background \ - --exec $DAEMON --chuid monotone --chdir $MTN_HOME -- \ - --confdir=$MTN_CONFDIR --db=$MTN_DB --norc --pid-file=$PIDFILE \ - --log=$MAINLOG --dump=$ERRORLOG \ - --rcfile=$MTN_CONFDIR/hooks.lua --keydir=$MTN_KEYDIR --quiet \ - --bind=$ADDRESS serve -} + log_daemon_msg "Starting $DESC" "$NAME" -# -# Function that stops the daemon/service. -# -d_stop() { - start-stop-daemon --stop --quiet --pidfile $PIDFILE \ - --name $EXECNAME --user monotone \ - && rm $PIDFILE - + if start-stop-daemon --start --quiet --oknodo --background \ + --pidfile $PIDFILE --exec $DAEMON --chuid monotone --chdir $MTN_HOME \ + -- \ + --confdir=$MTN_CONFDIR --db=$MTN_DB --norc --pid-file=$PIDFILE \ + --log=$MAINLOG --dump=$ERRORLOG \ + --rcfile=$MTN_CONFDIR/hooks.lua --keydir=$MTN_KEYDIR --quiet \ + --bind=$ADDRESS serve -# kill `ps x | grep monotone.*serve | grep -v grep | awk -- '{print $1}'` &> /dev/null \ -# or echo "Failed: monotone not running" - + then log_end_msg 0 + else log_end_msg 1 + fi } -# -# Function that sends a SIGHUP to the daemon/service. -# -#d_reload() { -# start-stop-daemon --stop --quiet --pidfile $PIDFILE \ -# --name $NAME --signal 1 -#} +# Function that stops the daemon. +d_stop() +{ + if [ "$START" -ne 1 ]; then + return 0 + fi + + log_daemon_msg "Stopping $DESC" "$NAME" + if start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE \ + --name $EXECNAME --user monotone + then + rm -f $PIDFILE + log_end_msg 0 + else + log_end_msg 1 + fi +} + case "$1" in - start) - echo -n "Starting $DESC: $NAME" - d_start || echo -n ...failed - echo "." - ;; - stop) - echo -n "Stopping $DESC: $NAME" - d_stop || echo -n ...failed - echo "." - ;; - #reload) - # - # If the daemon can reload its configuration without - # restarting (for example, when it is sent a SIGHUP), - # then implement that here. - # - # If the daemon responds to changes in its config file - # directly anyway, make this an "exit 0". - # - # echo -n "Reloading $DESC configuration..." - # d_reload - # echo "done." - #;; - restart|force-reload) - # - # If the "reload" option is implemented, move the "force-reload" - # option to the "reload" entry above. If not, "force-reload" is - # just the same as "restart". - # - echo -n "Stopping $DESC: $NAME" - d_stop || echo -n ...failed - echo "." - echo -n "Starting $DESC: $NAME" - d_start || echo -n ...failed - echo "." - ;; - *) - # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 - exit 1 - ;; + start) + d_start + ;; + stop) + d_stop + ;; + restart|force-reload) + d_stop + d_start + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 + exit 1 + ;; esac ============================================================ --- debian/monotone-server.postinst d43fc42c6b51df67744169eb7bf9b29b5fa43a08 +++ debian/monotone-server.postinst c38ae4df23546d72e263ab1a954ef43946d8a2aa @@ -25,7 +25,7 @@ MTN=/usr/bin/mtn MTN=/usr/bin/mtn -function monotone_check_minimum_previous_version () +monotone_check_minimum_previous_version () { if dpkg --compare-versions "$MTN_VERSION" lt "0.17"; then # monotone version to old to automatically upgrade @@ -38,7 +38,7 @@ function monotone_check_minimum_previous fi } -function monotone_migrate () +monotone_migrate () { if dpkg --compare-versions "$MTN_VERSION" lt "0.33-90.1"; then # upgradable version of monotone @@ -62,7 +62,7 @@ function monotone_migrate () fi } -function monotone_rosterify () +monotone_rosterify () { if dpkg --compare-versions "$MTN_VERSION" lt "0.26"; then # now we need to rosterify @@ -83,7 +83,7 @@ function monotone_rosterify () fi } -function monotone_regenerate_caches () +monotone_regenerate_caches () { if dpkg --compare-versions "$MTN_VERSION" lt "0.31-90.1"; then # now we need to regenerate caches