Skip to content
Browse files

Make app.config platform-specific for Debian.

  • Loading branch information...
1 parent 872397f commit caec97c2050036641b57a41d36a7bc6eac7b906f @pmundkur pmundkur committed Feb 20, 2012
Showing with 49 additions and 94 deletions.
  1. +25 −14 Makefile
  2. +20 −6 conf/{gen.settings.sys-Linux → gen.settings}
  3. +0 −35 conf/gen.settings.sys-Darwin
  4. +0 −39 conf/gen.settings.sys-Debian
  5. +4 −0 mk/mk.Debian
View
39 Makefile
@@ -22,15 +22,10 @@ TARGETLIB = $(DESTDIR)$(libdir)/disco
TARGETCFG = $(DESTDIR)$(sysconfdir)/disco
TARGETSRV = $(DESTDIR)$(localstatedir)/disco
-DISCO_LOG_DIR = $(TARGETSRV)/log
-
# options to python and sphinx for building the lib and docs
PYTHONENVS = DISCO_VERSION=$(DISCO_VERSION) DISCO_RELEASE=$(DISCO_RELEASE)
SPHINXOPTS = "-D version=$(DISCO_VERSION) -D release=$(DISCO_RELEASE)"
-# used to choose which conf file will be generated
-UNAME = $(shell uname)
-
# utilities used for building disco
REBAR = ./rebar # relative to ./master
ERL = erl
@@ -40,8 +35,6 @@ DIALYZER = dialyzer
TYPER = typer
PYTHON = python
PY_INSTALL = $(PYTHONENVS) $(PYTHON) setup.py install --root=$(DESTDIR)/ --prefix=$(prefix)
-RE_VERSION = sed -e s/%DISCO_VERSION%/$(DISCO_VERSION)/
-RE_LOG_DIR = sed -e s@%DISCO_LOG_DIR%@$(DISCO_LOG_DIR)@
EHOME = master
WWW = master/www
@@ -65,6 +58,20 @@ ETESTOBJECTS = $(ETESTSOURCES:.erl=.beam)
EPLT = .dialyzer_plt
+# used to override default installation settings
+UNAME = $(shell uname)
+-include mk/mk.$(UNAME)
+# default settings to be generated for installation
+DISCO_HOME ?= $(TARGETLIB)
+DISCO_ROOT ?= $(TARGETSRV)
+DISCO_LOG_DIR ?= $(TARGETSRV)/log
+DISCO_RUN_DIR ?= $(DISCO_ROOT)/run
+
+# installation utilities
+RE_VERSION = sed -e s/%DISCO_VERSION%/$(DISCO_VERSION)/
+RE_INSTALL_LOG_DIR = sed -e s@%DISCO_LOG_DIR%@$(DISCO_LOG_DIR)@
+RE_LOCAL_LOG_DIR = sed -e s@%DISCO_LOG_DIR%@root/log@
+
.PHONY: all master clean distclean doc docclean doctest
.PHONY: install \
install-master \
@@ -79,14 +86,14 @@ EPLT = .dialyzer_plt
all: master
-master: $(ESRC)/disco.app.src
+master: $(EAPPCFG) $(ESRC)/disco.app.src Makefile
cd master && $(REBAR) get-deps && $(REBAR) compile
$(ESRC)/disco.app.src: $(ESRC)/disco.app.src.src
- $(RE_VERSION) $< > $@
$(EAPPCFG): $(EAPPCFG).src
- - $(RE_LOG_DIR) $< > $@
+ $(RE_LOCAL_LOG_DIR) $< > $(EAPPCFG)
clean:
- cd master && $(REBAR) clean
@@ -160,13 +167,17 @@ $(TARGETBIN)/%: bin/% | $(TARGETBIN)
$(TARGETCFG):
$(INSTALL) -d $(TARGETCFG)
-$(TARGETCFG)/settings.py: | $(TARGETCFG)
- (TARGETLIB=$(TARGETLIB) TARGETSRV=$(TARGETSRV) \
- conf/gen.settings.sys-$(UNAME) > $@ && chmod 644 $@)
+$(TARGETCFG)/settings.py: conf/gen.settings | $(TARGETCFG)
+ (DISCO_HOME=$(DISCO_HOME) \
+ DISCO_ROOT=$(DISCO_ROOT) \
+ DISCO_USER=$(DISCO_USER) \
+ DISCO_PID_DIR=$(DISCO_PID_DIR) \
+ DISCO_RUN_DIR=$(DISCO_RUN_DIR) \
+ conf/gen.settings > $@ && chmod 644 $@)
-$(ETARGETAPPCFG): $(EAPPCFG)
+$(ETARGETAPPCFG): $(EAPPCFG).src
$(INSTALL) -d `$(DIRNAME) $@`
- $(INSTALL_DATA) $< $@
+ - $(RE_INSTALL_LOG_DIR) $< > $@
$(TARGETLIB)/$(EBIN):
$(INSTALL) -d $@
View
26 conf/gen.settings.sys-Linux → conf/gen.settings
@@ -1,17 +1,31 @@
#!/bin/bash
# This file is used by "make install" on Linux.
-cat << EOF
+cat <<EOF
# Disco settings
-# --
-# -- You can modify these directories as you wish
-# --
-DISCO_HOME = "${TARGETLIB}"
+EOF
+
+if [ "${DISCO_USER}" != "" ]; then
+ echo DISCO_USER = "\"${DISCO_USER}\""
+ echo ""
+fi
+
+cat <<EOF
+DISCO_HOME = "${DISCO_HOME}"
# Root directory for Disco data.
-DISCO_ROOT = "${TARGETSRV}"
+DISCO_ROOT = "${DISCO_ROOT}"
+
+EOF
+
+if [ "${DISCO_PID_DIR}" != "" ]; then
+ echo '# Root directory for the Disco PID file.'
+ echo DISCO_PID_DIR = "\"${DISCO_PID_DIR}\""
+ echo
+fi
+cat <<EOF
# --
# -- Variables below this line rarely need to be modified
# --
View
35 conf/gen.settings.sys-Darwin
@@ -1,35 +0,0 @@
-#!/bin/bash
-# This file is used by "make install" on Darwin (i.e. Mac OS X).
-
-cat << EOF
-# Disco settings
-# --
-# -- You can modify these directories as you wish
-# --
-
-DISCO_HOME = "${TARGETLIB}"
-
-# Root directory for Disco data.
-DISCO_ROOT = "${TARGETSRV}"
-
-# --
-# -- Variables below this line rarely need to be modified
-# --
-
-# Lighttpd for master and nodes runs on this port.
-# disco://host URIs are mapped to http://host:DISCO_PORT.
-DISCO_PORT = 8989
-
-# Miscellaneous flags:
-# - nocurl: use httplib instead of pycurl even if pycurl is available
-#DISCO_FLAGS = "nocurl"
-
-# Example config for Varnish proxy
-# DISCO_PROXY_ENABLED = "on"
-# DISCO_HTTPD = "/usr/sbin/varnishd -a 0.0.0.0:\$DISCO_PROXY_PORT -f \$DISCO_PROXY_CONFIG -P \$DISCO_PROXY_PID -n/tmp -smalloc"
-
-DDFS_TAG_MIN_REPLICAS = 3
-DDFS_TAG_REPLICAS = 3
-DDFS_BLOB_REPLICAS = 3
-
-EOF
View
39 conf/gen.settings.sys-Debian
@@ -1,39 +0,0 @@
-#!/bin/bash
-# This file is used by Debian packaging.
-
-cat << EOF
-# Disco settings
-
-DISCO_USER = "disco"
-DISCO_HOME = "/usr/lib/disco"
-
-# Root directory for Disco data.
-DISCO_ROOT = "/srv/disco/"
-
-# Root directory for Disco logs.
-DISCO_LOG_DIR = "/var/log/disco/"
-
-# Root directory for the Disco PID file.
-DISCO_PID_DIR = "/var/run/disco/"
-
-# --
-# -- Variables below this line rarely need to be modified
-# --
-
-# Lighttpd for master and nodes runs on this port.
-# disco://host URIs are mapped to http://host:DISCO_PORT.
-DISCO_PORT = 8989
-
-# Miscellaneous flags:
-# - nocurl: use httplib instead of pycurl even if pycurl is available
-#DISCO_FLAGS = "nocurl"
-
-# Example config for Varnish proxy
-# DISCO_PROXY_ENABLED = "on"
-# DISCO_HTTPD = "/usr/sbin/varnishd -a 0.0.0.0:\$DISCO_PROXY_PORT -f \$DISCO_PROXY_CONFIG -P \$DISCO_PROXY_PID -n/tmp -smalloc"
-
-DDFS_TAG_MIN_REPLICAS = 3
-DDFS_TAG_REPLICAS = 3
-DDFS_BLOB_REPLICAS = 3
-
-EOF
View
4 mk/mk.Debian
@@ -0,0 +1,4 @@
+DISCO_USER = disco
+DISCO_HOME = /usr/lib/disco
+DISCO_ROOT = /srv/disco/
+DISCO_PID_DIR = /var/run/disco/

0 comments on commit caec97c

Please sign in to comment.
Something went wrong with that request. Please try again.