xref: /titanic_41/usr/src/cmd/svc/seed/Makefile (revision bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2eb)
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 2009 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	../../cmd-crypto/scripts/cryptosvc.xml \
104	../../nscd/name-service-cache.xml \
105	../../syslogd/system-log.xml
106
107FILEMODE = 0600
108SEEDFILEMODE = 0444		# seeds are not intended for editing, but may
109				# be copied
110
111CONFIGD = ../configd/svc.configd-native
112SVCCFG = ../svccfg/svccfg-native
113
114.KEEP_STATE:
115
116all: global.db nonglobal.db miniroot.db
117
118$(CONFIGD): FRC
119	@cd ../configd; pwd; $(MAKE) $(MFLAGS) native
120
121$(SVCCFG): FRC
122	@cd ../svccfg; pwd; $(MAKE) $(MFLAGS) native
123
124../milestone/console-login.xml:
125	@cd ../milestone; pwd; $(MAKE) $(MFLAGS) console-login.xml
126
127common.db: $(COMMON_DESCRIPTIONS) $(CONFIGD) $(SVCCFG)
128	$(RM) -f common.db common.db-journal
129	for m in $(COMMON_DESCRIPTIONS); do \
130		echo $$m; \
131		SVCCFG_DTD=../dtd/service_bundle.dtd.1 \
132		SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/common.db \
133		SVCCFG_CONFIGD_PATH=$(CONFIGD) \
134		$(SVCCFG) import $$m; \
135	done
136
137global.db: common.db $(GLOBAL_ZONE_DESCRIPTIONS) $(CONFIGD) $(SVCCFG)
138	$(RM) -f global.db global.db-journal
139	$(CP) common.db global.db
140	for m in $(GLOBAL_ZONE_DESCRIPTIONS); do \
141		echo $$m; \
142		SVCCFG_DTD=../dtd/service_bundle.dtd.1 \
143		SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/global.db \
144		SVCCFG_CONFIGD_PATH=$(CONFIGD) \
145		$(SVCCFG) import $$m; \
146	done
147
148nonglobal.db: common.db $(NONGLOBAL_ZONE_DESCRIPTIONS) $(CONFIGD) $(SVCCFG)
149	$(RM) -f nonglobal.db nonglobal.db-journal
150	$(CP) common.db nonglobal.db
151	for m in $(NONGLOBAL_ZONE_DESCRIPTIONS); do \
152		echo $$m; \
153		SVCCFG_DTD=../dtd/service_bundle.dtd.1 \
154		SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/nonglobal.db \
155		SVCCFG_CONFIGD_PATH=$(CONFIGD) \
156		$(SVCCFG) import $$m; \
157	done
158
159miniroot.db: common.db $(MINIROOT_DESCRIPTIONS) $(CONFIGD) $(SVCCFG)
160	$(RM) -f miniroot.db miniroot.db-journal
161	$(CP) common.db miniroot.db
162	for m in $(MINIROOT_DESCRIPTIONS); do \
163		echo $$m; \
164		SVCCFG_DTD=../dtd/service_bundle.dtd.1 \
165		SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/miniroot.db \
166		SVCCFG_CONFIGD_PATH=$(CONFIGD) \
167		$(SVCCFG) import $$m; \
168	done
169	#
170	# Make sure the miniroot's syslogd and rpcbind do not respond
171	# to packets from outside the machine. Since we cannot set property
172	# values by applying a profile yet, we need to set them explicitly
173	# with svccfg commands.
174	#
175	SVCCFG_DTD=../dtd/service_bundle.dtd.1 \
176	SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/miniroot.db \
177	SVCCFG_CONFIGD_PATH=$(CONFIGD) \
178	$(SVCCFG) -s svc:/system/system-log \
179	    setprop config/log_from_remote = false
180	#
181	SVCCFG_DTD=../dtd/service_bundle.dtd.1 \
182	SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/miniroot.db \
183	SVCCFG_CONFIGD_PATH=$(CONFIGD) \
184	$(SVCCFG) -s svc:/network/rpc/bind setprop config/local_only = true
185
186install: install_global install_nonglobal install_miniroot
187
188install_global: global.db
189	$(RM) $(LIBSVCSEED)/global.db
190	$(INS) -f $(LIBSVCSEED) -m $(SEEDFILEMODE) -s global.db
191
192install_nonglobal: nonglobal.db
193	$(RM) $(LIBSVCSEED)/nonglobal.db
194	$(INS) -f $(LIBSVCSEED) -m $(SEEDFILEMODE) -s nonglobal.db
195
196install_miniroot: $(INSTALLSEED) miniroot.db
197	$(RM) $(INSTALLSEED)/miniroot.db
198	$(INS) -f $(INSTALLSEED) -m $(SEEDFILEMODE) -s miniroot.db
199
200$(INSTALLSEED):
201	$(INS.dir)
202
203clean lint:
204	$(RM) common.db
205
206clobber:
207	$(RM) common.db global.db nonglobal.db miniroot.db
208
209FRC:
210