Water web service

Signed-off-by: Thomas Klaehn <thomas.klaehn@perinet.io>
This commit is contained in:
Thomas Klaehn
2025-04-17 12:44:35 +02:00
parent f71c15b4d2
commit 6a9a42adc6
42 changed files with 328 additions and 6427 deletions

View File

@@ -6,13 +6,12 @@ CONFIG_DIR := /etc/$(PROJECT_NAME)
SYSTEM_DIR := /usr/lib/systemd/system
WEB_DIR := /var/lib/$(PROJECT_NAME)
CONFIG_FILE := config/config.json
BIN_FILE := build/bin/$(PROJECT_NAME)
UNIT_FILE := $(PROJECT_NAME).service
README_FILE := README.md
.PHONY: all
all: webui service
all: service
.PHONY: service
service:
@@ -21,30 +20,14 @@ service:
go mod tidy
go build -o $(BIN_FILE)
.PHONY: webui
webui:
npm install --prefix webui
npm run build --prefix webui
.PHONY: clean
clean:
go clean
rm -rf bin
rm -rf webui/build webui/node_modules webui/.svelte-kit
-rm $(PROJECT_NAME).tar.gz
.PHONY: install
install: all
# Config file
@if [ -f $(CONFIG_DIR)/$(notdir $(CONFIG_FILE)) ]; then \
echo "$(CONFIG_DIR)/$(notdir $(CONFIG_FILE)) already exists - skipping..."; \
else \
install -d $(CONFIG_DIR); \
install -m 0644 $(CONFIG_FILE) $(CONFIG_DIR); \
echo "install -d $(CONFIG_DIR)"; \
echo "install -m 0644 $(CONFIG_FILE) $(CONFIG_DIR)"; \
fi
# Binary
install -d $(PREFIX)
install -m 0755 $(BIN_FILE) $(PREFIX)
@@ -55,7 +38,7 @@ install: all
# Web ui
install -d $(WEB_DIR)
cp -r webui/build/* $(WEB_DIR)
cp -r webui/* $(WEB_DIR)
.PHONY: uninstall
uninstall: