fix cut-n-paste error
[build.git] / onelab-install.mk
1 #
2 # Thierry Parmentelat - INRIA Sophia Antipolis 
3 #
4 ### $Id: onelab-install.mk 685 2007-07-19 09:01:41Z thierry $
5
6 # Installation rules
7
8
9 # make install :
10 #       uses $(PLCSSH) as an ssh address for the destination host
11 #       first copies everything on a separate rpm repo, prepares it, 
12 #       and then renames it into planetlab
13
14 # Upload packages to boot server
15
16 # use PLCHOST if set
17 ifdef PLCHOST
18 PLCSSH:=root@$(PLCHOST)
19 endif
20 # if nothing's defined : use this default
21 ifndef PLCSSH
22 PLCSSH          := root@private.one-lab.org
23 endif
24
25 RPMSAREA        := /var/www/html/install-rpms/
26 BOOTAREA        := /var/www/html/boot/
27
28 #BASE           := onelab
29 BASENEW         := build-$(notdir $(shell pwd))
30 BASEBAK         := planetlab-bak
31 BASE            := planetlab
32
33 ##########
34 # if make is invoked with -n, run rsync, but with --dry-run
35 RSYNC_COND_DRY_RUN      := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
36 RSYNC                   := rsync $(RSYNC_COND_DRY_RUN) 
37
38 INSTALL-TARGETS := install-rpms install-index install-adopt install-bootstrap
39 install: $(INSTALL-TARGETS)
40 .PHONY: install $(INSTALL-TARGETS)
41
42 install-help:
43         @echo install: $(INSTALL-TARGETS)
44
45 install-rpms:RPMS/yumgroups.xml
46         # create repository
47         ssh $(PLCSSH) mkdir -p /plc/data/$(RPMSAREA)/$(BASENEW)
48         # populate
49         +$(RSYNC) -v --perms --times --group --compress --rsh=ssh \
50            RPMS/yumgroups.xml $(wildcard RPMS/*/*.rpm) $(PLCSSH):/plc/data/$(RPMSAREA)/$(BASENEW)/
51
52 install-index:
53         # sign and index new repository
54         ssh $(PLCSSH) chroot /plc/root /etc/plc.d/packages start $(RPMSAREA)/$(BASENEW)/ 2>> install-index.log
55
56 install-clean-index:
57         # sign and index new repository
58         ssh $(PLCSSH) chroot /plc/root /etc/plc.d/packages clean $(RPMSAREA)/$(BASENEW)/ 2>> install-index.log
59
60 install-adopt:
61         # cleanup former bak
62         ssh $(PLCSSH) rm -rf /plc/data/$(RPMSAREA)/$(BASEBAK)
63         # bak previous repo
64         ssh $(PLCSSH) mv /plc/data/$(RPMSAREA)/$(BASE) /plc/data/$(RPMSAREA)/$(BASEBAK)
65         # install new repo
66         ssh $(PLCSSH) mv /plc/data/$(RPMSAREA)/$(BASENEW) /plc/data/$(RPMSAREA)/$(BASE)
67
68 install-bootstrap:
69         # install node image
70         install_bz2=$(wildcard BUILD/bootmanager-*/bootmanager/support-files/PlanetLab-Bootstrap.tar.bz2) ; \
71           if [ -n "$$install_bz2" ] ; then rsync $$install_bz2 $(PLCSSH):/plc/data/$(BOOTAREA) ; fi
72
73