Thu Mar  4 01:02:34 PST 2010  jacob@appelbaum.net
  * debian init and default scripts

Thu Mar  4 01:05:16 PST 2010  jacob@appelbaum.net
  * defaults for init.d script

Thu Mar  4 01:10:27 PST 2010  jacob@appelbaum.net
  * postinst fix

Thu Mar  4 01:15:00 PST 2010  jacob@appelbaum.net
  * getent fixup

Thu Mar  4 01:17:05 PST 2010  jacob@appelbaum.net
  * daemon fixups

Thu Mar  4 01:24:00 PST 2010  jacob@appelbaum.net
  * remove user at dpkg --remove

Thu Mar  4 01:25:46 PST 2010  jacob@appelbaum.net
  * disable the daemon by default

Thu Mar  4 01:26:43 PST 2010  jacob@appelbaum.net
  * only remove user, not group

Thu Mar  4 01:31:37 PST 2010  jacob@appelbaum.net
  * purging user at purge time only

New patches:

[debian init and default scripts
jacob@appelbaum.net**20100304090234] {
addfile ./misc/lenny/debian/allmydata-tahoe.init
hunk ./misc/lenny/debian/allmydata-tahoe.init 1
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          allmydata-tahoe
+# Required-Start:    $remote_fs
+# Required-Stop:     $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Tahoe-LAFS initscript
+# Description:       This starts Tahoe and runs it as a daemon
+### END INIT INFO
+
+# Author: Jacob Appelbaum <jacob@appelbaum.net>
+
+# Do NOT "set -e"
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="Tahoe-LAFS is a secure, decentralized, data store."
+NAME=tahoe
+DEFAULTS=allmydata-tahoe
+DAEMONHOME="/var/lib/tahoelafsd/"
+DAEMON=/usr/bin/$NAME
+DAEMON_ARGS=" start $DAEMONHOME"
+PIDFILE=/var/lib/tahoelafsd/twisted.pid
+USERNAME=tahoelafsd
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$DEFAULTS ] && . /etc/default/$DEFAULTS
+
+# Exit if we're unconfigured
+if [ "$ENABLED" = "FALSE" ]; then
+    echo "Tahoe is disabled; please edit /etc/defaults/$DEFAULTS";
+    exit 0;
+fi
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+	# Return
+	#   2 if daemon could not be started
+	su -c "$DAEMON $DAEMON_ARGS" $USERNAME \
+		|| return 2
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+	# Return
+	#   0 if daemon has been stopped
+	#   1 if daemon was already stopped
+	#   2 if daemon could not be stopped
+        su -c "$DAEMON stop $DAEMONHOME" $USERNAME \
+                || return 2
+	RETVAL="$?"
+	[ "$RETVAL" = 2 ] && return 2
+	return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+	#
+	# If the daemon can reload its configuration without
+	# restarting (for example, when it is sent a SIGHUP),
+	# then implement that here.
+	#
+	echo "Tahoe does not currently support HUP by reloading its config file."
+	return 0
+}
+
+case "$1" in
+  start)
+	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+	do_start
+	case "$?" in
+		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+	esac
+	;;
+  stop)
+	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+	do_stop
+	case "$?" in
+		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+	esac
+	;;
+  #reload|force-reload)
+	#
+	# If do_reload() is not implemented then leave this commented out
+	# and leave 'force-reload' as an alias for 'restart'.
+	#
+	#log_daemon_msg "Reloading $DESC" "$NAME"
+	#do_reload
+	#log_end_msg $?
+	#;;
+  restart|force-reload)
+	#
+	# If the "reload" option is implemented then remove the
+	# 'force-reload' alias
+	#
+	log_daemon_msg "Restarting $DESC" "$NAME"
+	do_stop
+	case "$?" in
+	  0|1)
+		do_start
+		case "$?" in
+			0) log_end_msg 0 ;;
+			1) log_end_msg 1 ;; # Old process is still running
+			*) log_end_msg 1 ;; # Failed to start
+		esac
+		;;
+	  *)
+	  	# Failed to stop
+		log_end_msg 1
+		;;
+	esac
+	;;
+  *)
+	#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+	exit 3
+	;;
+esac
+
+:
addfile ./misc/lenny/debian/allmydata-tahoe.postinst
hunk ./misc/lenny/debian/allmydata-tahoe.postinst 1
+# Automatically added by dh_pycentral
+if which pycentral >/dev/null 2>&1; then
+	pycentral pkginstall allmydata-tahoe
+	if grep -qs '^allmydata-tahoe$' /var/lib/pycentral/delayed-pkgs; then
+		sed -i '/^allmydata-tahoe$/d' /var/lib/pycentral/delayed-pkgs
+	fi
+fi
+# End automatically added section
+# Automatically added by dh_pycentral
+if which pycentral >/dev/null 2>&1; then
+	pycentral pkginstall allmydata-tahoe
+	if grep -qs '^allmydata-tahoe$' /var/lib/pycentral/delayed-pkgs; then
+		sed -i '/^allmydata-tahoe$/d' /var/lib/pycentral/delayed-pkgs
+	fi
+fi
+# End automatically added section
+
+# This checks for a tahoelafsd user
+uid=`getend passwd tahoelafsd | cut -d ":" -f 3`
+home=`getent passwd tahoelafsd |cut -d ":" -f 6`
+
+if [ "$uid" ]; then
+    if [ "$home" = "/var/lib/tahoelafsd" ]; then
+        chmod 750 /var/lib/tahoelafs/
+    else
+        echo "tahoelafsd has an incorrect home directory!"
+    fi
+else
+    echo "Adding tahoelafsd group..."
+    addgroup --system tahoelafsd
+    echo "Adding tahoelafsd user..."
+    adduser --disabled-login --system --home /var/lib/tahoelafs \
+            --shell /bin/bash --ingroup tahoelafsd tahoelafsd 
+    echo "Protecting tahoelafsd home directory from snooping eyes"
+    chmod 750 /var/lib/tahoelafs/
+fi
addfile ./misc/lenny/debian/allmydata-tahoe.postrm
hunk ./misc/lenny/debian/allmydata-tahoe.postrm 1
+#!/bin/sh -e
+
+if [ "$1" = "purge" ]; then
+    rm -rf /var/lib/tahoelafsd/
+fi
+
+exit 0
}

[defaults for init.d script
jacob@appelbaum.net**20100304090516] {
addfile ./misc/lenny/debian/allmydata-tahoe.default
hunk ./misc/lenny/debian/allmydata-tahoe.default 1
+# Defaults for tahoelafsd initscript
+# sourced by /etc/init.d/allmydata-tahoe
+# installed at /etc/default/allmydata-tahoe by the maintainer scripts
+
+# Uncomment these to change the default settings in the init.d script
+# USERNAME="tahoelafsd"
+# DAEMONHOME="/var/lib/tahoelafsd/"
+# DAEMON_ARGS=" start $DAEMONHOME"
+
+# By default, Tahoe is unconfigured
+# (this is very unfriendly to non-power users)
+# To configure Tahoe, consider running:
+# tahoe create-client $DAEMONHOME
+
+# Once you've run the above command, set the following line to "TRUE"
+# to have the init.d script start Tahoe
+ENABLED="TRUE"
+
}

[postinst fix
jacob@appelbaum.net**20100304091027] hunk ./misc/lenny/debian/allmydata-tahoe.postinst 1
+#!/bin/sh -e

[getent fixup
jacob@appelbaum.net**20100304091500] {
hunk ./misc/lenny/debian/allmydata-tahoe.postinst 2
-# Automatically added by dh_pycentral
-if which pycentral >/dev/null 2>&1; then
-	pycentral pkginstall allmydata-tahoe
-	if grep -qs '^allmydata-tahoe$' /var/lib/pycentral/delayed-pkgs; then
-		sed -i '/^allmydata-tahoe$/d' /var/lib/pycentral/delayed-pkgs
-	fi
-fi
-# End automatically added section
-# Automatically added by dh_pycentral
-if which pycentral >/dev/null 2>&1; then
-	pycentral pkginstall allmydata-tahoe
-	if grep -qs '^allmydata-tahoe$' /var/lib/pycentral/delayed-pkgs; then
-		sed -i '/^allmydata-tahoe$/d' /var/lib/pycentral/delayed-pkgs
-	fi
-fi
-# End automatically added section
hunk ./misc/lenny/debian/allmydata-tahoe.postinst 4
-uid=`getend passwd tahoelafsd | cut -d ":" -f 3`
+uid=`getent passwd tahoelafsd | cut -d ":" -f 3`
}

[daemon fixups
jacob@appelbaum.net**20100304091705] {
hunk ./misc/lenny/debian/allmydata-tahoe.postinst 9
-        chmod 750 /var/lib/tahoelafs/
+        chmod 750 /var/lib/tahoelafsd/
hunk ./misc/lenny/debian/allmydata-tahoe.postinst 17
-    adduser --disabled-login --system --home /var/lib/tahoelafs \
+    adduser --disabled-login --system --home /var/lib/tahoelafsd \
hunk ./misc/lenny/debian/allmydata-tahoe.postinst 20
-    chmod 750 /var/lib/tahoelafs/
+    chmod 750 /var/lib/tahoelafsd/
}

[remove user at dpkg --remove
jacob@appelbaum.net**20100304092400] hunk ./misc/lenny/debian/allmydata-tahoe.postrm 3
+delgroup tahoelafsd
+deluser tahoelafsd
+

[disable the daemon by default
jacob@appelbaum.net**20100304092546] hunk ./misc/lenny/debian/allmydata-tahoe.default 17
-ENABLED="TRUE"
+ENABLED="FALSE"

[only remove user, not group
jacob@appelbaum.net**20100304092643] hunk ./misc/lenny/debian/allmydata-tahoe.postrm 3
-delgroup tahoelafsd

[purging user at purge time only
jacob@appelbaum.net**20100304093137] {
hunk ./misc/lenny/debian/allmydata-tahoe.postrm 3
-deluser tahoelafsd
-
hunk ./misc/lenny/debian/allmydata-tahoe.postrm 5
+    deluser tahoelafsd
}

Context:

[CREDITS to Jacob Appelbaum
zooko@zooko.com**20100304015616
 Ignore-this: 70db493abbc23968fcc8db93f386ea54
] 
[desert-island-build-with-proper-versions
jacob@appelbaum.net**20100304013858] 
[docs: a few small edits to try to guide newcomers through the docs
zooko@zooko.com**20100303231902
 Ignore-this: a6aab44f5bf5ad97ea73e6976bc4042d
 These edits were suggested by my watching over Jake Appelbaum's shoulder as he completely ignored/skipped/missed install.html and also as he decided that debian.txt wouldn't help him with basic installation. Then I threw in a few docs edits that have been sitting around in my sandbox asking to be committed for months.
] 
[TAG allmydata-tahoe-1.6.1
david-sarah@jacaranda.org**20100228062314
 Ignore-this: eb5f03ada8ea953ee7780e7fe068539
] 
Patch bundle hash:
48eb3a8ddd4c04f5494873d8c823fbad3e5b3512
