rpms/monotone/devel README.monotone-server, NONE, 1.1 .cvsignore, 1.4, 1.5 monotone.init, 1.2, 1.3 monotone.spec, 1.6, 1.7 monotone.sysconfig, 1.1, 1.2 sources, 1.4, 1.5 monotone-xfail-if-root.patch, 1.1, NONE

Roland McGrath (roland) fedora-extras-commits at redhat.com
Tue Dec 13 07:35:09 UTC 2005


Author: roland

Update of /cvs/extras/rpms/monotone/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv32621

Modified Files:
	.cvsignore monotone.init monotone.spec monotone.sysconfig 
	sources 
Added Files:
	README.monotone-server 
Removed Files:
	monotone-xfail-if-root.patch 
Log Message:
0.24 update copied from FC-4 branch


--- NEW FILE README.monotone-server ---
The Fedora Extras build of monotone provides an extra RPM monotone-server.
This package is intended to make it easy to set up an unattended server
installation for Monotone's Netsync protocol (i.e. "monotone serve").

The package a standard Fedora-style init.d script with chkconfig support
for running the server, installed as /usr/sbin/monotone-server.
(This is just a symlink to monotone that the init script runs instead.
This enables matching "monotone-server" processes with ps to distinguish
server instances from people using monotone.)

The /etc/monotone directory serves as ~/.monotone for the server.  This
directory and its contents are not writable by the "monotone" user ID under
which the network server runs.  The database lives in /var/db/monotone,
which the "monotone" user ID must write to.

The init.d script will generate a private key for the server to use, if
none exists yet.  The key identification will be the host's FQDN (from
/bin/hostname -f).  You can use "service monotone genkey [IDENT]" to
generate the private key by hand and set up the unattended server to use
it, supplying a different key identification string if you like.

Before starting the server, the script will migrate an old database
format if you had a previous version of the monotone-server installation.
(This includes converting private keys from the old format.)
You can always do this explicitly with "service monotone migrate".

Access to the server is controlled by the /etc/monotone/read-permissions and
/etc/monotone/write-permissions files, unless you write your own Lua hooks
in /etc/monotone/monotonerc.  These files are not created or editted by the
RPM scripts, you must create them.  These files refer to key identification
strings for keys already the database.  Anyone allowed write access by the
netwrok server can put new keys in the database with "monotone push" using
the --key-to-push option.  To bootstrap this, /etc/monotone/write-permission
must allow some key and that key must be in the database already.  You can
put a key in the server's database easily with "service monotone import",
e.g. to import the public key for a private key in ~/.monotone/keys:

	monotone pubkey me at my.com | sudo service monotone import

For problems with this package or its scripts, please file bugs
at http://bugzilla.redhat.com/ for the "monotone" component
in th "Fedora Extras" product.


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/monotone/devel/.cvsignore,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- .cvsignore	4 Oct 2005 03:45:52 -0000	1.4
+++ .cvsignore	13 Dec 2005 07:35:07 -0000	1.5
@@ -1 +1 @@
-monotone-0.23.tar.gz
+monotone-0.24.tar.gz


Index: monotone.init
===================================================================
RCS file: /cvs/extras/rpms/monotone/devel/monotone.init,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- monotone.init	4 Oct 2005 03:45:02 -0000	1.2
+++ monotone.init	13 Dec 2005 07:35:07 -0000	1.3
@@ -7,7 +7,7 @@
 # processname: monotone-server
 # pidfile: /var/run/monotone-server.pid
 # config: /etc/sysconfig/monotone
-# config: /etc/monotonerc
+# config: /etc/monotone/monotonerc
 
 # Source function library.
 . /etc/rc.d/init.d/functions
@@ -31,7 +31,7 @@
 random_passphrase()
 {
 	# As of 0.22, 32 chars is the maximum pass phrase length.
-	dd if=/dev/urandom count=1 2> /dev/null | md5sum |
+	dd if=/dev/urandom bs=32 count=1 2> /dev/null | md5sum |
 	{ read sum rest; echo $sum; }
 }
 
@@ -40,8 +40,16 @@
 # See how we were called.
 case "$1" in
   start)
-	[ -e $MONOTONE_DBFILE ] || { $0 init && $0 genkey; }
+	if [ -e $MONOTONE_DBFILE ]; then
+		$0 migrate
+	else
+		$0 init
+	fi
 	RETVAL=$?
+	if [ $RETVAL = 0 ] && [ "x`ls $MONOTONE_KEYDIR`" = x ]; then
+		$0 genkey
+		RETVAL=$?
+	fi
 	if [ $RETVAL = 0 ]; then
 		# Start daemon.
 		echo -n $"Starting monotone server: "
@@ -60,7 +68,7 @@
         ;;
   stop)
         # Stop daemons.
-        echo -n "Stopping monotone server: "
+        echo -n $"Stopping monotone server: "
         killproc $MTSERVER
         RETVAL=$?
         [ $RETVAL = 0 ] && rm -f /var/lock/subsys/monotone
@@ -78,7 +86,7 @@
 	RETVAL=$?
 	;;
   init)
-	echo -n $"Initializing $MONOTONE_DBFILE: "
+	echo -n $"Initializing database" "$MONOTONE_DBFILE" ": "
 	{ [ -d /var/db/monotone ] ||
  	  /usr/bin/install -o ${MONOTONE_USER:-monotone} \
 			   -g ${MONOTONE_GROUP:-monotone} \
@@ -91,7 +99,7 @@
 	echo
 	;;
   genkey)
-	MONOTONE_KEYID=${MONOTONE_KEYID:-`/bin/hostname -f`}
+	MONOTONE_KEYID=${2:-${MONOTONE_KEYID:-`/bin/hostname -f`}}
 	MONOTONE_PPFILE=${MONOTONE_PPFILE:-/var/db/monotone/passphrase.lua}
 	echo -n $"Generating RSA key for server $MONOTONE_KEYID"
 	tmp=/tmp/mtserver$$
@@ -106,9 +114,8 @@
   return "$passphrase"
 end
 EOF
-		/usr/bin/install -o ${MONOTONE_USER:-monotone} \
-		    		 -g ${MONOTONE_GROUP:-monotone} \
-				 -m 0600 $tmp ${MONOTONE_PPFILE}
+		/usr/bin/install -o root -g ${MONOTONE_GROUP:-monotone} \
+				 -m 0440 $tmp ${MONOTONE_PPFILE}
 	then
 		success $"key generation"
 	else
@@ -118,8 +125,47 @@
 	rm -f $tmp
 	echo
 	;;
+  migrate)
+  	oppfile=/var/db/monotone/passphrase.lua
+	RETVAL=0
+	if [ ! -e $MONOTONE_PPFILE ] && [ -e $oppfile ]; then
+		echo -n $"Moving old server passphrase file to new location: "
+		/usr/bin/install -o root -g ${MONOTONE_GROUP:-monotone} \
+				 -m 0440 $oppfile ${MONOTONE_PPFILE} &&
+		success $"move passphrase file" ||
+		failure $"move passphrase file"
+		RETVAL=$?
+		echo
+	fi
+	[ $RETVAL -eq 0 ] || exit $RETVAL
+	# Note this must run as root in case migration is writing
+	# into /etc/monotone/private-keys.
+	echo $"Checking database format in" "${MONOTONE_DBFILE}:"
+	(umask 027
+	 $MT $MONOTONE_RCOPTS $MONOTONE_DBOPTS $MONOTONE_PPOPTS db migrate &&
+	 /bin/chgrp -R ${MONOTONE_GROUP:-monotone} $MONOTONE_KEYDIR)
+		success $"database check" ||
+		failure $"database check"
+	RETVAL=$?
+	echo
+	;;
+  # Use "monotone pubkey me at my.com | service monotone import"
+  # to import the first keys to enable in /etc/monotone/write-permission.
+  # Thereafter, those with write permission can add other keys via
+  # netsync with "monotone push --key-to-push=IDENT" and then IDENT
+  # can be used in the read-permission and write-permission files.
+  import)
+	echo -n $"Importing packets to monotone database: "
+	runuser -s /bin/bash - ${MONOTONE_USER:-monotone} -c "umask 007; \
+		$MT $MONOTONE_RCOPTS $MONOTONE_DBOPTS read" &&
+		success $"packet import" ||
+		failure $"packet import"
+	RETVAL=$?
+	echo
+	;;
   *)
-	echo "Usage: $0 {start|stop|restart|status|condrestart|init|genkey}"
+	echo "\
+Usage: $0 {start|stop|restart|status|condrestart|init|import|genkey [IDENT]}"
 	RETVAL=1
 	;;
 esac


Index: monotone.spec
===================================================================
RCS file: /cvs/extras/rpms/monotone/devel/monotone.spec,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- monotone.spec	4 Oct 2005 03:45:02 -0000	1.6
+++ monotone.spec	13 Dec 2005 07:35:07 -0000	1.7
@@ -1,5 +1,5 @@
 Name: monotone
-Version: 0.23
+Version: 0.24
 Release: 1%{?dist}
 
 Summary: A free, distributed version control system
@@ -10,14 +10,12 @@
 Source0: http://www.venge.net/monotone/downloads/%{name}-%{version}.tar.gz
 Source1: monotone.init
 Source2: monotone.sysconfig
-
-Patch1: monotone-xfail-if-root.patch
+Source3: README.monotone-server
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires: zlib-devel
 BuildRequires: boost-devel >= 1.32.0
-BuildRequires: lua
 %if 1
 %define bundled_sqlite yes
 %else
@@ -25,6 +23,11 @@
 BuildRequires: sqlite-devel >= 3.2.7
 %define bundled_sqlite no
 %endif
+# monotone has local hacks in lua 5.0.2 as well, sigh.
+%define bundled_lua 1
+%if %{bundled_lua} == 0
+BuildRequires: lua
+%endif
 
 # The test suite needs cvs.
 BuildRequires: cvs
@@ -56,10 +59,9 @@
 %prep
 %setup -q
 
-%patch1 -p1
-
 %build
-%configure --with-bundled-lua=no --with-bundled-sqlite=%{bundled_sqlite}
+%configure --with-bundled-lua=%{bundled_lua} \
+	   --with-bundled-sqlite=%{bundled_sqlite}
 make %{?_smp_mflags}
 
 %check
@@ -84,14 +86,21 @@
 ln -snf ../bin/monotone %{buildroot}%{_sbindir}/monotone-server
 %{__install} -c -m 0555 %{SOURCE1} %{buildroot}/etc/init.d/monotone
 %{__install} -c -m 0644 %{SOURCE2} %{buildroot}/etc/sysconfig/monotone
-%{__install} -c -m 0644 /dev/null %{buildroot}/etc/monotonerc
+%{__install} -d -m 0755 %{buildroot}/etc/monotone
+%{__install} -d -m 0750 %{buildroot}/etc/monotone/private-keys
 %{__install} -d -m 0770 %{buildroot}/var/db/monotone
 
 # These do not actually wind up in the package, due to %%ghost.
+%{__install} -c -m 0440 /dev/null %{buildroot}/etc/monotone/passphrase.lua
+%{__install} -c -m 0640 /dev/null %{buildroot}/etc/monotone/read-permissions
+%{__install} -c -m 0640 /dev/null %{buildroot}/etc/monotone/write-permissions
+%{__install} -c -m 0644 /dev/null %{buildroot}/etc/monotone/monotonerc
 touch %{buildroot}/var/db/monotone/server.db
-touch %{buildroot}/var/db/monotone/passphrase.lua
+
+cp %{SOURCE3} .
 
 %clean
+rm -f README.monotone-server
 rm -rf %{buildroot}
 
 %post
@@ -118,14 +127,20 @@
 
 
 %files server
+%doc README.monotone-server
 %defattr(-,root,root,-)
 %{_sbindir}/monotone-server
 /etc/init.d/monotone
-%config(noreplace) /etc/sysconfig/monotone
-%config(noreplace) /etc/monotonerc
+%config /etc/sysconfig/monotone
+%dir %attr(0755,root,monotone) /etc/monotone
+%dir %attr(0750,root,monotone) /etc/monotone/private-keys
+%attr(0640,root,monotone) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/monotone/monotonerc
+%attr(0440,root,monotone) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/monotone/passphrase.lua
+%attr(0640,root,monotone) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/monotone/read-permissions
+%attr(0640,root,monotone) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/monotone/write-permissions
+ %attr(0750,root,monotone) /etc/monotone/private-keys
 %dir %attr(0770,monotone,monotone) /var/db/monotone
 %attr(0660,monotone,monotone) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/monotone/server.db
-%attr(0600,monotone,monotone) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/monotone/passphrase.lua
 
 %pre server
 # Add the "monotone" user
@@ -136,6 +151,9 @@
 # Register the monotone service
 /sbin/chkconfig --add monotone
 
+# Restart the running server, which will update its db format when needed.
+/sbin/service monotone condrestart
+
 %preun server
 if [ $1 = 0 ]; then
 	/sbin/service monotone stop > /dev/null 2>&1
@@ -144,6 +162,9 @@
 
 
 %changelog
+* Sun Dec 11 2005 Roland McGrath <roland at redhat.com> - 0.24-1
+- Updated for 0.24 release.
+
 * Mon Oct  3 2005 Roland McGrath <roland at redhat.com> - 0.23-1
 - Updated for 0.23 release.
 


Index: monotone.sysconfig
===================================================================
RCS file: /cvs/extras/rpms/monotone/devel/monotone.sysconfig,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- monotone.sysconfig	23 Aug 2005 07:04:05 -0000	1.1
+++ monotone.sysconfig	13 Dec 2005 07:35:07 -0000	1.2
@@ -1,9 +1,10 @@
-MONOTONERC=/etc/monotonerc
+MONOTONE_CONFDIR=/etc/monotone
+MONOTONE_KEYDIR=/etc/monotone/private-keys
 MONOTONE_DBFILE=/var/db/monotone/server.db
-MONOTONE_PPFILE=/var/db/monotone/passphrase.lua
+MONOTONE_PPFILE=/etc/monotone/passphrase.lua
 
-MONOTONE_RCOPTS="--norc --rcfile=$MONOTONERC"
-MONOTONE_DBOPTS="--db=$MONOTONE_DBFILE"
+MONOTONE_RCOPTS="--confdir=$MONOTONE_CONFDIR"
+MONOTONE_DBOPTS="--db=$MONOTONE_DBFILE --keydir=$MONOTONE_KEYDIR"
 MONOTONE_PPOPTS="--rcfile=$MONOTONE_PPFILE"
 
-MONOTONE_SERVE_OPTS="0.0.0.0 '*'"
+MONOTONE_SERVE_OPTS="'*'"


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/monotone/devel/sources,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- sources	4 Oct 2005 03:45:02 -0000	1.4
+++ sources	13 Dec 2005 07:35:07 -0000	1.5
@@ -1 +1 @@
-6d9e909480c2be0b23e2820c3a42e6f1  monotone-0.23.tar.gz
+8193203c8b48104500d956f9e524bfcd  monotone-0.24.tar.gz


--- monotone-xfail-if-root.patch DELETED ---




More information about the scm-commits mailing list