Setting tag myplc-5.3-5
[myplc.git] / Makefile
index c068a47..0b57cd1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,23 @@
-# 
-# $Id$
-#
+##########
+tags:
+       find . -type f | egrep -v '\.git/|~$$' | xargs etags
 
-BINARIES = plc-config plc-config-tty db-config dns-config refresh-peer.py plc-map.py clean-empty-dirs.py mtail.py renew_reminder.py
-INIT_SCRIPTS = api bootcd bootmanager crond db dns functions gpg httpd mail network packages postgresql ssh ssl syslog
+.PHONY: tags
 
-INITS=$(addprefix plc.d/,$(INIT_SCRIPTS))
+########## sync
+# 2 forms are supported
+# (*) if your plc root context has direct ssh access:
+# make sync PLC=private.one-lab.org
+# (*) otherwise, for test deployments, use on your testmaster
+# $ run export
+# and cut'n paste the export lines before you run make sync
 
-########## make sync PLCHOST=hostname
-ifdef PLCHOST
-PLCSSH:=root@$(PLCHOST)
+ifdef PLC
+SSHURL:=root@$(PLC):/
+SSHCOMMAND:=ssh root@$(PLC)
+else
+SSHURL:=root@$(PLCHOSTLXC):/vservers/$(GUESTNAME)/
+SSHCOMMAND:=ssh root@$(PLCHOSTLXC) ssh $(GUESTHOSTNAME)
 endif
 
 LOCAL_RSYNC_EXCLUDES   := --exclude '*.pyc' 
@@ -18,20 +26,29 @@ RSYNC_COND_DRY_RUN  := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
 RSYNC                  := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
 
 sync:
-ifeq (,$(PLCSSH))
-       echo "sync: You must define target host as PLCHOST on the command line"
-       echo " e.g. make sync PLCHOST=private.one-lab.org" ; exit 1
+ifeq (,$(SSHURL))
+       @echo "sync: I need more info from the command line, e.g."
+       @echo "  make sync PLC=boot.planetlab.eu"
+       @echo "  make sync PLCHOSTVS=.. GUESTNAME=.."
+       @echo "  make sync PLCHOSTLXC=.. GUESTNAME=.. GUESTHOSTNAME=.."
+       @exit 1
 else
-       +$(RSYNC) host.init $(PLCSSH):/etc/init.d/plc
-       +$(RSYNC) guest.init $(PLCSSH):/plc/root/etc/init.d/plc
-       +$(RSYNC) $(BINARIES) $(PLCSSH):/plc/root/usr/bin
-       +$(RSYNC) $(INITS) $(PLCSSH):/plc/root/etc/plc.d
-       +$(RSYNC) plc_config.py $(PLCSSH):/plc/root/usr/lib/python2.4/site-packages/plc_config.py
-       +$(RSYNC) default_config.xml $(PLCSSH):/plc/data/etc/planetlab/default_config.xml
-       @echo XXXXXXXX You might consider running the following command
-       @echo ssh $(PLCSSH) chroot /plc/root service plc start 
+       +$(RSYNC) plc.init $(SSHURL)/etc/init.d/plc
+       +$(RSYNC) bin/ $(SSHURL)/usr/bin/
+       +$(RSYNC) plc.d/ $(SSHURL)/etc/plc.d/
+       +$(RSYNC) db-config.d/ $(SSHURL)/etc/planetlab/db-config.d/
+       +$(RSYNC) plc_config.py $(SSHURL)/usr/lib\*/python2.\*/site-packages/plc_config.py
+       +$(RSYNC) default_config.xml $(SSHURL)/etc/planetlab/default_config.xml
+       @echo XXXXXXXX you might need to run $(SSHCOMMAND) service plc start 
 endif
 
+#################### convenience, for debugging only
+# make +foo : prints the value of $(foo)
+# make ++foo : idem but verbose, i.e. foo=$(foo)
+++%: varname=$(subst +,,$@)
+++%:
+       @echo "$(varname)=$($(varname))"
++%: varname=$(subst +,,$@)
++%:
+       @echo "$($(varname))"
 
-tags:
-       find . -type f | egrep -v '.svn/|~$$' | xargs etags