Makefile
changeset 168 f9bf8f84df7f
child 169 6b34a5421330
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Mon Nov 09 15:46:05 2009 +0000
@@ -0,0 +1,57 @@
+#!/usr/bin/env make -f
+
+PREFIX=/usr/local/share
+LIBDIR=$(PREFIX)/mercurial-server
+DOCDIR=$(PREFIX)/doc/mercurial-server
+ETCDIR=/etc/mercurial-server
+NEWUSER=hg
+
+INSTALL=install
+
+setup-adduser: installfiles adduser inituser
+
+# WARNING: this is experimental
+setup-useradd: installfiles useradd inituser
+
+installetc:
+	$(INSTALL) -d $(ETCDIR)
+	$(INSTALL) -m 644 -t $(ETCDIR) \
+	    src/init/conf/remote-hgrc src/init/conf/access.conf
+	$(INSTALL) -d $(ETCDIR)/keys/root
+	$(INSTALL) -d $(ETCDIR)/keys/user
+
+installdoc: build/html/index.html
+	$(INSTALL) -d $(DOCDIR)
+	$(INSTALL) -m 644 -t $(DOCDIR) README build/html/index.html
+
+build/html/index.html: doc/manual.docbook
+	xsltproc -o $@ /usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl $^
+
+pythonbuild:
+	python setup.py build
+
+build: build/html/index.html pythonbuild
+
+pythoninstall:
+	python setup.py install \
+	    --install-purelib=$(LIBDIR) \
+	    --install-platlib=$(LIBDIR) \
+	    --install-scripts=$(LIBDIR) \
+	    --install-data=$(LIBDIR)
+
+installfiles: installetc installdoc pythoninstall 
+
+adduser:
+	adduser --system --shell /bin/sh --group --disabled-password \
+	    --home /var/lib/mercurial-server \
+	    --gecos  "Mercurial repositories" $(NEWUSER)
+
+# WARNING: this is experimental
+useradd:
+	useradd --system --shell /bin/sh \
+	    --home /var/lib/mercurial-server --create-home \
+	    --comment  "Mercurial repositories" $(NEWUSER)
+
+inituser:
+	su -l -c "$(LIBDIR)/init/hginit $(LIBDIR)" $(NEWUSER)
+