HOST ?= hwebs@marta SOURCE = www-personal DEPS = .local/src/www-personal CADDY_SITE = /usr/local/etc/caddy/sites/personal.caddy CRON = /usr/local/etc/cron.d/www-personal COMMONMARK_REPO = https://codeberg.org/spritely/guile-commonmark.git COMMONMARK_REV = ed3ce543ca2fbcf3312683aad66f19aa933468f6 HAUNT_REPO = https://git.dthompson.us/haunt.git HAUNT_REV = v0.4.0 .PHONY: install deploy uninstall install: ssh $(HOST) 'doas /usr/sbin/pkg install -y git guile3 guile-aclocal guile-lib-guile30 autoconf automake gmake pkgconf rsync' ssh $(HOST) 'set -e; \ mkdir -p $(DEPS); \ cd $(DEPS); \ if [ ! -d guile-commonmark ]; then \ git clone $(COMMONMARK_REPO); \ fi; \ cd guile-commonmark; \ git fetch --tags origin; \ git checkout --detach $(COMMONMARK_REV); \ if [ ! -f .installed-$(COMMONMARK_REV) ]; then \ ./bootstrap; \ ./configure --prefix=/usr/local; \ gmake; \ doas gmake install; \ touch .installed-$(COMMONMARK_REV); \ fi' ssh $(HOST) 'set -e; \ mkdir -p $(DEPS); \ cd $(DEPS); \ if [ ! -d haunt ]; then \ git clone $(HAUNT_REPO); \ fi; \ cd haunt; \ git fetch --tags origin; \ git checkout --detach $(HAUNT_REV); \ if [ ! -f .installed-$(HAUNT_REV) ]; then \ ./bootstrap; \ ./configure --prefix=/usr/local; \ gmake; \ doas gmake install; \ touch .installed-$(HAUNT_REV); \ fi' ssh $(HOST) 'doas mkdir -p /usr/local/etc/cron.d' ssh $(HOST) 'doas sh -c "cat > $(CRON)"' < cron deploy: rsync -az --exclude=.git --exclude=Makefile --exclude=Caddyfile ./ $(HOST):$(SOURCE)/ ssh $(HOST) 'export LC_ALL=C.UTF-8; cd $(SOURCE) && /usr/local/bin/haunt build && /usr/local/bin/haunt publish' ssh $(HOST) 'doas mkdir -p /usr/local/etc/caddy/sites' ssh $(HOST) 'doas sh -c "cat > $(CADDY_SITE)"' < Caddyfile uninstall: ssh $(HOST) 'doas rm -f $(CADDY_SITE) $(CRON)'