xref: /titanic_41/usr/src/cmd/svc/seed/Makefile (revision e4f5a11d4a234623168c1558fcdf4341e11769e1)
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 2010 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-netcfg.xml \
64	../milestone/network-physical.xml \
65	../milestone/restarter.xml \
66	../milestone/root-fs.xml \
67	../milestone/single-user.xml \
68	../milestone/usr-fs.xml \
69	../../dlmgmtd/dlmgmt.xml \
70	../../cmd-inet/lib/ipmgmtd/network-ipmgmt.xml \
71	../../rpcbind/bind.xml
72
73#
74# Additional manifests for standalone Solaris
75#
76GLOBAL_ZONE_DESCRIPTIONS = \
77	../milestone/console-login.xml \
78	../milestone/multi-user-server.xml \
79	../../cmd-inet/usr.lib/inetd/inetd-upgrade.xml \
80	../../utmpd/utmp.xml \
81	../../lvm/util/metainit.xml
82
83#
84# Additional manifests for a Solaris zone
85#
86NONGLOBAL_ZONE_DESCRIPTIONS = \
87	../milestone/console-login.xml \
88	../milestone/multi-user-server.xml \
89	../../utmpd/utmp.xml
90
91#
92# Additional manifests for the install miniroot.
93#
94MINIROOT_DESCRIPTIONS= \
95	../milestone/sysconfig.xml \
96	../../cmd-inet/usr.lib/inetd/inetd.xml \
97	../../cmd-inet/usr.sbin/login.xml \
98	../milestone/network-service.xml \
99	../../cmd-inet/usr.sbin/telnet.xml \
100	../../../lib/libresolv2/client.xml \
101	../../ldapcachemgr/client.xml \
102	../../ypcmd/client.xml \
103	../../ypcmd/server.xml \
104	../../keyserv/keyserv.xml \
105	../../cmd-crypto/scripts/cryptosvc.xml \
106	../../nscd/name-service-cache.xml \
107	../../syslogd/system-log.xml
108
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