- @echo "Starting db server on $(call display,$*)"
- @$(SSH) $(HOST_$*) sudo sliver-ovs start-db > $@ \
- || { rm $@; exit 1; }
-
-cache/switchd.%: cache/db.%
- @echo "Starting vswitchd on $(call display,$*)"
- @$(SSH) $(HOST_$*) sudo sliver-ovs start-switch > $@ \
- || { rm $@; exit 1; }
-
-cache/bridge.%: cache/switchd.%
- @echo "Creating bridge on $(call display,$*)"
- @$(SSH) $(HOST_$*) sudo sliver-ovs create-bridge $(IP_$*) > $@ \
- || { rm $@; exit 1; }
-
-cache/sshcheck.%: FORCE
- @if $(SSH) $(HOST_$*) hostname 2> /dev/null; then echo "ssh on" $(call display,$*) "OK" ; \
- else echo "ssh on" $(call display,$*) "KO !!!"; fi
+ @echo "Starting db server on $(call display,$*) - logs in $(call log,$@)"
+ @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs start-db &> $(call log,$@) && touch $@
+
+cache/switch.%: cache/db.%
+ @echo "Starting vswitchd on $(call display,$*) - logs in $(call log,$@)"
+ @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs start-switch &> $(call log,$@) && touch $@
+
+cache/bridge.%: cache/switch.%
+ @echo "Creating bridge on $(call display,$*) - logs in $(call log,$@)"
+ @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs create-bridge $(BRIDGE) $(IP_$*) > $@ 2> $(call log,$@) || { rm $@; exit 1; }
+ @echo Created bridge with tap $$(cat $@) on $(call display,$*)
+
+cache/controller.%: cache/bridge.%
+ @echo "Setting controller $(call default,CONTROLLER,$*) on $(call display,$*) - logs in $(call log,$@)"
+ @$(SSH) $(HOST_$*) $(SUDO) ovs-vsctl set-controller $(BRIDGE) $(call default,CONTROLLER,$*) &> $(call log,$@) || { rm $@; exit 1; }
+
+# xxx this probably needs a more thorough cleanup in cache/
+cache/stop.%: del-bridge.%
+ @echo "Stopping switch & db on $(call display,$*)"
+ @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs stop && rm cache/switch.$* cache/db.$*