4
|
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 (the "License").
|
|
6 |
# You may not use this file except in compliance with the License.
|
|
7 |
#
|
|
8 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
|
9 |
# or http://www.opensolaris.org/os/licensing.
|
|
10 |
# See the License for the specific language governing permissions
|
|
11 |
# and limitations under the License.
|
|
12 |
#
|
|
13 |
# When distributing Covered Code, include this CDDL HEADER in each
|
|
14 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
|
15 |
# If applicable, add the following below this CDDL HEADER, with the
|
|
16 |
# fields enclosed by brackets "[]" replaced with your own identifying
|
|
17 |
# information: Portions Copyright [yyyy] [name of copyright owner]
|
|
18 |
#
|
|
19 |
# CDDL HEADER END
|
|
20 |
#
|
|
21 |
# Copyright (c) 2010, Oracle and/or it's affiliates. All rights reserved.
|
|
22 |
#
|
|
23 |
|
|
24 |
#
|
|
25 |
# Rules and Macros for creating a template build zone from the installed system
|
|
26 |
# and a set of build zones that are clones of the template build zone.
|
|
27 |
#
|
|
28 |
# To use these rules to create a template build zone
|
|
29 |
# $ gmake -f make-rules/build-zone.mk template-build-zone
|
|
30 |
#
|
|
31 |
# To use these rules to clone the template zone
|
|
32 |
# $ gmake -f make-rules/build-zone.mk build-zone-[1-9]
|
|
33 |
# or
|
|
34 |
# $ gmake -f make-rules/build-zone.mk \
|
|
35 |
# /rpool/zones/build-zone-{*}/root/etc/sysidcfg
|
|
36 |
#
|
|
37 |
# Before you create any cloned build zones, it is recommended that you create
|
|
38 |
# the template build zone, boot it, and make any customizations to it first.
|
|
39 |
# The act of booting the template zone will cause it to perform any "first boot"
|
|
40 |
# tasks that might othwise slow down the initial boot of a new build zone.
|
|
41 |
# Also, all customizations of the template zone will only propagate to the build
|
|
42 |
# zones when they are created.
|
|
43 |
#
|
|
44 |
|
|
45 |
ZONECFG = /usr/sbin/zonecfg
|
|
46 |
ZONEADM = /usr/sbin/zoneadm
|
|
47 |
TZ= $(shell sed -e '/^TZ=/!d' -e 's;TZ=;;' /etc/default/init)
|
|
48 |
|
|
49 |
ZONESCFG_DIR = /etc/zones
|
|
50 |
BUILD_ZONE_SPACE = /rpool/zones
|
|
51 |
|
|
52 |
TOUCH = /usr/bin/touch
|
|
53 |
|
|
54 |
SYSIDCFG = root/etc/sysidcfg
|
|
55 |
ZI_TAG = root/.installed
|
|
56 |
|
|
57 |
# the name of the template build zone
|
|
58 |
TMPL_ZONE_NAME = template-build-zone
|
|
59 |
|
|
60 |
# the default package set to add to the template build zone.
|
|
61 |
TMPL_ZONE_PKGS = sunstudio12u1
|
|
62 |
TMPL_ZONE_PKGS += gcc-3
|
|
63 |
TMPL_ZONE_PKGS += gnu-make
|
|
64 |
TMPL_ZONE_PKGS += autoconf
|
|
65 |
TMPL_ZONE_PKGS += automake-110
|
|
66 |
TMPL_ZONE_PKGS += libtool
|
|
67 |
|
|
68 |
template-build-zone: $(BUILD_ZONE_SPACE)/$(TMPL_ZONE_NAME)/$(SYSIDCFG)
|
|
69 |
build-zone-1: $(BUILD_ZONE_SPACE)/build-zone-1/$(SYSIDCFG)
|
|
70 |
build-zone-2: $(BUILD_ZONE_SPACE)/build-zone-2/$(SYSIDCFG)
|
|
71 |
build-zone-3: $(BUILD_ZONE_SPACE)/build-zone-3/$(SYSIDCFG)
|
|
72 |
build-zone-4: $(BUILD_ZONE_SPACE)/build-zone-4/$(SYSIDCFG)
|
|
73 |
build-zone-5: $(BUILD_ZONE_SPACE)/build-zone-5/$(SYSIDCFG)
|
|
74 |
build-zone-6: $(BUILD_ZONE_SPACE)/build-zone-6/$(SYSIDCFG)
|
|
75 |
build-zone-7: $(BUILD_ZONE_SPACE)/build-zone-7/$(SYSIDCFG)
|
|
76 |
build-zone-8: $(BUILD_ZONE_SPACE)/build-zone-8/$(SYSIDCFG)
|
|
77 |
build-zone-9: $(BUILD_ZONE_SPACE)/build-zone-9/$(SYSIDCFG)
|
|
78 |
|
|
79 |
# zone install options. The template zone uses "install", while the build
|
|
80 |
# zones "clone" the template zone.
|
|
81 |
ZI_OPT = clone $(TMPL_ZONE_NAME)
|
|
82 |
$(BUILD_ZONE_SPACE)/$(TMPL_ZONE_NAME)/$(ZI_TAG): \
|
|
83 |
ZI_OPT = install $(TMPL_ZONE_PKGS:%=-e %)
|
|
84 |
|
|
85 |
$(BUILD_ZONE_SPACE):
|
|
86 |
$(MKDIR) $@
|
|
87 |
|
|
88 |
# configure a zone
|
|
89 |
$(ZONECFG_DIR)/%.xml: $(BUILD_ZONE_SPACE)
|
|
90 |
( echo "create -b"; \
|
|
91 |
echo "set zonepath=$(BUILD_ZONE_SPACE)/$(@:$(ZONECFG_DIR)/%.xml=%)"; \
|
|
92 |
echo "set brand=ipkg"; \
|
|
93 |
echo "set autoboot=false"; \
|
|
94 |
echo "verify"; \
|
|
95 |
echo "commit" ) | $(ZONECFG) -z $(@:$(ZONECFG_DIR)/%.xml=%)
|
|
96 |
|
|
97 |
# install a zone
|
|
98 |
$(BUILD_ZONE_SPACE)/%/$(ZI_TAG): $(ZONECFG_DIR)/%.xml
|
|
99 |
$(ZONEADM) -z $(@:$(BUILD_ZONE_SPACE)/%/$(ZI_TAG)=%) $(ZI_OPT)
|
|
100 |
|
|
101 |
$(BUILD_ZONE_SPACE)/%/$(SYSIDCFG): $(BUILD_ZONE_SPACE)/%/$(ZI_TAG)
|
|
102 |
( echo "system_locale=C"; \
|
|
103 |
echo "timezone=$(TZ)"; \
|
|
104 |
echo "terminal=xterms"; \
|
|
105 |
echo "security_policy=NONE"; \
|
|
106 |
echo "timeserver=localhost"; \
|
|
107 |
echo "name_service=NONE"; \
|
|
108 |
echo "network_interface=none {"; \
|
|
109 |
echo " hostname=$(@:$(BUILD_ZONE_SPACE)/%/$(SYSIDCFG)=%)"; \
|
|
110 |
echo "}"; \
|
|
111 |
echo "nfs4_domain=dynamic"; \
|
|
112 |
echo "root_password=NP" ) > $@
|