--- 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)" -