inetd-upgrade.sh revision 9444c26f4faabda140242c3986089704c4073ced
2N/A# The contents of this file are subject to the terms of the 2N/A# Common Development and Distribution License (the "License"). 2N/A# You may not use this file except in compliance with the License. 2N/A# See the License for the specific language governing permissions 2N/A# and limitations under the License. 2N/A# When distributing Covered Code, include this CDDL HEADER in each 2N/A# If applicable, add the following below this CDDL HEADER, with the 2N/A# fields enclosed by brackets "[]" replaced with your own identifying 2N/A# information: Portions Copyright [yyyy] [name of copyright owner] 2N/A# Copyright 2010 Sun Microsystems, Inc. All rights reserved. 2N/A# Use is subject to license terms. 2N/A# Start by cleaning out obsolete instances. For each one that 2N/A# exists in the repository, remove it. 2N/A # Instance found, so disable and delete 2N/A # Instance was enabled, so enable the replacement. 2N/A # We must do this here because the profile which 2N/A # normally enables these is only applied on first 2N/A# The Following blocks of code cause the inetconv generated services to be 2N/A# re-generated, so that the latest inetconv modifications are applied to all 2N/A# services generated by it. 2N/A# Create sed script that prints out inetd.conf src line from inetconv generated 2N/Acat <<EOF
> /tmp/inetd-upgrade.$$.sed 2N/A/propval name='source_line'/{ 2N/A/from the inetd.conf(4) format line/{ 2N/A# get list of inetconv generated manifests 2N/A# For each inetconv generated manifest determine the instances that should 2N/A# be disabled when the new manifests are imported, and generate a file with 2N/A# the inetd.conf entries from all the manifests for consumption by inetconv. 2N/A # if the instance doesn't exist in the repository skip it 2N/A # add all non-default instances to disable list 2N/A # if none of the manifest's instances existed, skip this manifest 2N/A # If the default instance existed and was disabled, or if didn't 2N/A # exist and one of the other instances was disabled, add the default 2N/A # to the list of instances to disable. 2N/A# Check whether we've ever run inetconv before by looking for the 2N/A# configuration file hash. If we haven't run it before, then we need 2N/A# repository is authoritative. `unimported' will be 0 if the hash exists. 2N/A# Run inetconv on generated file, overwriting previous manifests and values 2N/A# disable the necessary instances 2N/A# If there is a saved config file from upgrade, use it to enable services, 2N/A# but only if we're coming from a release that didn't have SMF. 2N/A# Now convert the remaining entries in inetd.conf to service manifests 2N/A# Now disable myself as the upgrade is done