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