tabin-plugins 0.2.3

Libs for building nagios-compatible check scripts, some scripts, and some libs to read from /proc and /sys on Linux.
P_VERSION=$(shell head -n4 Cargo.toml | grep version | cut -d ' ' -f3 | tr -d \")
DEB=target/linux/release/tabin-plugins_$(P_VERSION)_amd64.deb
REBUILD_DEB=0

plugins-deb: $(DEB)

upload:
	aws s3 cp $(DEB) s3://knewton-apt/
	deb-s3 upload -a amd64 --bucket knewton-public $(DEB) --sign 7E94EA8F

deb: $(DEB)

$(DEB): target/linux/release
	cd target/linux/release ; \
	  mkdir -p usr/local/bin ; \
	  cp -u check-* usr/local/bin ; \
	  fpm -s dir -t deb \
	    -n "tabin-plugins" -v $(P_VERSION) \
	    --description "Nagios-compatible check scripts" \
	    usr
	echo "deb is in $(CURDIR)/target/linux/release/tabin-plugins_$(P_VERSION)_amd64.deb"

linux: target/linux/release

target/linux/release: src/bin/check-*.rs
	docker run -it --rm -e CARGO_TARGET_DIR=target/linux -v $(CURDIR):/source jimmycuadra/rust cargo build --release
	rm -f target/linux/release/tabin-plugins_$(P_VERSION)_amd64.deb

target/osx/release: src/bin/check-*.rs
	CARGO_TARGET_DIR=target/osx cargo build --release

install: target/osx/release
	cp target/osx/release/check-* ~/.local/bin

target/osx/debug: src/bin/check-*.rs
	CARGO_TARGET_DIR=target/osx cargo build

install-debug: target/osx/debug
	cp target/osx/debug/check-* ~/.local/bin

rebuild:
	docker run -it --rm -e CARGO_TARGET_DIR=target/linux -v $(pwd):/source jimmycuadra/rust cargo build --release
	rm -f target/linux/release/tabin-plugins_$(P_VERSION)_amd64.deb

.PHONY: rebuild \
	linux \
	install