2015-03-03 19:38:46 -07:00
|
|
|
MSCS_USER := minecraft
|
2016-02-27 17:02:40 -07:00
|
|
|
MSCS_GROUP := minecraft
|
2015-03-03 19:38:46 -07:00
|
|
|
MSCS_HOME := /opt/mscs
|
|
|
|
|
2015-08-11 09:46:21 -07:00
|
|
|
MSCTL := /usr/local/bin/msctl
|
2015-07-04 06:21:58 -07:00
|
|
|
MSCS := /usr/local/bin/mscs
|
2015-11-16 14:57:03 -07:00
|
|
|
MSCS_INIT_D := /etc/init.d/mscs
|
2015-08-16 09:17:51 -07:00
|
|
|
MSCS_SERVICE := /etc/systemd/system/mscs.service
|
2015-03-10 19:11:24 -07:00
|
|
|
MSCS_COMPLETION := /etc/bash_completion.d/mscs
|
2013-12-02 20:39:12 -07:00
|
|
|
|
2016-06-19 13:06:40 -07:00
|
|
|
UPDATE_D := $(wildcard update.d/*)
|
|
|
|
|
2015-07-04 06:24:33 -07:00
|
|
|
.PHONY: install update clean
|
2013-12-02 20:39:12 -07:00
|
|
|
|
2016-02-27 17:02:40 -07:00
|
|
|
install: $(MSCS_HOME) update
|
2016-05-25 02:28:54 -07:00
|
|
|
useradd --system --user-group --create-home --home $(MSCS_HOME) $(MSCS_USER)
|
2016-02-27 17:02:40 -07:00
|
|
|
chown -R $(MSCS_USER):$(MSCS_GROUP) $(MSCS_HOME)
|
2015-08-11 10:04:25 -07:00
|
|
|
if which systemctl; then \
|
|
|
|
systemctl -f enable mscs.service; \
|
2015-11-16 14:57:03 -07:00
|
|
|
else \
|
|
|
|
ln -s $(MSCS) $(MSCS_INIT_D); \
|
|
|
|
update-rc.d mscs defaults; \
|
2015-08-11 10:04:25 -07:00
|
|
|
fi
|
2013-12-02 20:39:12 -07:00
|
|
|
|
2015-07-04 06:24:33 -07:00
|
|
|
update:
|
2016-02-27 17:02:40 -07:00
|
|
|
cp msctl $(MSCTL)
|
|
|
|
cp mscs $(MSCS)
|
|
|
|
cp mscs.completion $(MSCS_COMPLETION)
|
2015-08-11 10:04:25 -07:00
|
|
|
if which systemctl; then \
|
2016-02-27 17:02:40 -07:00
|
|
|
cp mscs.service $(MSCS_SERVICE); \
|
2015-08-11 10:04:25 -07:00
|
|
|
fi
|
2016-06-19 13:06:40 -07:00
|
|
|
@for script in $(UPDATE_D); do \
|
|
|
|
sh $$script; \
|
|
|
|
done; true;
|
2015-07-04 06:24:33 -07:00
|
|
|
|
2013-12-02 20:39:12 -07:00
|
|
|
clean:
|
2015-08-11 10:04:25 -07:00
|
|
|
if which systemctl; then \
|
|
|
|
systemctl -f disable mscs.service; \
|
|
|
|
rm -f $(MSCS_SERVICE); \
|
2015-11-16 14:57:03 -07:00
|
|
|
else \
|
|
|
|
update-rc.d mscs remove; \
|
|
|
|
rm -f $(MSCS_INIT_D); \
|
2015-08-11 10:04:25 -07:00
|
|
|
fi
|
2015-11-16 14:47:49 -07:00
|
|
|
rm -f $(MSCTL) $(MSCS) $(MSCS_COMPLETION)
|
2016-02-27 17:02:40 -07:00
|
|
|
|
|
|
|
$(MSCS_HOME):
|
|
|
|
mkdir -p -m 755 $(MSCS_HOME)
|