a few tweaks for having modules.list correctly updated
[build.git] / onelab-install.mk
1 #
2 # Thierry Parmentelat - INRIA Sophia Antipolis 
3 #
4 ### $Id$
5
6 # Installation rules
7
8
9 install:
10         @echo WARNING: this target is deprecated
11         @echo you might siwh to use the noderepo rpm instead
12         @echo former behaviour is available throuhg make install-obsolete
13
14 # make install :
15 #       uses $(PLCSSH) as an ssh address for the destination host
16 #       first copies everything on a separate rpm repo, prepares it, 
17 #       and then renames it into planetlab
18
19 # Upload packages to boot server
20
21 # use PLCHOST if set
22 ifdef PLCHOST
23 PLCSSH:=root@$(PLCHOST)
24 endif
25 # if nothing's defined : use this default
26 ifndef PLCSSH
27 PLCSSH          := root@private.one-lab.org
28 endif
29
30 RPMSAREA        := /var/www/html/install-rpms/
31
32 BUILD_BASE      := $(shell cat .base 2> /dev/null || echo base-undefined)
33 BASENEW         := build-$(BUILD_BASE)
34 BASEBAK         := planetlab-bak
35 BASE            := planetlab
36
37 ##########
38 # if make is invoked with -n, run rsync, but with --dry-run
39 RSYNC_COND_DRY_RUN      := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
40 RSYNC                   := rsync $(RSYNC_COND_DRY_RUN) 
41
42 INSTALL-TARGETS := install-rpms install-index install-adopt install-bootstrap
43 install-obsolete: $(INSTALL-TARGETS)
44 .PHONY: install install-obsolete $(INSTALL-TARGETS)
45
46 install-help:
47         @echo install-obsolete: $(INSTALL-TARGETS)
48
49 # compute the exact set of rpms to install - we do not need bootstrapfs nor myplc here
50 node_packages=$(sort $(IN_VSERVER) $(IN_BOOTSTRAPFS))
51 node_rpms=$(foreach package,$(node_packages),$($(package).rpms))
52
53 install-rpms:RPMS/yumgroups.xml
54         # create repository
55         ssh $(PLCSSH) mkdir -p /plc/data/$(RPMSAREA)/$(BASENEW)
56         # populate
57         +$(RSYNC) -v --perms --times --group --compress --rsh=ssh \
58            RPMS/yumgroups.xml $(node_rpms) $(PLCSSH):/plc/data/$(RPMSAREA)/$(BASENEW)/
59
60 install-index:
61         # sign and index new repository
62         ssh $(PLCSSH) chroot /plc/root /etc/plc.d/packages start $(RPMSAREA)/$(BASENEW)/ 2>> install-index.log
63
64 install-clean-index:
65         # sign and index new repository
66         ssh $(PLCSSH) chroot /plc/root /etc/plc.d/packages clean $(RPMSAREA)/$(BASENEW)/ 2>> install-index.log
67
68 install-adopt:
69         # cleanup former bak
70         ssh $(PLCSSH) rm -rf /plc/data/$(RPMSAREA)/$(BASEBAK)
71         # bak previous repo
72         ssh $(PLCSSH) mv /plc/data/$(RPMSAREA)/$(BASE) /plc/data/$(RPMSAREA)/$(BASEBAK)
73         # install new repo
74         ssh $(PLCSSH) mv /plc/data/$(RPMSAREA)/$(BASENEW) /plc/data/$(RPMSAREA)/$(BASE)
75
76 install-bootstrap:
77         # install node image
78         ssh $(PLCSSH) chroot /plc/root yum -y update bootstrapfs