this sounds better although it does not fix anything
[bootcd.git] / Makefile
1 ETAGS=etags
2
3 tags:
4         find . -type f -a '!' '(' -name '*.x86' -o -name '*.x86_64' ')' | egrep -v '/\.(svn|git)/' | xargs $(ETAGS)
5
6 .PHONY: tags
7
8 #####
9 # make sync is a little more convoluted than the other variants
10 # so we call it make bootcdsync for that reason
11 #
12 # it expects the following env variables
13 #
14 # export BUILD=2015.03.05--f21
15 # export PLCHOSTLXC=deathvegas.pl.sophia.inria.fr
16 # export GUESTNAME=2015.03.05--f21-1-vplc12
17 # export GUESTHOSTNAME=vplc12.pl.sophia.inria.fr
18 # export KVMHOST=boxtops.pl.sophia.inria.fr
19 # export NODE=vnode03.pl.sophia.inria.fr
20 #
21 # and it also expects there is a reference iso file
22
23 KVMDIR=/vservers/$(BUILD)/qemu-$(NODE)
24 KVMSSH=$(KVMHOST):$(KVMDIR)
25
26 # initialize the workdir on the KVM side
27 # mount iso file, and unwrap .img files into bootcd/ and overlay/
28 sync-unwrap:
29         ssh root@$(KVMHOST) "(cd $(KVMDIR); [ -f $(NODE).iso.ref ] && exit 0; \
30                               cp $(NODE).iso $(NODE).iso.ref; \
31                               mkdir iso.ref; mount -o ro,loop $(NODE).iso.ref iso.ref; \
32                               rsync -ad iso.ref/ iso/; \
33                               mkdir bootcd.ref; ( cd bootcd.ref; gzip -dc ../iso/bootcd.img | cpio -diu); \
34                               mkdir overlay.ref; ( cd overlay.ref; gzip -dc ../iso/overlay.img | cpio -diu); \
35                               rsync -a bootcd.ref/ bootcd/ ; rsync -a overlay.ref/ overlay/; \
36                              )"
37
38 sync-clean:
39         ssh root@$(KVMHOST) "(cd $(KVMDIR); [ -f $(NODE).iso.ref ] || exit 0; \
40                               umount iso.ref; \
41                               rm -rf iso.ref iso bootcd overlay bootcd.ref overlay.ref; \
42                               mv -f $(NODE).iso.ref $(NODE).iso; \
43                              )"
44
45 # once sync-mount is OK you can start tweaking the contents of bootcd/ and overlay/ manually
46 #
47 # and then use this to rebuild a new .iso
48
49 # same as in build.sh
50 MKISOFS_OPTS="-R -J -r -f -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table"
51
52 sync-rewrap:
53         ssh root@$(KVMHOST) "(cd $(KVMDIR); \
54                              echo "Rewrapping overlay.img"; \
55                              (cd overlay && find . | cpio --quiet -c -o) | gzip -1 > iso/overlay.img; \
56                              echo "Rewrapping bootcd.img"; \
57                              (cd bootcd && find . | cpio --quiet -c -o) | gzip -1 > iso/bootcd.img; \
58                              mkisofs -o $(NODE).iso $(MKISOFS_OPTS) iso/; \
59                             )"