#!/sbin/runscript # Copyright 2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License, v2 or later # $Header: /var/cvsroot/gentoo-x86/dev-util/monotone/files/monotone-0.33.initd,v 1.1 2007/03/13 20:58:40 dragonheart Exp $ opts="import" depend() { need net } # Substitute common default values MTN_KEY=${MTN_KEY:-monotone@`hostname --fqdn`} MTN_CONFDIR=${MTN_CONFDIR:-/etc/monotone} MTN_COMMON="--norc --confdir=${MTN_CONFDIR} \ --keydir=${MTN_KEYDIR:-/var/lib/monotone/keys} \ --db=${MTN_DB:-/var/lib/monotone/default.mtn} \ --rcfile=${MTN_CONFDIR}/hooks.lua --log=/var/log/monotone/monotone.log" #--dump=$ERRORLOG MTN_PIDFILE="/var/run/monotone/monotone.pid" dbexists() { # Create the database if it doesn't exist if [ ! -e ${MTN_DB:-/var/lib/monotone/default.mtn} ]; then ebegin "Creating monotone database" start-stop-daemon --start \ --chuid ${MTN_USER:-monotone}:${MTN_GROUP:-monotone} \ --exec /usr/bin/mtn -- ${MTN_COMMON} db init eend $? fi if [ ! -e ${MTN_KEYDIR:-/var/lib/monotone/keys}/${MTN_KEY} ]; then ebegin "Creating monotone server keypair" export MTN_PWD=${RANDOM} yes "${MTN_PWD}" | \ start-stop-daemon --start \ --chuid ${MTN_USER:-monotone}:${MTN_GROUP:-monotone} \ --exec /usr/bin/mtn -- ${MTN_COMMON} genkey ${MTN_KEY} eend $? # Update the password lua hook cat > ${MTN_CONFDIR}/passphrase.lua <