summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-10-04 15:49:00 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-10-04 15:51:09 +0300
commit265912dd1ceae4523c4839ace962d860d9f4a632 (patch)
tree54cf679f28e9375b6e4a13af8053de22b8861ce5
parentf6166c6535d21e7da639c1d9a3651bd2479898e1 (diff)
downloadacf2-265912dd1ceae4523c4839ace962d860d9f4a632.tar.bz2
acf2-265912dd1ceae4523c4839ace962d860d9f4a632.tar.xz
installer Makefile
-rw-r--r--Makefile67
-rwxr-xr-xrun-server.sh10
2 files changed, 75 insertions, 2 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..aa55e64
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,67 @@
+# Copyright (c) 2012-2013 Kaarle Ritvanen
+# See LICENSE file for license details
+
+ROOT_DIR := /
+LUA_VERSION := 5.2
+
+confdir := etc/acf2
+luadir := usr/share/lua/$(LUA_VERSION)/acf
+resdir := usr/share/acf2
+webdir := $(resdir)/web
+starter := usr/sbin/acf2
+
+all: install
+
+define _copy =
+ install -d $$(dir $$@)
+ install -m 644 $$< $$@
+endef
+
+define copy =
+$(ROOT_DIR)/$(2)/$(3): $(1)/$(3)
+$(call _copy)
+
+files += $(2)/$(3)
+endef
+
+define rcopy =
+$(ROOT_DIR)/$(2)/%.$(3): $(1)/%.$(3)
+$(call _copy)
+
+files += $(patsubst $(1)/%.$(3),$(2)/%.$(3),$(shell find $(1) -name '*.$(3)' $(4)))
+endef
+
+define link =
+$(ROOT_DIR)/$(resdir)/$(1):
+ install -d $$(dir $$@)
+ ln -s /$(2) $$@
+
+files += $(resdir)/$(1)
+endef
+
+
+$(eval $(call link,acf,$(luadir)))
+$(eval $(call rcopy,acf,$(luadir),lua,-not -path 'acf/modules/*'))
+
+$(ROOT_DIR)/$(luadir)/modules:
+ install -d $@
+
+$(eval $(call link,config,$(confdir)))
+$(eval $(call copy,config,$(confdir),aaa.json))
+
+$(eval $(call copy,.,$(resdir),LICENSE))
+
+$(ROOT_DIR)/$(starter): run-server.sh
+ install -d $(dir $@)
+ install -m 755 $< $@
+
+$(eval $(call copy,.,$(resdir),server.lua))
+
+$(eval $(call copy,web,$(webdir),client.css))
+$(eval $(call copy,web,$(webdir),client.html))
+$(eval $(call rcopy,web,$(webdir),js))
+
+
+install: $(foreach f,$(files),$(ROOT_DIR)/$(f)) $(ROOT_DIR)/$(luadir)/modules $(ROOT_DIR)/$(starter)
+
+.PHONY: all install
diff --git a/run-server.sh b/run-server.sh
index 717b650..24ff0e8 100755
--- a/run-server.sh
+++ b/run-server.sh
@@ -3,9 +3,15 @@
# Copyright (c) 2012-2013 Kaarle Ritvanen
# See LICENSE file for license details
-cd $(dirname $0)
+if [ $(basename $0) = run-server.sh ]; then
+ PORT=${1:-8000}
+ cd $(dirname $0)
+else
+ PORT=80
+ cd /usr/share/acf2
+fi
-exec uwsgi -M --http-socket :${1:-8000} \
+exec uwsgi -M --http-socket :$PORT \
--plugin /usr/lib/uwsgi/lua_plugin.so --lua server.lua \
--remap-modifier 6:0 \
--static-map /browser=web --static-index client.html