manifest-import revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (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 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
# 0. Initialization.
activity=false
X=
while getopts n opt; do
n) X=echo;;
?) echo "Usage: /lib/svc/method/manifest-import [-n]\n"
exit 2;;
esac
done
if [ $? -ne 0 ]; then
fi
}
if [ $? -ne 0 ]; then
fi
}
#
# A property has changed in the manifest that we wish to propagate into
# the repository during manifest import. We don't want to pollute
# manifests with overrides, so handle explicitly here.
#
fmri=$1
pgrp=$2
prop=$3
nval=$4
shift 4
"$@"
[ $? = 0 ] && instance_refresh $fmri
}
#
# A property has changed in the manifest that we wish to propagate
# into the repository during manifest import.
#
fmri=$1
pgrp=$2
prop=$3
nval=$4
[ $? = 0 ] && instance_refresh $fmri
}
#
# Certain property groups have migrated from the service level to the
# instance level. We don't care if they are at both, as the instance
# level will trump. But having neither could be bad. So check and if
# the given pg exists at both levels, delete the service-level one only.
#
service=$1
instance=$2
/usr/bin/svcprop -q -p $property_group $service
res1=$?
res2=$?
fi
}
#
# Some services have stale dependencies that need to be removed.
# This is done by removing the dependency property group.
#
fmri=$1
/usr/bin/svcprop -q -c -p $property_group $fmri
if [ $? -eq 0 ]; then
else
echo "Dependency $property_group not defined on $fmri"
fi
}
# Delete obsolete property groups from old manifests. Instances
# should be refreshed for changes to take effect.
fmri=$1
pg=$2
}
#
# If a property doesn't exist, create it. Instances should be
# refreshed for changes to take effect.
#
if [ $# -lt 6 ]; then
echo "prophist_addprop(): Insufficient arguments ($*)."
exit 1
fi
fmri=$1
pg=$2
pgtype=$3
prop=$4
shift 4
}
#
# If a method doesn't exist, create it. Instances should be refreshed
# for changes to take effect.
#
if [ $# -ne 4 ]; then
echo "prophist_addmeth(): Insufficient arguments ($*)"
exit 1
fi
fmri=$1
name=$2
exec=$3
to=$4
addpg $name method
setprop $name/type = astring: method
setprop $name/exec = astring: "$exec"
setprop $name/timeout_seconds = count: $to
END
}
#
# If a dependency doesn't exist, create it. Instances should be
# refreshed for changes to take effect.
#
if [ $# -lt 6 ]; then
echo "prophist_adddep(): Insufficient arguments ($*)"
exit 1
fi
fmri=$1
name=$2
type=$3
group=$4
ro=$5
shift 5
addpg $name dependency
setprop $name/type = astring: $type
setprop $name/grouping = astring: $group
setprop $name/restart_on = astring: $ro
setprop $name/entities = fmri: $*
END
}
#
# If a dependent doesn't exist, create it. Instances should be
# refresh for changes to take effect.
#
if [ $# -ne 5 ]; then
echo "prophist_adddpt(): Incorrect arguments ($*).\n"
exit 1
fi
fmri=$1
name=$2
group=$3
ro=$4
target=$5
}
}
}
}
}
}
done
}
}
# Preserve the five hashes for the profiles: generic (two
# cases), platform (uname -i, uname -m outputs), and site.
gn="var_svc_profile_generic_open_xml"
[ $? = 0 ] || gh=""
gln="var_svc_profile_generic_limited_net_xml"
[ $? = 0 ] || glh=""
pln="var_svc_profile_platform_${pl}_xml"
[ $? = 0 ] || plh=""
plmn="var_svc_profile_platform_${plm}_xml"
[ $? = 0 ] || plmh=""
else
plmh=""
fi
sn="var_svc_profile_site_xml"
[ $? = 0 ] || sh=""
# Remove all manifest hashes.
echo "Preserving generic hash ($gh)."
}
echo "Preserving generic_limited hash ($glh)."
}
echo "Preserving platform hash ($plh)."
}
echo "Preserving platform hash ($plmh)."
}
echo "Preserving site hash ($sh)."
}
}
#
# 0. Clean up repository
#
then
set -- `
done
`
i=1; n=$#
while [ $# -gt 0 ]; do
)
i=`expr $i + 1`
shift
done
echo "Converted $n obsolete repository entries"
activity=true
fi
#
# If no last-import snapshots are present on critical services, then we are
# creating the last-import snapshots for the first time post upgrade.
#
then
break
fi
done
if [ $create_last_import ]; then
echo "Last import snapshots absent; preparing for re-import"
#
# Apply property history files.
#
echo "Upgrade detected; applying property history"
if [ $? = 3 ]; then
echo "Sourcing $phist"
. $phist
fi
done
fi
#
# 2. Manifest import. Application directories first, then
# site-specific manifests.
#
-print -prune`
[ -n "$_MFST_DEBUG" ] && {
echo "Changed manifests to import:"
}
#
# 2b. Import the manifests while giving a running display of imports on
# console, and a final count in the logfile.
#
if [ -n "$nonsite_manifests" -o -n "$site_manifests" ]; then
set -- $manifests
i=1; n=$#
while [ $# -gt 0 ]; do
i=`expr $i + 1`
shift
done
echo "Loaded $n smf(5) service descriptions"
activity=true
if [ -s /tmp/manifest_import.$$ ]; then
echo "svccfg warnings:"
msg="svccfg import warnings. See"
fi
fi
#
# 3. Profile application. We must create the platform profile upon
# first boot, as we may be a diskless client of a platform or
# architecture distinct from our NFS server.
#
this_karch=`uname -m`
else
fi
fi
#
# 4. Upgrade handling. The upgrade file generally consists of a series
# of svcadm(1M) and svccfg(1M) commands.
#
(
unset SVCCFG_CHECKHASH
/var/svc/profile/upgrade.app.`date +\%Y\%m\%d\%H\%M\%S`
activity=true
fi
)
#
# 5. Site profile is applied last to give administrator the final say.
#
fi
#
# 6. Final actions.
#
if $activity; then
fi
exit 0