summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-09-18 13:17:36 +1200
committerDavid Phillips <david@sighup.nz>2017-09-18 13:17:36 +1200
commitfe1533f144b681c6bcd51edb39bcbdbd264de7ea (patch)
treebc10f9cc5bab557e55d7fc1d9294acfa004e7c2c
parent6560ea7e6a633f6f33ab37912b4c563cd300b5c7 (diff)
downloadinitscripts-fe1533f144b681c6bcd51edb39bcbdbd264de7ea.tar.xz
Add install recipe to makefile
-rw-r--r--Makefile13
1 files changed, 12 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 9d1fd59..54488cc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,13 @@
export OPENRC_RUN = /usr/bin/openrc-run
export BINDIR = /usr/bin
+SYSCONFDIR ?= etc
+
MACRO_PROG = ./replace.sh
INIT_FILES = $(shell find init.d.in -type f | sed -e 's/\.in$$//g' -e 's/init\.d\.in/init.d/g')
CONF_FILES = $(shell find conf.d.in -type f | sed -e 's/\.in$$//g' -e 's/conf\.d\.in/conf.d/g')
+DEST_INIT_D = $(DESTDIR)/$(SYSCONFDIR)/init.d
+DEST_CONF_D = $(DESTDIR)/$(SYSCONFDIR)/conf.d
all: $(INIT_FILES) $(CONF_FILES)
@@ -21,6 +25,13 @@ conf.d/%: conf.d.in/%.in conf.d
$(MACRO_PROG) $< > $@
chmod +x $@
-.PHONY: clean
+.PHONY: clean install
clean:
rm $(INIT_FILES) $(CONF_FILES)
+
+install:
+ install -d "$(DEST_INIT_D)"
+ install -d "$(DEST_CONF_D)"
+
+ $(foreach file,$(INIT_FILES),install -Dm 755 "$(file)" "$(DEST_INIT_D)";)
+ $(foreach file,$(CONF_FILES),install -Dm 755 "$(file)" "$(DEST_CONF_D)";)