Masato Taruishi
taru****@sourc*****
2004年 4月 20日 (火) 16:52:23 JST
=================================================================== RCS file: ultrapossum/debian/test/umlinux/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ultrapossum/debian/test/umlinux/Makefile 2004/03/26 05:38:28 1.2 +++ ultrapossum/debian/test/umlinux/Makefile 2004/04/20 07:52:23 1.3 @@ -1,4 +1,55 @@ +ULTRAPOSSUMCFIN := ultrapossum.cf.in +ULTRAPOSSUMCF := ultrapossum.cf +ROOTSTRAPIN=/etc/rootstrap/rootstrap.conf +ROOTSTRAP=rootstrap.conf + +DEBS := $(wildcard *.deb) + + +HOSTIP := $(shell grep "^host=" $(ROOTSTRAPIN) | cut -d= -f2) +UML := $(shell grep "^uml=" $(ROOTSTRAPIN) | cut -d= -f2) + +UML_NET := $(shell echo $(UML) | cut -d. -f-3) +UML0 := $(shell echo $(UML) | cut -d. -f4) + +include $(ULTRAPOSSUMCFIN) + +SLAVES := $(shell echo $(SLURPDSLAVES) | tr -d '"') +HOSTS := $(MASTER) $(SLAVES) + +MASTERROOTS := $(patsubst %,hosts/root-%,$(MASTER)) +SLAVEROOTS := $(patsubst %,hosts/root-%,$(SLAVES)) +HOSTROOTS := $(MASTERROOTS) $(SLAVEROOTS) + +get_hostip = $(shell grep $(1) hosts.db | cut -d' ' -f1) +get_host = $(shell echo $(1) | sed -e 's!hosts/root-!!') + +all: $(HOSTROOTS) + +hosts.db: + i=$(UML0); \ + for host in $(HOSTS) virtual; do \ + echo "$(UML_NET).$$i $$host" >> hosts.db; \ + i=`expr $$i + 1`; \ + done + +# FIXME: concurrent make not yet supporte +.NOTPARALLEL: $(HOSTROOTS) +$(SLAVEROOTS): $(MASTERROOTS) +$(HOSTROOTS): hosts.db $(DEBS) + install -d hosts + sed -e "s/^modules=\(.*\) umount/modules=\\1 ultrapossum umount/" \ + -e "s/^host=.*/host=$(HOSTIP)/" \ + -e "s/^uml=.*/uml=$(call get_hostip,$(call get_host,$@))/" \ + $(ROOTSTRAPIN) > $(ROOTSTRAP); \ + echo "[ultrapossum]" >> $(ROOTSTRAP); \ + echo "hostname=$(call get_host,$@)" >> $(ROOTSTRAP); \ +# echo "interafce=eth1" >> $(ROOTSTRAP); \ +# echo " +# echo `file $@` | grep -qv "mounted" || \ +# ( /bin/rm -f $@; exit 1 ) || exit 1 + rootstrap $@ clean: /bin/rm -rf hosts.db rootstrap.conf hosts log