summaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-08-31 15:19:33 -0400
committerJoey Hess <joeyh@joeyh.name>2016-08-31 15:22:25 -0400
commitdab2e9a92666680f82f829b4db75e8a474ca03b7 (patch)
treef5b663f8db0fa70bcca1ef56d1f88764f1b05a20 /Makefile
parent019c080687ce4a07031bdfe2263397f4f868c3c3 (diff)
downloadkeysafe-dab2e9a92666680f82f829b4db75e8a474ca03b7.tar.gz
add systemd service, makefile, improve INSTALL
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 30 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f287c2b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,30 @@
+PREFIX?=
+# Can be stack or cabal
+BUILDER?=stack
+
+build: keysafe
+
+keysafe:
+ $(BUILDER) build
+ if [ "$(BUILDER)" = stack ]; then \
+ ln -sf $$(find .stack-work/ -name keysafe -type f | grep build/keysafe/keysafe | tail -n 1) keysafe; \
+ else \
+ ln -sf dist/build/keysafe/keysafe keysafe; \
+ fi
+
+clean:
+ rm -rf keysafe dist .stack-work
+
+install: install-files
+ useradd --system keysafe
+ chmod 700 $(PREFIX)/var/lib/keysafe
+ chown keysafe:keysafe $(PREFIX)/var/lib/keysafe
+
+install-files: keysafe
+ install -d $(PREFIX)/var/lib/keysafe
+ install -d $(PREFIX)/usr/bin
+ install -s -m 0755 keysafe $(PREFIX)/usr/bin/keysafe
+ install -d $(PREFIX)/usr/share/man/man1
+ install -m 0644 keysafe.1 $(PREFIX)/usr/share/man/man1/keysafe.1
+ install -d $(PREFIX)/lib/systemd/system
+ install -m 0644 keysafe.service $(PREFIX)/lib/systemd/system/keysafe.service