2022-11-27 03:29:45 +03:00
|
|
|
# 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)
|
2023-02-08 08:49:05 +03:00
|
|
|
RUN_SCRIPT_DIR := $(BIN_DIR)/run.sh
|
2022-11-27 03:29:45 +03:00
|
|
|
|
|
|
|
.SILENT:soft_copy_files
|
|
|
|
.SILENT:hard_copy_files
|
|
|
|
.SILENT:clean
|
|
|
|
|
|
|
|
rebuild:
|
|
|
|
chmod +x run.sh
|
2023-05-29 08:49:05 +03:00
|
|
|
go build -tags debug
|
2022-11-27 03:29:45 +03:00
|
|
|
|
|
|
|
install: as_root soft_copy_files rebuild
|
|
|
|
@echo "Install complete"
|
|
|
|
|
2023-02-08 08:49:05 +03:00
|
|
|
install_hard: as_root hard_copy_files rebuild
|
2022-11-27 03:29:45 +03:00
|
|
|
@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"
|