manifest-import (9444c26f) manifest-import (adfc3118)
1#!/bin/ksh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
8#

--- 5 unchanged lines hidden (view full) ---

14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
1#!/bin/ksh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
8#

--- 5 unchanged lines hidden (view full) ---

14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
22#
23#
23# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24# Use is subject to license terms.
25#
26
27# 0a Initialization.
28
29[ -f /lib/svc/share/smf_include.sh ] || exit 1
30
31. /lib/svc/share/smf_include.sh
32
33activity=false
34
35EMI_SERVICE="svc:/system/early-manifest-import:default"
24
25# 0a Initialization.
26
27[ -f /lib/svc/share/smf_include.sh ] || exit 1
28
29. /lib/svc/share/smf_include.sh
30
31activity=false
32
33EMI_SERVICE="svc:/system/early-manifest-import:default"
34PROFILE_DIR_SITE="/etc/svc/profile/site"
36
37X=
38early=false
39[ "$SMF_FMRI" == "$EMI_SERVICE" ] && early=true
40while getopts "n" opt; do
41 case $opt in
42 n) X=echo;;
43 ?) echo "Usage: /lib/svc/method/manifest-import [-n]\n"

--- 10 unchanged lines hidden (view full) ---

54
55#
56# If the smf/manifest table has file entries that are missing
57# then there is work to be done by the cleanup process.
58#
59function cleanup_needwork {
60 if [ "$early" == true ]; then
61 smfmfiles=`/usr/bin/svcprop smf/manifest | \
35
36X=
37early=false
38[ "$SMF_FMRI" == "$EMI_SERVICE" ] && early=true
39while getopts "n" opt; do
40 case $opt in
41 n) X=echo;;
42 ?) echo "Usage: /lib/svc/method/manifest-import [-n]\n"

--- 10 unchanged lines hidden (view full) ---

53
54#
55# If the smf/manifest table has file entries that are missing
56# then there is work to be done by the cleanup process.
57#
58function cleanup_needwork {
59 if [ "$early" == true ]; then
60 smfmfiles=`/usr/bin/svcprop smf/manifest | \
62 awk '(/^lib_) && (/\/manifestfile /) {print $3}'`
61 awk '(/^lib_/ && /\/manifestfile /) {print $3}'`
63 else
64 smfmfiles=`/usr/bin/svcprop smf/manifest | \
65 awk '/\/manifestfile / {print $3}'`
66 fi
67
68 nw=`/lib/svc/bin/mfstscan $smfmfiles 2>&1 1>/dev/null`
69 [ "$nw" ] && return 1
70

--- 88 unchanged lines hidden (view full) ---

159 }
160
161 #
162 # Move symlinks from /var/svc/profile to /etc/svc/profile
163 #
164 generic_prof="/var/svc/profile/generic.xml"
165 ns_prof="/var/svc/profile/name_service.xml"
166 inetd_prof="/var/svc/profile/inetd_services.xml"
62 else
63 smfmfiles=`/usr/bin/svcprop smf/manifest | \
64 awk '/\/manifestfile / {print $3}'`
65 fi
66
67 nw=`/lib/svc/bin/mfstscan $smfmfiles 2>&1 1>/dev/null`
68 [ "$nw" ] && return 1
69

--- 88 unchanged lines hidden (view full) ---

158 }
159
160 #
161 # Move symlinks from /var/svc/profile to /etc/svc/profile
162 #
163 generic_prof="/var/svc/profile/generic.xml"
164 ns_prof="/var/svc/profile/name_service.xml"
165 inetd_prof="/var/svc/profile/inetd_services.xml"
166 platform_prof="/var/svc/profile/platform.xml"
167 [ -L "$generic_prof" ] && mv $generic_prof /etc/svc/profile/
168 [ -L "$ns_prof" ] && mv $ns_prof /etc/svc/profile/
169 [ -L "$inetd_prof" ] && mv $inetd_prof /etc/svc/profile/
167 [ -L "$generic_prof" ] && mv $generic_prof /etc/svc/profile/
168 [ -L "$ns_prof" ] && mv $ns_prof /etc/svc/profile/
169 [ -L "$inetd_prof" ] && mv $inetd_prof /etc/svc/profile/
170 [ -L "$platform_prof" ] && mv $platform_prof /etc/svc/profile/
170
171 return 0
172}
173
174#
175# 2. Manifest import. Application directories first, then
176# site-specific manifests.
177#

--- 135 unchanged lines hidden (view full) ---

313 if [ -f "${datalink_script}" ]; then
314 /usr/bin/mv "${datalink_script}" \
315 "${datalink_script}".app.`date +\%Y\%m\%d\%H\%M\%S`
316 fi
317 )
318}
319
320#
171
172 return 0
173}
174
175#
176# 2. Manifest import. Application directories first, then
177# site-specific manifests.
178#

--- 135 unchanged lines hidden (view full) ---

314 if [ -f "${datalink_script}" ]; then
315 /usr/bin/mv "${datalink_script}" \
316 "${datalink_script}".app.`date +\%Y\%m\%d\%H\%M\%S`
317 fi
318 )
319}
320
321#
321# 5. Site profile is applied last to give administrator the final say.
322# 5. Giving administrator the final say, apply site.xml profile and profiles
323# under /etc/svc/profile/site directory.
322#
323function apply_site_profile {
324 typeset prefix="$1/svc/profile"
325 [ -f $prefix/site.xml ] && svccfg_apply $prefix/site.xml
324#
325function apply_site_profile {
326 typeset prefix="$1/svc/profile"
327 [ -f $prefix/site.xml ] && svccfg_apply $prefix/site.xml
328
329 if [ -d $PROFILE_DIR_SITE -a "$1" = "/etc" ]; then
330 svccfg_apply $PROFILE_DIR_SITE
331 fi
326}
327
328#
329# 0b Cleanup deathrow
330#
331if [ "$early" = "false" ];then
332 deathrow=/etc/svc/deathrow
333 if [ -s $deathrow ];then

--- 129 unchanged lines hidden ---
332}
333
334#
335# 0b Cleanup deathrow
336#
337if [ "$early" = "false" ];then
338 deathrow=/etc/svc/deathrow
339 if [ -s $deathrow ];then

--- 129 unchanged lines hidden ---