Initial commit

This commit is contained in:
2025-12-31 15:36:54 +01:00
commit f95e0edd32
19 changed files with 2432 additions and 0 deletions

30
Makefile Normal file
View File

@@ -0,0 +1,30 @@
.PHONY: all build test clean install sync-version pkg-deb
BINARY_NAME=bird-exporter
INSTALL_PATH=/usr/local/bin
all: test build
build:
go build -o $(BINARY_NAME) ./cmd/bird-exporter/
test:
go test -v ./cmd/bird-exporter/
clean:
rm -f $(BINARY_NAME)
[ -d debian/go ] && chmod -R +w debian/go || true
rm -rf debian/.debhelper debian/.gocache debian/go debian/$(BINARY_NAME) debian/files debian/*.substvars debian/debhelper-build-stamp
rm -f ../$(BINARY_NAME)_*.deb ../$(BINARY_NAME)_*.changes ../$(BINARY_NAME)_*.buildinfo
install: build
install -m 755 $(BINARY_NAME) $(INSTALL_PATH)/$(BINARY_NAME)
sync-version:
@echo "Syncing version from debian/changelog to main.go..."
@VERSION=$$(head -1 debian/changelog | sed -n 's/.*(\([^)]*\)).*/\1/p'); \
sed -i 's/^const Version = ".*"/const Version = "'"$$VERSION"'"/' cmd/bird-exporter/main.go; \
echo "Updated Version const to: $$VERSION"
pkg-deb: sync-version
fakeroot dpkg-buildpackage -us -uc -b