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)
|
|
|
|
|
|
|
|
.SILENT:soft_copy_files
|
|
|
|
.SILENT:hard_copy_files
|
|
|
|
.SILENT:clean
|
|
|
|
|
|
|
|
rebuild:
|
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 \
|
2023-09-21 00:55:47 +03:00
|
|
|
bash create_service.sh $(BIN_DIR); \
|
2022-11-27 03:29:45 +03:00
|
|
|
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
|
2023-09-21 00:55:47 +03:00
|
|
|
bash create_service.sh $(BIN_DIR)
|
2022-11-27 03:29:45 +03:00
|
|
|
systemctl enable $(BIN_NAME).service
|
|
|
|
|
|
|
|
clean: as_root
|
|
|
|
rm -rf /var/log/vidforward
|
|
|
|
rm -rf /etc/systemd/system/$(BIN_NAME).service
|
|
|
|
@echo "Clean complete"
|