all-smi 0.26.2

Command-line utility for monitoring GPU hardware. It provides a real-time view of GPU utilization, memory usage, temperature, power consumption, and other metrics.
Documentation
#!/usr/bin/make -f

# Enable all hardening options
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# Keep cargo state inside the build tree.
export HOME = $(CURDIR)/debian/home
export CARGO_HOME = $(HOME)/.cargo
export CARGO_TARGET_DIR = $(CURDIR)/target
export CARGO_NET_OFFLINE = true

RUSTC := $(shell for c in rustc-1.96 rustc; do command -v $$c >/dev/null 2>&1 && { printf '%s' "$$c"; break; }; done)
CARGO := $(shell for c in cargo-1.96 cargo; do command -v $$c >/dev/null 2>&1 && { printf '%s' "$$c"; break; }; done)

%:
	dh $@

override_dh_auto_configure:
	mkdir -p $(CARGO_HOME)
	test -d vendor
	test -f .cargo/config.toml
	$(RUSTC) --version
	$(CARGO) --version
	rustc_version=$$($(RUSTC) --version | awk '{print $$2}'); \
	cargo_version=$$($(CARGO) --version | awk '{print $$2}'); \
	dpkg --compare-versions "$$rustc_version" ge 1.96 || { \
		echo "rustc 1.96+ is required for the current dependency set (found $$rustc_version)"; \
		exit 1; \
	}; \
	dpkg --compare-versions "$$cargo_version" ge 1.96 || { \
		echo "cargo 1.96+ is required for the current dependency set (found $$cargo_version)"; \
		exit 1; \
	}

override_dh_auto_build:
	$(CARGO) build --release --frozen

override_dh_auto_install:
	install -D -m 0755 target/release/all-smi debian/all-smi/usr/bin/all-smi
	install -D -m 0755 target/release/liball_smi_amd.so debian/all-smi/usr/lib/all-smi/liball_smi_amd.so
	# /etc/default/all-smi is the operator-editable environment file read by
	# the unit through `EnvironmentFile=-`. Installed from debian/ rather than
	# packaging/ so the Launchpad job, which overlays only debian/ onto a
	# release-tag checkout, always finds it. A CI job asserts the two copies
	# stay byte-identical.
	install -D -m 0644 debian/all-smi.default debian/all-smi/etc/default/all-smi

override_dh_auto_test:
	@echo "Skipping tests for PPA build"

override_dh_auto_clean:
	rm -rf $(CARGO_TARGET_DIR) $(HOME)

# Ship the unit disabled. all-smi is first a CLI tool, and opening a listening
# port as a side effect of `apt install` would surprise operators, so this
# deliberately diverges from prometheus-node-exporter. debian/all-smi.postinst
# prints the `systemctl enable --now all-smi` hint instead.
override_dh_installsystemd:
	dh_installsystemd --no-enable --no-start

override_dh_builddeb:
	dh_builddeb --destdir=../