explicitly chdir to slice's homedir since bash does not seem to be willing to do...
[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         ssh -i $(NODE).key.rsa root@$(NODE) chown root:root /usr/sbin/lxcsu /usr/sbin/vsh
39         ssh -i $(NODE).key.rsa root@$(NODE) chmod u+s /usr/sbin/lxcsu /usr/sbin/vsh
40 endif
41
42 ### fetching the key
43
44 TESTMASTER ?= testmaster.onelab.eu
45
46 ifdef BUILD
47 KEYURL:=root@$(TESTMASTER):$(BUILD)/keys/key_admin.rsa
48 endif
49
50 key: $(NODE).key.rsa
51
52 $(NODE).key.rsa:
53 ifeq (,$(KEYURL))
54         @echo "sync: fetching $@ - You must define TESTMASTER, BUILD and NODE on the command line"
55         @echo "  e.g. make sync TESTMASTER=testmaster.onelab.eu BUILD=2010.01.22--1l-f8-32 NODE=vnode01.inria.fr"
56         @echo "  note that for now all test builds use the same key, so any BUILD would do"
57         @exit 1
58 else
59         @echo "FETCHING key"
60         +scp $(KEYURL) $@
61 endif