xref: /illumos-gate/usr/src/cmd/svc/seed/Makefile (revision 9b9d39d2a32ff806d2431dbcc50968ef1e6d46b2)
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# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
27#
28
29include ../../Makefile.cmd
30
31ETCSVC = $(ROOTETC)/svc
32LIBSVCSEED = $(ROOT)/lib/svc/seed
33INSTALLSEED = $(ROOT)/usr/sadm/install
34
35#
36# Because seed repository construction requires a functioning repository, a
37# working svccfg(1) binary, and XML support, the following libraries must exist
38# on the build system or in the proto area:  libscf, libuutil, and libxml2.
39#
40
41MFST_ROOT=lib/svc/manifest
42MFST_TYPE= \
43	system \
44	system/device \
45	system/filesystem \
46	system/svc \
47	milestone \
48	network \
49	network/dns \
50	network/ldap \
51	network/nis \
52	network/rpc
53
54MFST_DIRS = $(MFST_TYPE:%=$(MFST_ROOT)/%)
55
56#
57# We build and deliver 3 seed repositories:
58#	global.db	-- for a standalone system (global zone)
59#	nonglobal.db	-- for a non-global zone
60#	miniroot.db	-- for the install miniroot
61#
62# COMMON_MANIFESTS contains manifests needed by all 3 repositories.
63# {GLOBAL_ZONE,NONGLOBAL_ZONE,MINIROOT}_MANIFESTS
64#   contain additional manifests needed.
65#
66
67#
68# Manifests needed by all seed repositories.
69#
70COMMON_MANIFESTS = \
71	milestone/multi-user.xml \
72	milestone/name-services.xml \
73	milestone/single-user.xml \
74	network/dlmgmt.xml \
75	network/network-initial.xml \
76	network/network-ipmgmt.xml \
77	network/network-loopback.xml \
78	network/network-netcfg.xml \
79	network/network-physical.xml \
80	network/rpc/bind.xml \
81	system/boot-archive.xml \
82	system/device/devices-local.xml \
83	system/filesystem/local-fs.xml \
84	system/filesystem/minimal-fs.xml \
85	system/filesystem/root-fs.xml \
86	system/filesystem/usr-fs.xml \
87	system/identity.xml \
88	system/manifest-import.xml \
89	system/svc/global.xml \
90	system/svc/restarter.xml
91
92#
93# Additional manifests for a standalone system (global zone)
94#
95GLOBAL_ZONE_MANIFESTS = \
96	milestone/multi-user-server.xml \
97	network/inetd-upgrade.xml \
98	system/console-login.xml \
99	system/utmp.xml
100
101#
102# Additional manifests for a non-global zone
103#
104NONGLOBAL_ZONE_MANIFESTS = \
105	milestone/multi-user-server.xml \
106	system/console-login.xml \
107	system/utmp.xml
108
109#
110# Additional manifests for the install miniroot.
111#
112MINIROOT_MANIFESTS= \
113	milestone/sysconfig.xml \
114	network/dns/client.xml \
115	network/inetd.xml \
116	network/ldap/client.xml \
117	network/login.xml \
118	network/network-service.xml \
119	network/nis/client.xml \
120	network/nis/server.xml \
121	network/rpc/keyserv.xml \
122	network/telnet.xml \
123	system/cryptosvc.xml \
124	system/name-service-cache.xml \
125	system/system-log.xml
126
127
128COMMON_DESCRIPTIONS=$(COMMON_MANIFESTS:%=$(MFST_ROOT)/%)
129GLOBAL_ZONE_DESCRIPTIONS=$(GLOBAL_ZONE_MANIFESTS:%=$(MFST_ROOT)/%)
130NONGLOBAL_ZONE_DESCRIPTIONS=$(NONGLOBAL_ZONE_MANIFESTS:%=$(MFST_ROOT)/%)
131MINIROOT_DESCRIPTIONS=$(MINIROOT_MANIFESTS:%=$(MFST_ROOT)/%)
132
133FILEMODE = 0600
134# seeds are not intended for editing, but may be copied
135SEEDFILEMODE = 0444
136
137.KEEP_STATE:
138
139all: global.db nonglobal.db miniroot.db
140
141../milestone/console-login.xml:
142	@cd ../milestone; pwd; $(MAKE) console-login.xml
143
144CONFIGD_ENV = \
145	SVCCFG_DTD=../dtd/service_bundle.dtd.1 \
146	PKG_INSTALL_ROOT=$(SRC)/cmd/svc/seed \
147	SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/$@ \
148	SVCCFG_CONFIGD_PATH=$(SVCCONFIGD)
149
150IMPORT.mfst = $(CONFIGD_ENV) $(SVCCFG) import
151
152common.db: $(MFST_DIRS) $(COMMON_DESCRIPTIONS)
153	$(RM) -f $@ $@-journal
154	$(IMPORT.mfst) $(COMMON_DESCRIPTIONS)
155
156global.db: common.db $(GLOBAL_ZONE_DESCRIPTIONS)
157	$(RM) -f $@ $@-journal
158	$(CP) common.db $@
159	$(IMPORT.mfst) $(GLOBAL_ZONE_DESCRIPTIONS)
160
161nonglobal.db: common.db $(NONGLOBAL_ZONE_DESCRIPTIONS)
162	$(RM) -f $@ $@-journal
163	$(CP) common.db $@
164	$(IMPORT.mfst) $(NONGLOBAL_ZONE_DESCRIPTIONS)
165
166miniroot.db: common.db $(MINIROOT_DESCRIPTIONS)
167	$(RM) -f $@ $@-journal
168	$(CP) common.db $@
169	$(IMPORT.mfst) $(MINIROOT_DESCRIPTIONS)
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	$(CONFIGD_ENV) $(SVCCFG) -s svc:/system/system-log \
177	    setprop config/log_from_remote = false
178	$(CONFIGD_ENV) $(SVCCFG) -s svc:/network/rpc/bind \
179	    setprop config/local_only = true
180
181.PARALLEL: global.db nonglobal.db miniroot.db
182
183install: install_global install_nonglobal install_miniroot
184
185install_global: global.db
186	$(RM) $(LIBSVCSEED)/global.db
187	$(INS) -f $(LIBSVCSEED) -m $(SEEDFILEMODE) -s global.db
188
189install_nonglobal: nonglobal.db
190	$(RM) $(LIBSVCSEED)/nonglobal.db
191	$(INS) -f $(LIBSVCSEED) -m $(SEEDFILEMODE) -s nonglobal.db
192
193install_miniroot: $(INSTALLSEED) miniroot.db
194	$(RM) $(INSTALLSEED)/miniroot.db
195	$(INS) -f $(INSTALLSEED) -m $(SEEDFILEMODE) -s miniroot.db
196
197$(INSTALLSEED):
198	$(INS.dir)
199
200clean:
201	$(RM) common.db
202	$(RM) $(COMMON_DESCRIPTIONS) $(GLOBAL_ZONE_DESCRIPTIONS)
203	$(RM) $(NON_GLOBAL_ZONE_DESCRIPTIONS) $(MINIROOT_DESCRIPTIONS)
204
205clobber:
206	$(RM) common.db global.db nonglobal.db miniroot.db
207	$(RM) -r lib/
208
209$(MFST_DIRS): FRC
210	$(INS.dir)
211
212$(MFST_ROOT)/milestone/%: ../milestone/%
213	$(INS.file)
214
215$(MFST_ROOT)/network/%: ../../cmd-inet/lib/ipmgmtd/%
216	$(INS.file)
217
218$(MFST_ROOT)/network/%: ../../cmd-inet/usr.lib/inetd/%
219	$(INS.file)
220
221$(MFST_ROOT)/network/%: ../../cmd-inet/usr.sbin/%
222	$(INS.file)
223
224$(MFST_ROOT)/network/%: ../../dlmgmtd/%
225	$(INS.file)
226
227$(MFST_ROOT)/network/%: ../milestone/%
228	$(INS.file)
229
230$(MFST_ROOT)/network/dns/%: ../../../lib/libresolv2/%
231	$(INS.file)
232
233$(MFST_ROOT)/network/ldap/%: ../../ldapcachemgr/%
234	$(INS.file)
235
236$(MFST_ROOT)/network/nis/%: ../../ypcmd/%
237	$(INS.file)
238
239$(MFST_ROOT)/network/rpc/%: ../../keyserv/%
240	$(INS.file)
241
242$(MFST_ROOT)/network/rpc/%: ../../rpcbind/%
243	$(INS.file)
244
245$(MFST_ROOT)/system/%: ../../cmd-crypto/scripts/%
246	$(INS.file)
247
248$(MFST_ROOT)/system/%: ../../nscd/%
249	$(INS.file)
250
251$(MFST_ROOT)/system/%: ../../syslogd/%
252	$(INS.file)
253
254$(MFST_ROOT)/system/%: ../../utmpd/%
255	$(INS.file)
256
257$(MFST_ROOT)/system/%: ../milestone/%
258	$(INS.file)
259
260$(MFST_ROOT)/system/device/%: ../milestone/%
261	$(INS.file)
262
263$(MFST_ROOT)/system/filesystem/%: ../milestone/%
264	$(INS.file)
265
266$(MFST_ROOT)/system/svc/%: ../milestone/%
267	$(INS.file)
268
269FRC:
270