xref: /titanic_51/usr/src/cmd/svc/seed/Makefile (revision 1bdd6c0e3710e91cb1f31aa78de33cb638494480)
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 2008 Sun Microsystems, Inc.  All rights reserved.
22# Use is subject to license terms.
23#
24
25include ../../Makefile.cmd
26
27ETCSVC = $(ROOTETC)/svc
28LIBSVCSEED = $(ROOT)/lib/svc/seed
29INSTALLSEED = $(ROOT)/usr/sadm/install
30
31#
32# Because seed repository construction requires a functioning repository, a
33# working svccfg(1) binary, and XML support, the following libraries must exist
34# on the build system or in the proto area:  libscf, libuutil, and libxml2.
35#
36
37#
38# We build and deliver 3 seed repositories:
39#	global.db	-- for a standalone Solaris (global zone)
40#	nonglobal.db	-- for a Solaris Zone
41#	miniroot.db	-- for the install miniroot
42# COMMON_DESCRIPTIONS contains manifests needed by all 3 repositories.
43# GLOBAL_ZONE_DESCRIPTIONS/NONGLOBAL_ZONE_DESCRIPTIONS/MINIROOT_DESCRIPTIONS
44# contain additional manifests needed.
45#
46
47#
48# Manifests needed by all seed repositories. If you change this, you
49# must test Solaris standalone, Solaris zone, and Install miniroot.
50#
51COMMON_DESCRIPTIONS = \
52	../milestone/boot-archive.xml \
53	../milestone/devices-local.xml \
54	../milestone/global.xml \
55	../milestone/identity.xml \
56	../milestone/local-fs.xml \
57	../milestone/manifest-import.xml \
58	../milestone/minimal-fs.xml \
59	../milestone/multi-user.xml \
60	../milestone/name-services.xml \
61	../milestone/network-initial.xml \
62	../milestone/network-loopback.xml \
63	../milestone/network-physical.xml \
64	../milestone/restarter.xml \
65	../milestone/root-fs.xml \
66	../milestone/single-user.xml \
67	../milestone/usr-fs.xml \
68	../../dlmgmtd/dlmgmt.xml \
69	../../rpcbind/bind.xml \
70
71#
72# Additional manifests for standalone Solaris
73#
74GLOBAL_ZONE_DESCRIPTIONS = \
75	../milestone/console-login.xml \
76	../milestone/multi-user-server.xml \
77	../../cmd-inet/usr.lib/inetd/inetd-upgrade.xml \
78	../../utmpd/utmp.xml \
79	../../lvm/util/metainit.xml
80
81#
82# Additional manifests for a Solaris zone
83#
84NONGLOBAL_ZONE_DESCRIPTIONS = \
85	../milestone/console-login.xml \
86	../milestone/multi-user-server.xml \
87	../../utmpd/utmp.xml
88
89#
90# Additional manifests for the install miniroot.
91#
92MINIROOT_DESCRIPTIONS= \
93	../milestone/sysconfig.xml \
94	../../cmd-inet/usr.lib/inetd/inetd.xml \
95	../../cmd-inet/usr.sbin/login.xml \
96	../milestone/network-service.xml \
97	../../cmd-inet/usr.sbin/telnet.xml \
98	../../../lib/libresolv2/client.xml \
99	../../ldapcachemgr/client.xml \
100	../../ypcmd/client.xml \
101	../../ypcmd/server.xml \
102	../../keyserv/keyserv.xml \
103	../../rpcsvc/nisplus.xml \
104	../../cmd-crypto/scripts/cryptosvc.xml \
105	../../nscd/name-service-cache.xml \
106	../../syslogd/system-log.xml
107
108OWNER = root
109GROUP = sys
110FILEMODE = 0600
111SEEDFILEMODE = 0444		# seeds are not intended for editing, but may
112				# be copied
113
114CONFIGD = ../configd/svc.configd-native
115SVCCFG = ../svccfg/svccfg-native
116
117.KEEP_STATE:
118
119all: global.db nonglobal.db miniroot.db
120
121$(CONFIGD): FRC
122	@cd ../configd; pwd; $(MAKE) $(MFLAGS) native
123
124$(SVCCFG): FRC
125	@cd ../svccfg; pwd; $(MAKE) $(MFLAGS) native
126
127../milestone/console-login.xml:
128	@cd ../milestone; pwd; $(MAKE) $(MFLAGS) console-login.xml
129
130common.db: $(COMMON_DESCRIPTIONS) $(CONFIGD) $(SVCCFG)
131	$(RM) -f common.db common.db-journal
132	for m in $(COMMON_DESCRIPTIONS); do \
133		echo $$m; \
134		SVCCFG_DTD=../dtd/service_bundle.dtd.1 \
135		SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/common.db \
136		SVCCFG_CONFIGD_PATH=$(CONFIGD) \
137		$(SVCCFG) import $$m; \
138	done
139
140global.db: common.db $(GLOBAL_ZONE_DESCRIPTIONS) $(CONFIGD) $(SVCCFG)
141	$(RM) -f global.db global.db-journal
142	$(CP) common.db global.db
143	for m in $(GLOBAL_ZONE_DESCRIPTIONS); do \
144		echo $$m; \
145		SVCCFG_DTD=../dtd/service_bundle.dtd.1 \
146		SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/global.db \
147		SVCCFG_CONFIGD_PATH=$(CONFIGD) \
148		$(SVCCFG) import $$m; \
149	done
150
151nonglobal.db: common.db $(NONGLOBAL_ZONE_DESCRIPTIONS) $(CONFIGD) $(SVCCFG)
152	$(RM) -f nonglobal.db nonglobal.db-journal
153	$(CP) common.db nonglobal.db
154	for m in $(NONGLOBAL_ZONE_DESCRIPTIONS); do \
155		echo $$m; \
156		SVCCFG_DTD=../dtd/service_bundle.dtd.1 \
157		SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/nonglobal.db \
158		SVCCFG_CONFIGD_PATH=$(CONFIGD) \
159		$(SVCCFG) import $$m; \
160	done
161
162miniroot.db: common.db $(MINIROOT_DESCRIPTIONS) $(CONFIGD) $(SVCCFG)
163	$(RM) -f miniroot.db miniroot.db-journal
164	$(CP) common.db miniroot.db
165	for m in $(MINIROOT_DESCRIPTIONS); do \
166		echo $$m; \
167		SVCCFG_DTD=../dtd/service_bundle.dtd.1 \
168		SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/miniroot.db \
169		SVCCFG_CONFIGD_PATH=$(CONFIGD) \
170		$(SVCCFG) import $$m; \
171	done
172	#
173	# Make sure the miniroot's syslogd and rpcbind do not respond
174	# to packets from outside the machine. Since we cannot set property
175	# values by applying a profile yet, we need to set them explicitly
176	# with svccfg commands.
177	#
178	SVCCFG_DTD=../dtd/service_bundle.dtd.1 \
179	SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/miniroot.db \
180	SVCCFG_CONFIGD_PATH=$(CONFIGD) \
181	$(SVCCFG) -s svc:/system/system-log \
182	    setprop config/log_from_remote = false
183	#
184	SVCCFG_DTD=../dtd/service_bundle.dtd.1 \
185	SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/miniroot.db \
186	SVCCFG_CONFIGD_PATH=$(CONFIGD) \
187	$(SVCCFG) -s svc:/network/rpc/bind setprop config/local_only = true
188
189install: install_global install_nonglobal install_miniroot
190
191install_global: global.db
192	$(RM) $(LIBSVCSEED)/global.db
193	$(INS) -f $(LIBSVCSEED) -m $(SEEDFILEMODE) -s global.db
194
195install_nonglobal: nonglobal.db
196	$(RM) $(LIBSVCSEED)/nonglobal.db
197	$(INS) -f $(LIBSVCSEED) -m $(SEEDFILEMODE) -s nonglobal.db
198
199install_miniroot: $(INSTALLSEED) miniroot.db
200	$(RM) $(INSTALLSEED)/miniroot.db
201	$(INS) -f $(INSTALLSEED) -m $(SEEDFILEMODE) -s miniroot.db
202
203$(INSTALLSEED):
204	$(INS.dir)
205
206clean lint:
207	$(RM) common.db
208
209clobber:
210	$(RM) common.db global.db nonglobal.db miniroot.db
211
212FRC:
213