xref: /illumos-gate/usr/src/cmd/svc/seed/Makefile (revision 8226594fdd4479be135127f43632f1f995074654)
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
137CONFIGD = ../configd/svc.configd-native
138SVCCFG = ../svccfg/svccfg-native
139
140.KEEP_STATE:
141
142all: global.db nonglobal.db miniroot.db
143
144$(CONFIGD): FRC
145	@cd ../configd; pwd; $(MAKE) native
146
147$(SVCCFG): FRC
148	@cd ../svccfg; pwd; $(MAKE) native
149
150../milestone/console-login.xml:
151	@cd ../milestone; pwd; $(MAKE) console-login.xml
152
153CONFIGD_ENV = \
154	SVCCFG_DTD=../dtd/service_bundle.dtd.1 \
155	PKG_INSTALL_ROOT=$(SRC)/cmd/svc/seed \
156	SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/$@ \
157	SVCCFG_CONFIGD_PATH=$(CONFIGD)
158
159IMPORT.mfst = $(CONFIGD_ENV) $(SVCCFG) import
160
161common.db: $(MFST_DIRS) $(COMMON_DESCRIPTIONS) $(CONFIGD) $(SVCCFG)
162	$(RM) -f $@ $@-journal
163	$(IMPORT.mfst) $(COMMON_DESCRIPTIONS)
164
165global.db: common.db $(GLOBAL_ZONE_DESCRIPTIONS)
166	$(RM) -f $@ $@-journal
167	$(CP) common.db $@
168	$(IMPORT.mfst) $(GLOBAL_ZONE_DESCRIPTIONS)
169
170nonglobal.db: common.db $(NONGLOBAL_ZONE_DESCRIPTIONS)
171	$(RM) -f $@ $@-journal
172	$(CP) common.db $@
173	$(IMPORT.mfst) $(NONGLOBAL_ZONE_DESCRIPTIONS)
174
175miniroot.db: common.db $(MINIROOT_DESCRIPTIONS)
176	$(RM) -f $@ $@-journal
177	$(CP) common.db $@
178	$(IMPORT.mfst) $(MINIROOT_DESCRIPTIONS)
179	#
180	# Make sure the miniroot's syslogd and rpcbind do not respond
181	# to packets from outside the machine. Since we cannot set property
182	# values by applying a profile yet, we need to set them explicitly
183	# with svccfg commands.
184	#
185	$(CONFIGD_ENV) $(SVCCFG) -s svc:/system/system-log \
186	    setprop config/log_from_remote = false
187	$(CONFIGD_ENV) $(SVCCFG) -s svc:/network/rpc/bind \
188	    setprop config/local_only = true
189
190.PARALLEL: global.db nonglobal.db miniroot.db
191
192install: install_global install_nonglobal install_miniroot
193
194install_global: global.db
195	$(RM) $(LIBSVCSEED)/global.db
196	$(INS) -f $(LIBSVCSEED) -m $(SEEDFILEMODE) -s global.db
197
198install_nonglobal: nonglobal.db
199	$(RM) $(LIBSVCSEED)/nonglobal.db
200	$(INS) -f $(LIBSVCSEED) -m $(SEEDFILEMODE) -s nonglobal.db
201
202install_miniroot: $(INSTALLSEED) miniroot.db
203	$(RM) $(INSTALLSEED)/miniroot.db
204	$(INS) -f $(INSTALLSEED) -m $(SEEDFILEMODE) -s miniroot.db
205
206$(INSTALLSEED):
207	$(INS.dir)
208
209clean:
210	$(RM) common.db
211	$(RM) $(COMMON_DESCRIPTIONS) $(GLOBAL_ZONE_DESCRIPTIONS)
212	$(RM) $(NON_GLOBAL_ZONE_DESCRIPTIONS) $(MINIROOT_DESCRIPTIONS)
213
214clobber:
215	$(RM) common.db global.db nonglobal.db miniroot.db
216	$(RM) -r lib/
217
218$(MFST_DIRS): FRC
219	$(INS.dir)
220
221$(MFST_ROOT)/milestone/%: ../milestone/%
222	$(INS.file)
223
224$(MFST_ROOT)/network/%: ../../cmd-inet/lib/ipmgmtd/%
225	$(INS.file)
226
227$(MFST_ROOT)/network/%: ../../cmd-inet/usr.lib/inetd/%
228	$(INS.file)
229
230$(MFST_ROOT)/network/%: ../../cmd-inet/usr.sbin/%
231	$(INS.file)
232
233$(MFST_ROOT)/network/%: ../../dlmgmtd/%
234	$(INS.file)
235
236$(MFST_ROOT)/network/%: ../milestone/%
237	$(INS.file)
238
239$(MFST_ROOT)/network/dns/%: ../../../lib/libresolv2/%
240	$(INS.file)
241
242$(MFST_ROOT)/network/ldap/%: ../../ldapcachemgr/%
243	$(INS.file)
244
245$(MFST_ROOT)/network/nis/%: ../../ypcmd/%
246	$(INS.file)
247
248$(MFST_ROOT)/network/rpc/%: ../../keyserv/%
249	$(INS.file)
250
251$(MFST_ROOT)/network/rpc/%: ../../rpcbind/%
252	$(INS.file)
253
254$(MFST_ROOT)/system/%: ../../cmd-crypto/scripts/%
255	$(INS.file)
256
257$(MFST_ROOT)/system/%: ../../nscd/%
258	$(INS.file)
259
260$(MFST_ROOT)/system/%: ../../syslogd/%
261	$(INS.file)
262
263$(MFST_ROOT)/system/%: ../../utmpd/%
264	$(INS.file)
265
266$(MFST_ROOT)/system/%: ../milestone/%
267	$(INS.file)
268
269$(MFST_ROOT)/system/device/%: ../milestone/%
270	$(INS.file)
271
272$(MFST_ROOT)/system/filesystem/%: ../milestone/%
273	$(INS.file)
274
275$(MFST_ROOT)/system/svc/%: ../milestone/%
276	$(INS.file)
277
278FRC:
279