diff --git a/Repositories/statistics/Makefile b/Repositories/statistics/Makefile index 9cdb2a6..cf35e73 100755 --- a/Repositories/statistics/Makefile +++ b/Repositories/statistics/Makefile @@ -1,24 +1,73 @@ SHELL=/bin/sh -EPRINTSSTATS:=/usr/local/eprints/ePrintsStats +# Load in machine-specific environment settings from environment_config.make. +# This include file MUST be created and MUST define the following variables: +# +# EPRINTSSTATS: /path/to/eprintsstats/installation +# EPRINTS_USER: the user that owns the EPrints directory +# EPRINTS_GROUP: the group that owns the EPrints directory +# +# EPRINTS_HOST: eprints host name +# EPRINTS_PORT: appropriate HTTP port +# EPRINTS_ADMIN_EMAIL: administrator email address (quote "@" with \) +# +# GEOIP_DATABASE:=/usr/local/share/GeoIP/GeoIP.dat +# +# APACHE_LOG_LOCATION:=/sw/var/apache2/logs/ +# APACHE_LOG_NAME:=access_log +# +# PHP_LIB:=/sw/lib/php4 +# +include environment_config.make + + BINDIR:=$(EPRINTSSTATS)/scripts +GENERATED_FILES:=config/inc.vars.es.php scripts/eprints-usage.php \ + scripts/fix-countries.php vhost/apache.conf + +CONFIG_SUBS:=EPRINTSSTATS EPRINTS_HOST EPRINTS_PORT EPRINTS_ADMIN_EMAIL +USAGE_SUBS:=GEOIP_DATABASE APACHE_LOG_LOCATION APACHE_LOG_NAME +FIX_SUBS:=GEOIP_DATABASE +VHOST_SUBS:=EPRINTSSTATS PHP_LIB + .PHONY: deploy stats -deploy: +deploy: $(GENERATED_FILES) @announce "Copying files..." @sudo rsync --verbose --cvs-exclude --exclude=Makefile \ + --exclude='*.make' --exclude='*_src.*' \ --recursive --times . $(EPRINTSSTATS) @announce "Correcting ownership..." - sudo chown -R www:www $(EPRINTSSTATS) + sudo chown -R $(EPRINTS_USER):$(EPRINTS_GROUP) $(EPRINTSSTATS) + + +config/inc.vars.es.php: config/inc.vars.es_src.php + @announce "Generating $@" + perl -p $(foreach SUB,$(CONFIG_SUBS),-e "s|##$(SUB)##|$($(SUB))|g;") $< > $@ + + +scripts/eprints-usage.php: scripts/eprints-usage_src.php + @announce "Generating $@" + perl -p $(foreach SUB,$(USAGE_SUBS),-e "s|##$(SUB)##|$($(SUB))|g;") $< > $@ + + +scripts/fix-countries.php: scripts/fix-countries_src.php + @announce "Generating $@" + perl -p $(foreach SUB,$(FIX_SUBS),-e "s|##$(SUB)##|$($(SUB))|g;") $< > $@ + + +vhost/apache.conf: vhost/apache_src.conf + @announce "Generating $@" + perl -p $(foreach SUB,$(VHOST_SUBS),-e "s|##$(SUB)##|$($(SUB))|g;") $< > $@ stats: @announce "Generating statistics..." - @sudo -u www php $(BINDIR)/eprints-usage.php - @sudo -u www perl $(BINDIR)/add_country.pl + @sudo -u $(EPRINTS_USER) php $(BINDIR)/eprints-usage.php +# @sudo -u $(EPRINTS_USER) perl $(BINDIR)/add_country.pl debug: