Daniel Gröber
f0e76b814b
We're trying to prevent clobbering other's changes or forgetting to push ours.
43 lines
1.1 KiB
Makefile
43 lines
1.1 KiB
Makefile
check: $(patsubst %.zone,%.check,$(wildcard *.zone))
|
|
|
|
%.check: %.zone FORCE
|
|
ldns-read-zone $<
|
|
|
|
sign: $(patsubst %,%.sig,$(wildcard *.zone))
|
|
|
|
%.sig: %
|
|
gpg $(GPG_FLAGS) -o $@ --batch --yes --detach-sign $<
|
|
|
|
.PHONY: check-clean
|
|
check-clean:
|
|
@git diff-index --exit-code HEAD >/dev/null && \
|
|
git ls-files --other --directory --exclude-standard | \
|
|
sed -n '/.*\.zone/{p;q1}' || { \
|
|
printf 'Commit your changes before uploading!\n' >&2; \
|
|
git status -s; exit 1; }
|
|
|
|
GIT_BRANCH=$(shell git name-rev --name-only HEAD)
|
|
GIT_BRANCH_REMOTE=$(shell git config branch.$(GIT_BRANCH).remote)
|
|
GIT_BRANCH_MERGE=$(shell git config branch.$(GIT_BRANCH).merge) # remote branch
|
|
.PHONY: fetch
|
|
check-uptodate: FORCE
|
|
git fetch $(GIT_BRANCH_REMOTE) $(GIT_BRANCH_MERGE)
|
|
@[ -z "`git rev-list -n1 HEAD@{upstream} --not HEAD`" ] || { \
|
|
printf 'Unpulled changes, refusing to upload zones!\n' >&2; \
|
|
git log --decorate --oneline --graph -n3 \
|
|
HEAD@{upstream} --not HEAD; \
|
|
}
|
|
|
|
.PHONY: upload
|
|
upload: check-clean check-uptodate
|
|
upload: sign
|
|
printf 'put %s\n' *.zone *.sig | \
|
|
sftp $(SFTP_FLAGS) zones@ns0.it-syndikat.org:zones/
|
|
|
|
clean:
|
|
rm -f *.sig
|
|
|
|
FORCE:
|
|
.PHONY: FORCE
|
|
|
|
-include local.mk
|