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