netcup-dns/Makefile

54 lines
1.3 KiB
Makefile
Raw Permalink Normal View History

2023-03-28 17:18:30 +02:00
PKGNAME := netcup-dns
.PHONY: all
all: install
.PHONY: install
install: cron
sudo pacman -S --needed base-devel
cd packaging && makepkg -fCcsri && rm -rf $(PKGNAME)
${MAKE} install-files
.PHONY: install-pip
install-pip: nc-dnsapi requests exec-notify cron
2023-03-28 17:18:30 +02:00
sudo python3 -m pip install --upgrade --force-reinstall .
${MAKE} install-files
.PHONY: install-files
install-files:
2023-03-28 17:18:30 +02:00
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: exec-notify ## Check if exec-notify is installed.
exec-notify:
2023-03-28 17:18:30 +02:00
# `type` does not work e.g. on Ubuntu 18.04
2023-06-16 13:50:55 +02:00
which exec-notify
2023-03-28 17:18:30 +02:00
.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
clean: clean-files
sudo pacman -Rns python-$(PKGNAME)-git
.PHONY: clean-pip
clean-pip: clean-files
2023-03-28 17:18:30 +02:00
sudo python3 -m pip uninstall -y $(PKGNAME)
.PHONY: clean-files
clean-files:
sudo rm -rf /etc/cron.d/$(PKGNAME) /etc/$(PKGNAME)