Commits

Michael Granger committed 0557237 Merge

Re-merged Mahlon's FreeBSD patch

  • Participants
  • Parent commits b4377a6, ab107d3

Comments (0)

Files changed (4)

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

File src/init/dot-mercurial-server

-# 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

File src/init/dot-mercurial-server.tmpl

+# 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