Merge in Tom's Windows work
authorPaul Crowley <paul@lshift.net>
Thu, 23 Aug 2012 17:52:15 +0100
changeset 355 63d8fe4e9450
parent 354 70d9be61232d (current diff)
parent 349 b271be84da5e (diff)
child 356 22561975a2aa
Merge in Tom's Windows work
--- a/Makefile	Thu Aug 23 17:50:02 2012 +0100
+++ b/Makefile	Thu Aug 23 17:52:15 2012 +0100
@@ -5,7 +5,7 @@
 DOCDIR=$(PREFIX)/doc/mercurial-server
 ETCDIR=/etc/mercurial-server
 NEWUSER=hg
-DOCBOOK_XSL=/usr/share/xml/docbook/stylesheet/nwalsh
+DOCBOOK_XSL?=/usr/share/xml/docbook/stylesheet/nwalsh
 
 INSTALL=install
 
@@ -16,6 +16,9 @@
 # WARNING: this is experimental
 setup-useradd: installfiles useradd inituser
 
+# WARNING: this is experimental
+setup-windows: installfiles adduser-windows
+
 installetc:
 	$(INSTALL) -d $(DESTDIR)$(ETCDIR)
 	$(INSTALL) -m 644 -t $(DESTDIR)$(ETCDIR) \
@@ -63,6 +66,17 @@
 	    --home /var/lib/mercurial-server --create-home \
 	    --comment  "Mercurial repositories" $(NEWUSER)
 
+# WARNING: this is experimental
+adduser-windows:
+	net user $(NEWUSER) /add
+
 inituser:
 	su -l -c "$(DESTDIR)$(LIBDIR)/init/hginit $(DESTDIR)$(LIBDIR)" $(NEWUSER)
 
+# WARNING: this is experimental
+inituser-windows:
+	mkdir /home/$(NEWUSER)
+	chown $(NEWUSER) /home/$(NEWUSER)
+	chmod 755 $(DESTDIR)$(LIBDIR)/init/*
+	ssh $(NEWUSER)@localhost "sh $(DESTDIR)$(LIBDIR)/init/hginit $(DESTDIR)$(LIBDIR)"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README-windows.txt	Thu Aug 23 17:52:15 2012 +0100
@@ -0,0 +1,58 @@
+Windows setup for mercurial-server
+==================================
+
+WARNING: Windows is *not* a supported system. We've gotten this guide to work ok
+but the permissions are still broken in various ways to do with the underlying
+issues in Windows' permissions system. Unix-based systems, especially Debian and
+derivatives are still the main target. Patches to this guide to improve the
+support are welcome however!
+
+1) Install Cygwin (http://cygwin.com/) using the setup.exe from there. Tested
+against 1.7.12-1, may work with earlier versions. You'll need the base install
+plus the following additional packages:
+
+- docbook-xsl
+- libxslt
+- make
+- mercurial
+- openssh
+- python
+  
+Note that even if you've already got them installed in Windows, Python and
+Mercurial still need to be installed in Cygwin.
+
+2) Open a new Cygwin terminal as Adminstrator (under Windows 7, that's right
+click on "Cygwin Terminal" start menu option and pick "Run as administrator")
+
+3) Run "ssh-host-config -y" and "cygrunsrv -S sshd" to get sshd running. We need
+this because there's no proper su in Cygwin (see
+http://cygwin.com/faq-nochunks.html#faq.using.su for why this is)
+
+3) Goto the mercurial-server folder and "sh windows.sh setup-windows"
+
+4) Run "passwd hg" and set the password for the hg user (created by
+setup-windows), then "mkpasswd -l > /etc/passwd" to add them to the Cygwin user
+database
+
+5) Run "sh windows.sh inituser-windows" to finish setting up the hg user
+
+5) Following the example from the main mercurial-server documentation (in that
+the server is called 'jeeves', your username is 'jay' and the client is called
+'spoon'), but with a few differences for Cygwin, we can now get you initial
+access. We assume that you've generated a key with PuTTYgen
+(http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) and then
+copied the contents of the "public key" box into a file called my-key. Run the
+following, altered as appropriate for your local system:
+
+  mkdir -p /etc/mercurial-server/keys/root/jay
+  cp my-key /etc/mercurial-server/keys/root/jay/spoon
+  chown hg /etc/mercurial-server/keys/root/jay/spoon
+  ssh hg@localhost /usr/local/share/mercurial-server/refresh-auth
+
+The rest of the instructions in the normal mercurial-server documentation should
+now work. Note that although it's possible to add keys/access info to
+/etc/mercurial-server it's much easier to do things via the hgadmin repository,
+and doing things via /etc should probably be limited to only if you mess up the
+setup in hgadmin.
+
+# vim: tw=80 fo=cqt wm=0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windows.sh	Thu Aug 23 17:52:15 2012 +0100
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+DOCBOOK_XSL=/usr/share/sgml/docbook/xsl-stylesheets make $@
+