Rewrite the logger in Rust; add install targets
vitals-log replaces the bash sampler and writes the same CSV layout. The crate is now a library plus two binaries. dist/ holds the systemd unit and desktop entry templates, installed by make install. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
# Per-user install: binaries, the systemd timer that runs the logger, and the
|
||||
# desktop entry for the viewer.
|
||||
|
||||
PREFIX ?= $(HOME)/.local
|
||||
BINDIR := $(PREFIX)/bin
|
||||
APPDIR := $(or $(XDG_DATA_HOME),$(HOME)/.local/share)/applications
|
||||
UNITDIR := $(or $(XDG_CONFIG_HOME),$(HOME)/.config)/systemd/user
|
||||
|
||||
.PHONY: build test install install-bin install-units install-desktop uninstall
|
||||
|
||||
build:
|
||||
cargo build --release
|
||||
|
||||
test:
|
||||
cargo test
|
||||
|
||||
install: install-bin install-units install-desktop
|
||||
|
||||
install-bin: build
|
||||
install -Dm755 target/release/vitals $(BINDIR)/vitals
|
||||
install -Dm755 target/release/vitals-log $(BINDIR)/vitals-log
|
||||
|
||||
# dist/ files carry an @BINDIR@ placeholder so they point at wherever PREFIX put the binaries.
|
||||
install-units:
|
||||
install -d $(UNITDIR)
|
||||
sed 's|@BINDIR@|$(BINDIR)|' dist/vitals-log.service > $(UNITDIR)/vitals-log.service
|
||||
install -m644 dist/vitals-log.timer $(UNITDIR)/vitals-log.timer
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable --now vitals-log.timer
|
||||
|
||||
install-desktop:
|
||||
install -d $(APPDIR)
|
||||
sed 's|@BINDIR@|$(BINDIR)|' dist/vitals.desktop > $(APPDIR)/vitals.desktop
|
||||
-update-desktop-database $(APPDIR)
|
||||
|
||||
# Leaves the logs in ~/.local/state/vitals alone.
|
||||
uninstall:
|
||||
-systemctl --user disable --now vitals-log.timer
|
||||
rm -f $(UNITDIR)/vitals-log.service $(UNITDIR)/vitals-log.timer
|
||||
rm -f $(APPDIR)/vitals.desktop $(BINDIR)/vitals $(BINDIR)/vitals-log
|
||||
-systemctl --user daemon-reload
|
||||
-update-desktop-database $(APPDIR)
|
||||
Reference in New Issue
Block a user