Use `DESTDIR` makefile convention

parent 15b264c9
INSTALL_BASE:=/opt DESTDIR:=/opt
INSTALL_TO:=$(INSTALL_BASE)
REBAR3:=./rebar3 REBAR3:=./rebar3
SERVICE:=/etc/systemd/system/mtproto-proxy.service SERVICE:=/etc/systemd/system/mtproto-proxy.service
LOGDIR:=/var/log/mtproto-proxy LOGDIR:=/var/log/mtproto-proxy
...@@ -23,14 +22,14 @@ $(LOGDIR): ...@@ -23,14 +22,14 @@ $(LOGDIR):
install: $(LOGDIR) install: $(LOGDIR)
sudo useradd -r $(USER) || true sudo useradd -r $(USER) || true
cp -n -r _build/prod/rel/mtp_proxy $(INSTALL_BASE) cp -n -r _build/prod/rel/mtp_proxy $(DESTDIR)
mkdir -p $(INSTALL_BASE)/mtp_proxy/log mkdir -p $(DESTDIR)/mtp_proxy/log
chmod 777 $(INSTALL_BASE)/mtp_proxy/log chmod 777 $(DESTDIR)/mtp_proxy/log
cp -n config/mtproto-proxy.service $(SERVICE) cp -n config/mtproto-proxy.service $(SERVICE)
systemctl daemon-reload systemctl daemon-reload
uninstall: uninstall:
# TODO: ensure service is stopped # TODO: ensure service is stopped
rm $(SERVICE) rm $(SERVICE)
rm -r $(INSTALL_BASE)/mtp_proxy rm -r $(DESTDIR)/mtp_proxy
systemctl daemon-reload systemctl daemon-reload
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment