password generation utility was still python2
[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 # -- or -- use this target to push the files in initscripts/ and systemd/ into
48 # that newly created bootcd/ before running sync-rewrap
49 RSYNC = rsync -av --exclude .du
50
51 sync-push:
52         $(RSYNC) initscripts/ root@$(KVMHOST):$(KVMDIR)/bootcd/etc/init.d/
53         $(RSYNC) systemd/ root@$(KVMHOST):$(KVMDIR)/bootcd/etc/systemd/system/
54
55 # and then use this to rebuild a new .iso
56
57 # same as in build.sh
58 MKISOFS_OPTS="-R -J -r -f -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table"
59
60 sync-rewrap:
61         ssh root@$(KVMHOST) "(cd $(KVMDIR); \
62                              echo "Rewrapping overlay.img"; \
63                              (cd overlay && find . | cpio --quiet -c -o) | gzip -1 > iso/overlay.img; \
64                              echo "Rewrapping bootcd.img"; \
65                              (cd bootcd && find . | cpio --quiet -c -o) | gzip -1 > iso/bootcd.img; \
66                              mkisofs -o $(NODE).iso $(MKISOFS_OPTS) iso/; \
67                             )"
68
69 # install just build.sh in the myplc - assuming it has no bonding links..
70 sync-build:
71         $(RSYNC) build.sh root@$(PLCHOSTLXC):/vservers/$(GUESTNAME)/usr/share/bootcd\*/