export VMNAME := ubuntu2004
export DISK_DIR := /storage/scratch/tmp
export THAT_DIR := /storage/admin/vms/2004
export HOST := las1.local

.PHONY: clean install reinstall rcopy rrun

default: remote

clean:
	-virsh destroy $(VMNAME)
	-virsh undefine $(VMNAME)
	rm -f $(DISK_DIR)/$(VMNAME).qcow2

install:
	bash install.sh

reinstall: clean install

remote: rrun

rcopy:
	rsync -avP ./ root@$(HOST):/$(THAT_DIR)/

rrun: rcopy
	ssh -t root@$(HOST) "cd /$(THAT_DIR) && make reinstall"

rclean: rcopy
	ssh -t root@$(HOST) "cd /$(THAT_DIR) && make clean"

