#
#  Ikiwiki Makefile by Silvio Rhatto (rhatto at riseup.net).
#
#  This Makefile is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by the Free
#  Software Foundation; either version 3 of the License, or any later version.
#
#  This Makefile is distributed in the hope that it will be useful, but WITHOUT
#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License along with
#  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
#  Place - Suite 330, Boston, MA 02111-1307, USA
#

DOMAIN          = fluxo.info
OPENPGP_PATTERN = rhatto@$(DOMAIN)

all: web web_deploy

web:
	@ikiwiki --setup ikiwiki.yaml
	@chmod +x bin/*

web_deploy:
	@rsync -avz --delete www/ www:/var/sites/fluxo/www/

publish: web web_deploy

post_receive:
	cd .git/hooks && ln -sf ../../bin/post-receive

whoami:
	git config user.name "fluxo"
	git config user.email contato@fluxo.info

# See https://wiki.gnupg.org/WKD
# 	  https://wiki.gnupg.org/WKDHosting
# 	  https://packages.debian.org/stable/gpg-wks-client
# 	  https://www.uriports.com/blog/setting-up-openpgp-web-key-directory/
# 	  https://kushaldas.in/posts/setting-up-wkd.html
# 	  https://www.tyil.nl/post/2020/05/30/setting-up-pgp-wkd/
# 	  https://www.uriports.com/blog/setting-up-openpgp-web-key-directory/
# 	  https://lab.uberspace.de/guide_wkd/
wks:
	rm -rf .well-known/openpgpkey/hu
	mkdir -p tmp/openpgpkey
	cd tmp && gpg --list-options show-only-fpr-mbox -k $(OPENPGP_PATTERN) | /usr/lib/gnupg/gpg-wks-client -v --install-key
	mv tmp/openpgpkey/$(DOMAIN)/hu .well-known/openpgpkey
	rm -rf tmp
