mirror of https://bitbucket.org/ausocean/av.git
46 lines
1.2 KiB
Makefile
46 lines
1.2 KiB
Makefile
# NB: The default (soft) install does not override existing installation files.
|
|
USER := $(shell whoami)
|
|
PATH := /usr/local/go/bin:$(PATH)
|
|
BIN_NAME := vidforward
|
|
BIN_DIR := /src/bitbucket.org/ausocean/av/cmd/$(BIN_NAME)
|
|
RUN_SCRIPT_DIR := $(BIN_DIR)
|
|
|
|
.SILENT:soft_copy_files
|
|
.SILENT:hard_copy_files
|
|
.SILENT:clean
|
|
|
|
rebuild:
|
|
chmod +x run.sh
|
|
cd ../cmd/$(BIN_NAME); go build
|
|
|
|
install: as_root soft_copy_files rebuild
|
|
@echo "Install complete"
|
|
|
|
install_hard: as_root hard_copy_files set_mac rebuild
|
|
@echo "Hard install complete"
|
|
|
|
as_root:
|
|
ifneq ($(USER),root)
|
|
$(error Must run as superuser!)
|
|
endif
|
|
|
|
soft_copy_files:
|
|
if [ -f /etc/systemd/system/$(BIN_NAME).service ] ; then \
|
|
echo "/etc/systemd/system/$(BIN_NAME).service left unmodified" ; \
|
|
else \
|
|
bash create_service.sh $(RUN_SCRIPT_DIR) $(BIN_DIR); \
|
|
fi
|
|
systemctl enable $(BIN_NAME).service
|
|
|
|
hard_copy_files:
|
|
if [ -f /etc/systemd/system/$(BIN_NAME).service ] ; then \
|
|
echo "/etc/systemd/system/$(BIN_NAME).service overwritten" ; \
|
|
fi
|
|
bash create_service.sh $(RUN_SCRIPT_DIR) $(BIN_DIR)
|
|
systemctl enable $(BIN_NAME).service
|
|
|
|
clean: as_root
|
|
rm -rf /var/log/vidforward
|
|
rm -rf /etc/systemd/system/$(BIN_NAME).service
|
|
@echo "Clean complete"
|