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