1 #
   2 # CDDL HEADER START
   3 #
   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License, Version 1.0 only
   6 # (the "License").  You may not use this file except in compliance
   7 # with the License.
   8 #
   9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10 # or http://www.opensolaris.org/os/licensing.
  11 # See the License for the specific language governing permissions
  12 # and limitations under the License.
  13 #
  14 # When distributing Covered Code, include this CDDL HEADER in each
  15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16 # If applicable, add the following below this CDDL HEADER, with the
  17 # fields enclosed by brackets "[]" replaced with your own identifying
  18 # information: Portions Copyright [yyyy] [name of copyright owner]
  19 #
  20 # CDDL HEADER END
  21 #
  22 #
  23 # Copyright 2012 OmniTI Computer Consulting, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 #
  26 
  27 VERSION?=$(shell awk '$$1 == "OmniOS" { print $$3 }' /etc/release)
  28 BUILDSEND=rpool/kayak_image
  29 
  30 
  31 BUILDSEND_MP=$(shell zfs get -o value -H mountpoint $(BUILDSEND))
  32 
  33 all:
  34 
  35 INSTALLS=anon.dtrace.conf anon.system build_image.sh build_zfs_send.sh \
  36         data/access.log data/boot data/etc data/filelist.ramdisk data/kernel \
  37         data/known_extras data/mdb data/platform disk_help.sh install_help.sh \
  38         install_image.sh Makefile net_help.sh README.md \
  39         sample/000000000000.sample sample/menu.lst.000000000000
  40 
  41 TFTP_FILES=$(DESTDIR)/tftpboot/boot/platform/i86pc/kernel/amd64/unix \
  42         $(DESTDIR)/tftpboot/kayak/miniroot.gz \
  43         $(DESTDIR)/tftpboot/boot/grub/menu.lst \
  44         $(DESTDIR)/tftpboot/pxegrub
  45 
  46 WEB_FILES=$(DESTDIR)/var/kayak/kayak/$(VERSION).zfs.bz2
  47 IMG_FILES=corner.png tail_bg_v1.png OmniOS_logo_medium.png tail_bg_v2.png
  48 
  49 anon.dtrace.conf:
  50         dtrace -A -q -n'int seen[string]; fsinfo:::/args[0]->fi_mount=="/" && seen[args[0]->fi_pathname]==0/{printf("%d %s\n",timestamp/1000000, args[0]->fi_pathname);seen[args[0]->fi_pathname]=1;}' -o $@.tmp
  51         cat /kernel/drv/dtrace.conf $@.tmp > $@
  52         rm $@.tmp
  53 
  54 MINIROOT_DEPS=build_image.sh anon.dtrace.conf anon.system \
  55         install_image.sh disk_help.sh install_help.sh net_help.sh
  56 
  57 $(BUILDSEND_MP)/kayak_$(VERSION).zfs.bz2:       build_zfs_send.sh
  58         @test -d "$(BUILDSEND_MP)" || (echo "$(BUILDSEND) missing" && false)
  59         ./build_zfs_send.sh -d $(BUILDSEND) $(VERSION)
  60 
  61 $(DESTDIR)/tftpboot/pxegrub:    /boot/grub/pxegrub
  62         cp -p $< $@
  63 
  64 $(DESTDIR)/tftpboot/boot/grub/menu.lst: sample/menu.lst.000000000000
  65         sed -e 's/@VERSION@/$(VERSION)/' $< > $@
  66 
  67 $(DESTDIR)/tftpboot/boot/platform/i86pc/kernel/amd64/unix:      /platform/i86pc/kernel/amd64/unix
  68         cp -p $< $@
  69 
  70 $(DESTDIR)/tftpboot/kayak/miniroot.gz:  $(BUILDSEND_MP)/miniroot.gz
  71         cp -p $< $@
  72 
  73 build_image.sh:
  74         VERSION=$(VERSION) ./build_image.sh
  75 
  76 build_zfs_send.sh:
  77         VERSION=$(VERSION) ./build_zfs_image.sh
  78 
  79 $(BUILDSEND_MP)/miniroot.gz:    $(MINIROOT_DEPS)
  80         if test -n "`zfs list -H -t snapshot $(BUILDSEND)/root@fixup 2>/dev/null`"; then \
  81           VERSION=$(VERSION) DEBUG=$(DEBUG) ./build_image.sh $(BUILDSEND) fixup ; \
  82         else \
  83           VERSION=$(VERSION) DEBUG=$(DEBUG) ./build_image.sh $(BUILDSEND) begin ; \
  84         fi
  85 
  86 $(DESTDIR)/var/kayak/kayak/$(VERSION).zfs.bz2:  $(BUILDSEND_MP)/kayak_$(VERSION).zfs.bz2
  87         cp -p $< $@
  88 
  89 tftp-dirs:
  90         mkdir -p $(DESTDIR)/tftpboot/boot/grub
  91         mkdir -p $(DESTDIR)/tftpboot/boot/platform/i86pc/kernel/amd64
  92         mkdir -p $(DESTDIR)/tftpboot/kayak
  93 
  94 server-dirs:
  95         mkdir -p $(DESTDIR)/var/kayak/kayak
  96         mkdir -p $(DESTDIR)/var/kayak/css
  97         mkdir -p $(DESTDIR)/var/kayak/img
  98         mkdir -p $(DESTDIR)/usr/share/kayak/data
  99         mkdir -p $(DESTDIR)/usr/share/kayak/sample
 100         mkdir -p $(DESTDIR)/var/kayak/log
 101         mkdir -p $(DESTDIR)/var/svc/manifest/network
 102         mkdir -p $(DESTDIR)/var/svc/method
 103 
 104 install-package:        tftp-dirs server-dirs
 105         for file in $(INSTALLS) ; do \
 106                 cp $$file $(DESTDIR)/usr/share/kayak/$$file ; \
 107         done
 108         cp http/svc-kayak $(DESTDIR)/var/svc/method/svc-kayak
 109         chmod a+x $(DESTDIR)/var/svc/method/svc-kayak
 110         cp http/css/land.css $(DESTDIR)/var/kayak/css/land.css
 111         for file in $(IMG_FILES) ; do \
 112                 cp http/img/$$file $(DESTDIR)/var/kayak/img/$$file ; \
 113         done
 114         cp http/kayak.xml $(DESTDIR)/var/svc/manifest/network/kayak.xml
 115 
 116 install-tftp:   tftp-dirs $(TFTP_FILES)
 117 
 118 install-web:    server-dirs $(WEB_FILES)