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