netcup-dns/Makefile

38 lines
1.0 KiB
Makefile

PKGNAME := netcup-dns
.PHONY: all
all: install
.PHONY: install
install: nc-dnsapi requests notify cron
sudo python3 -m pip install --upgrade --force-reinstall .
sudo install -m0644 cron.d/$(PKGNAME) /etc/cron.d/$(PKGNAME)
sudo install --directory -m755 /etc/$(PKGNAME)/
sudo install -m0644 cfg/* /etc/$(PKGNAME)/
.PHONY: nc-dnsapi ## Check if nc-dnsapi is installed.
nc-dnsapi:
pip list | cut -f 1 -d ' ' | grep '^nc-dnsapi$$' || sudo pacman -S --needed python-nc-dnsapi
.PHONY: requests ## Check if requests is installed.
requests:
pip list | cut -f 1 -d ' ' | grep '^requests$$' || sudo pacman -S --needed python-requests
.PHONY: notify ## Check if exec-notify is installed.
notify:
# `type` does not work e.g. on Ubuntu 18.04
which exec-notify
.PHONY: cron ## Check if cron (e.g. cronie) is running.
cron:
# Check if cron.d exists
stat /etc/cron.d/
# Check if cron is running
pgrep cron
.PHONY: clean
clean:
sudo python3 -m pip uninstall -y $(PKGNAME)
sudo rm -rf /etc/cron.d/$(PKGNAME) /etc/$(PKGNAME)