Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
--- a/Makefile Tue Sep 27 16:58:45 2011 +0100
+++ b/Makefile Tue Jul 24 10:48:17 2012 -0700
@@ -5,12 +5,15 @@
DOCDIR=$(PREFIX)/doc/mercurial-server
ETCDIR=/etc/mercurial-server
NEWUSER=hg
+HOMEDIR=/var/lib/mercurial-server
DOCBOOK_XSL=/usr/share/xml/docbook/stylesheet/nwalsh
INSTALL=install
build: build/html/index.html pythonbuild
+setup-freebsd: installetc pythoninstall bsduseradd inituser
+
setup-adduser: installfiles adduser inituser
# WARNING: this is experimental
@@ -18,12 +21,13 @@
installetc:
$(INSTALL) -d $(DESTDIR)$(ETCDIR)
- $(INSTALL) -m 644 -t $(DESTDIR)$(ETCDIR) \
- src/init/conf/access.conf
+ $(INSTALL) -m 644 src/init/conf/access.conf \
+ $(DESTDIR)$(ETCDIR)
$(INSTALL) -d $(DESTDIR)$(ETCDIR)/remote-hgrc.d
- $(INSTALL) -m 644 -t $(DESTDIR)$(ETCDIR)/remote-hgrc.d \
+ $(INSTALL) -m 644 \
src/init/conf/remote-hgrc.d/access.rc \
- src/init/conf/remote-hgrc.d/logging.rc
+ src/init/conf/remote-hgrc.d/logging.rc \
+ $(DESTDIR)$(ETCDIR)/remote-hgrc.d
$(INSTALL) -d $(DESTDIR)$(ETCDIR)/keys/root
$(INSTALL) -d $(DESTDIR)$(ETCDIR)/keys/users
@@ -43,7 +47,12 @@
pythonbuild:
python setup.py build
-pythoninstall:
+dot-mercurial: src/init/dot-mercurial-server.tmpl
+ sed -e "s|_ETCDIR_|$(ETCDIR)|" \
+ src/init/dot-mercurial-server.tmpl \
+ > src/init/dot-mercurial-server
+
+pythoninstall: dot-mercurial
python setup.py install \
--install-purelib=$(DESTDIR)$(LIBDIR) \
--install-platlib=$(DESTDIR)$(LIBDIR) \
@@ -54,15 +63,19 @@
adduser:
adduser --system --shell /bin/sh --group --disabled-password \
- --home /var/lib/mercurial-server \
+ --home $(HOMEDIR) \
--gecos "Mercurial repositories" $(NEWUSER)
# WARNING: this is experimental
useradd:
useradd --system --shell /bin/sh \
- --home /var/lib/mercurial-server --create-home \
+ --home $(HOMEDIR) --create-home \
--comment "Mercurial repositories" $(NEWUSER)
+bsduseradd:
+ pw useradd $(NEWUSER) -c "Mercurial repositories" -m -s /bin/sh \
+ -d $(HOMEDIR)
+
inituser:
- su -l -c "$(DESTDIR)$(LIBDIR)/init/hginit $(DESTDIR)$(LIBDIR)" $(NEWUSER)
+ su $(NEWUSER) -c "$(DESTDIR)$(LIBDIR)/init/hginit $(DESTDIR)$(LIBDIR)" -
--- a/README Tue Sep 27 16:58:45 2011 +0100
+++ b/README Tue Jul 24 10:48:17 2012 -0700
@@ -38,6 +38,12 @@
sudo make setup-useradd
+On FreeBSD, try
+
+ sudo make setup-freebsd \
+ HOMEDIR=/usr/local/mercurial-server \
+ ETCDIR=/usr/local/etc/mercurial-server
+
See doc/manual.docbook for the rest of the documentation.
Paul Crowley, paul@lshift.net, 2011
--- a/src/init/dot-mercurial-server Tue Sep 27 16:58:45 2011 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-# WARNING: a .mercurial-server file in your home directory means
-# that refresh-auth can and will trash your ~/.ssh/authorized_keys file.
-
-[paths]
-repos = ~/repos
-authorized_keys = ~/.ssh/authorized_keys
-keys = /etc/mercurial-server/keys:~/repos/hgadmin/keys
-access = /etc/mercurial-server/access.conf:~/repos/hgadmin/access.conf
-
-[exceptions]
-# Allow the creation of mq repositories by default
-allowdots = .hg/patches
-
-[env]
-# Use a different hgrc for remote pulls - this way you can set
-# up access.py for everything at once without affecting local operations
-
-HGRCPATH = /etc/mercurial-server/remote-hgrc.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/init/dot-mercurial-server.tmpl Tue Jul 24 10:48:17 2012 -0700
@@ -0,0 +1,18 @@
+# WARNING: a .mercurial-server file in your home directory means
+# that refresh-auth can and will trash your ~/.ssh/authorized_keys file.
+
+[paths]
+repos = ~/repos
+authorized_keys = ~/.ssh/authorized_keys
+keys = _ETCDIR_/keys:~/repos/hgadmin/keys
+access = _ETCDIR_/access.conf:~/repos/hgadmin/access.conf
+
+[exceptions]
+# Allow the creation of mq repositories by default
+allowdots = .hg/patches
+
+[env]
+# Use a different hgrc for remote pulls - this way you can set
+# up access.py for everything at once without affecting local operations
+
+HGRCPATH = _ETCDIR_/remote-hgrc.d