2 # Node Manager Makefile
4 # David Eisenstat <deisenst@cs.princeton.edu>
5 # Mark Huang <mlhuang@cs.princeton.edu>
6 # Copyright (C) 2006 The Trustees of Princeton University
9 # autoconf compatible variables
12 initdir=/etc/rc.d/init.d
13 systemddir := /usr/lib/systemd/system
15 # call with either WITH_SYSTEMD=true or WITH_INIT=true
16 # otherwise we try to guess some reasonable default
17 ifeq "$(WITH_INIT)$(WITH_SYSTEMD)" ""
18 ifeq "$(wildcard $systemddir/*)" ""
25 all: forward_api_calls
28 forward_api_calls: forward_api_calls.c
29 $(CC) -Wall -Os -o $@ $?
32 #################### install
33 install: install-miscell install-startup
34 python setup.py install \
35 --install-purelib=$(DESTDIR)/$(datadir)/NodeManager \
36 --install-platlib=$(DESTDIR)/$(datadir)/NodeManager \
37 --install-scripts=$(DESTDIR)/$(bindir)
38 chmod +x $(DESTDIR)/$(datadir)/NodeManager/conf_files.py
40 # might be better in setup.py ?
41 # NOTE: the sliver-initscripts/ and sliver-systemd stuff, being, well, for slivers,
42 # need to ship on all nodes regardless of WITH_INIT and WITH_SYSTEMD that
43 # impacts how nodemanager itself gets started
45 install -d -m 755 $(DESTDIR)/var/lib/nodemanager
46 install -D -m 644 /dev/null $(DESTDIR)/etc/sysconfig/nodemanager
47 install -D -m 444 README $(DESTDIR)/$(datadir)/NodeManager/README
48 install -D -m 644 logrotate/nodemanager $(DESTDIR)/etc/logrotate.d/nodemanager
49 mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts
50 rsync -av sliver-initscripts/ $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts/
51 chmod 755 $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts/
52 mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd
53 rsync -av sliver-systemd/ $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd/
54 chmod 755 $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd/
56 # this now is for the startup of nodemanager itself
57 ifneq "$(WITH_SYSTEMD)" ""
58 install-startup: install-systemd
60 ifneq "$(WITH_INIT)" ""
61 install-startup: install-init
65 mkdir -p $(DESTDIR)$(initdir)
66 chmod 755 initscripts/*
67 rsync -av initscripts/ $(DESTDIR)$(initdir)/
70 mkdir -p $(DESTDIR)/$(systemddir)
71 rsync -av systemd/ $(DESTDIR)/$(systemddir)
73 #################### clean
76 rm -f forward_api_calls *.pyc build
78 .PHONY: all install clean
80 #################### debian-related
81 # This is called from the build with the following variables set
82 # (see build/Makefile and target_debian)
87 DEBVERSION=$(RPMVERSION).$(RPMRELEASE)
88 DEBTARBALL=../$(RPMNAME)_$(DEBVERSION).orig.tar.bz2
89 DATE=$(shell date -u +"%a, %d %b %Y %T")
92 debian: DESTDIR=debian/tmp
93 debian: forward_api_calls install debian/changelog debian.source debian.package
95 debian/changelog: debian/changelog.in
96 sed -e "s|@VERSION@|$(DEBVERSION)|" -e "s|@DATE@|$(DATE)|" debian/changelog.in > debian/changelog
99 rsync -a $(RPMTARBALL) $(DEBTARBALL)
102 debuild --set-envvar PREFIX=/usr -uc -us -b
105 $(MAKE) -f debian/rules clean
106 rm -rf build/ MANIFEST ../*.tar.gz ../*.dsc ../*.build
107 find . -name '*.pyc' -delete
109 ################################################## devel-oriented
111 git ls-files | xargs etags
116 # for use with the test framework; push local stuff on a test node
117 # howto use: go on testmaster in the build you want to use and just run
119 # cut'n paste the result in a terminal in your working dir, e.g. (although all are not required)
120 # $ export BUILD=2013.07.02--lxc18
121 # $ export PLCHOSTLXC=gotan.pl.sophia.inria.fr
122 # $ export GUESTNAME=2013.07.02--lxc18-1-vplc01
123 # $ export GUESTHOSTNAME=vplc01.pl.sophia.inria.fr
124 # $ export KVMHOST=kvm64-6.pl.sophia.inria.fr
125 # $ export NODE=vnode01.pl.sophia.inria.fr
129 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc'
130 RSYNC_EXCLUDES := --exclude .git --exclude .svn --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
131 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
132 RSYNC := rsync -e "ssh -i $(NODE).key.rsa" -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
135 NODEURL:=root@$(NODE):/
138 # this is for lxc only, we need to exclude the vs stuff that otherwise messes up everything on node
139 # WARNING: keep this in sync with setup.spec
140 LXC_EXCLUDES= --exclude sliver_vs.py --exclude coresched_vs.py --exclude drl.py
142 # run with make SYNC_RESTART=false if you want to skip restarting nm
147 synclxc: $(NODE).key.rsa
149 @echo "sync: You must define NODE on the command line"
150 @echo " e.g. make sync NODE=vnode01.inria.fr"
153 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
154 @echo WARNING : this target might not be very reliable - use with care
155 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
156 +$(RSYNC) $(LXC_EXCLUDES) --delete-excluded ./ $(NODEURL)/usr/share/NodeManager/
157 # +$(RSYNC) ./initscripts/ $(NODEURL)/etc/init.d/
158 +$(RSYNC) ./systemd/ $(NODEURL)/usr/lib/systemd/system/
159 -$(SYNC_RESTART) && { ssh -i $(NODE).key.rsa root@$(NODE) service nm restart ; } ||:
162 # this is for vs only, we need to exclude the lxc stuff that otherwise messes up everything on node
163 # xxx keep this in sync with setup.spec
164 VS_EXCLUDES= --exclude sliver_libvirt.py --exclude sliver_lxc.py --exclude cgroups.py --exclude coresched_lxc.py --exclude privatebridge.py
166 syncvs: $(NODE).key.rsa
168 @echo "syncvs: You must define NODE on the command line"
169 @echo " e.g. make sync NODE=vnode01.inria.fr"
172 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
173 @echo WARNING : this target might not be very reliable - use with care
174 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
175 +$(RSYNC) $(VS_EXCLUDES) --delete-excluded ./ $(NODEURL)/usr/share/NodeManager/
176 +$(RSYNC) ./initscripts/ $(NODEURL)/etc/init.d/
177 # +$(RSYNC) ./systemd/ $(NODEURL)/usr/lib/systemd/system/
178 -$(SYNC_RESTART) && { ssh -i $(NODE).key.rsa root@$(NODE) service nm restart ; } ||:
184 TESTMASTER ?= testmaster.onelab.eu
187 KEYURL:=root@$(TESTMASTER):$(BUILD)/keys/key_admin.rsa
194 @echo "sync: fetching $@ - You must define TESTMASTER, BUILD and NODE on the command line"
195 @echo " e.g. make sync TESTMASTER=testmaster.onelab.eu BUILD=2010.01.22--1l-f8-32 NODE=vnode01.inria.fr"
196 @echo " note that for now all test builds use the same key, so any BUILD would do"
207 $(RSYNC) sliver-systemd/vinit.st* $(NODEURL)/vservers/$(SLICE)/usr/bin/
208 $(RSYNC) sliver-systemd/vinit.service $(NODEURL)/vservers/$(SLICE)/usr/lib/systemd/system/
209 echo "remember to run 'systemctl --system daemon-reload' within this slice"