+###--------------------------------------------------------------------------
+### Installation.
+
+## The local machine doesn't want the complicated SSH stuff.
+THISHOST = $(shell hostname)
+OTHERHOSTS = $(filter-out $(THISHOST), $(HOSTS))
+
+## Testing.
+check: $(THISHOST).sh
+ $(ROOT) ./$(THISHOST).sh test
+
+## Installation on a local host,
+install/$(THISHOST): $(THISHOST).sh
+ [ "x$(SCRIPTS)" = x ] || $(ROOT) install -m755 $(SCRIPTS) $(sbindir)
+ $(ROOT) ./$(THISHOST).sh replace
+
+## Installation on a remote host.
+$(addprefix install/, $(OTHERHOSTS)): install/%: %.sh
+ if [ "x$(SCRIPTS)" != x ]; then \
+ for i in $(SCRIPTS); do \
+ $(ROOT) scp $$i root@$*:$(sbindir)/$$i.new && \
+ $(ROOT) ssh root@$* \
+ 'cd $(sbindir) && chmod 755 $$i.new && mv $$i.new $i' || \
+ exit 1; \
+ done; \
+ fi
+ $(ROOT) scp $*.sh root@$*:$(FIREWALL).new
+ $(ROOT) ssh root@$* $(FIREWALL).new remote-prepare
+ $(ROOT) ssh root@$* $(FIREWALL).new remote-commit
+ $(ROOT) ssh root@$* rm -f $(FIREWALL).new
+
+## General installation target.
+install: all $(addprefix install/,$(HOSTS))
+.PHONY: install $(addprefix install/,$(HOSTS))
+