can use make sync to push a working version on a tesst node
[lxc-userspace.git] / Makefile
1 all:
2         python setup.py build
3         gcc vsh.c -o vsh
4
5 ########## sync
6 # for use with the test framework; push local stuff on a test node
7 # howto use: go on testmaster in the build you want to use and just run
8 # $ exp
9 # cut'n paste the result in a terminal in your working dir, e.g. (although all are not required)
10 # $ export BUILD=2013.07.02--lxc18
11 # $ export PLCHOSTLXC=gotan.pl.sophia.inria.fr
12 # $ export GUESTNAME=2013.07.02--lxc18-1-vplc01
13 # $ export GUESTHOSTNAME=vplc01.pl.sophia.inria.fr
14 # $ export KVMHOST=kvm64-6.pl.sophia.inria.fr
15 # $ export NODE=vnode01.pl.sophia.inria.fr
16 # and then just run
17 # $ make sync
18 # this will attempt to compile vsh from vsh.c (and will push Makefile.vsh in /usr/sbin/)
19 # so you might have to yum install gcc
20
21 LOCAL_RSYNC_EXCLUDES    := --exclude '*.pyc' 
22 RSYNC_EXCLUDES          := --exclude .git  --exclude .svn --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
23 RSYNC_COND_DRY_RUN      := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
24 RSYNC                   := rsync -e "ssh -i $(NODE).key.rsa" -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
25
26 ifdef NODE
27 NODEURL:=root@$(NODE):/
28 endif
29
30 sync: $(NODE).key.rsa
31 ifeq (,$(NODEURL))
32         @echo "sync: You must define NODE on the command line"
33         @echo "  e.g. make sync NODE=vnode01.inria.fr"
34         @exit 1
35 else
36         +$(RSYNC) ./lxcsu ./lxcsu-internal ./vsh.c ./Makefile.vsh $(NODEURL)/usr/sbin/
37         ssh -i $(NODE).key.rsa root@$(NODE) make -C /usr/sbin -f Makefile.vsh vsh
38 endif
39
40 ### fetching the key
41
42 TESTMASTER ?= testmaster.onelab.eu
43
44 ifdef BUILD
45 KEYURL:=root@$(TESTMASTER):$(BUILD)/keys/key_admin.rsa
46 endif
47
48 key: $(NODE).key.rsa
49
50 $(NODE).key.rsa:
51 ifeq (,$(KEYURL))
52         @echo "sync: fetching $@ - You must define TESTMASTER, BUILD and NODE on the command line"
53         @echo "  e.g. make sync TESTMASTER=testmaster.onelab.eu BUILD=2010.01.22--1l-f8-32 NODE=vnode01.inria.fr"
54         @echo "  note that for now all test builds use the same key, so any BUILD would do"
55         @exit 1
56 else
57         @echo "FETCHING key"
58         +scp $(KEYURL) $@
59 endif