fc-cache.sh revision 340
210N/A#!/bin/ksh
210N/A#
911N/A# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
210N/A# Use is subject to license terms.
210N/A#
210N/A# Permission is hereby granted, free of charge, to any person obtaining a
210N/A# copy of this software and associated documentation files (the
210N/A# "Software"), to deal in the Software without restriction, including
210N/A# without limitation the rights to use, copy, modify, merge, publish,
210N/A# distribute, and/or sell copies of the Software, and to permit persons
210N/A# to whom the Software is furnished to do so, provided that the above
210N/A# copyright notice(s) and this permission notice appear in all copies of
210N/A# the Software and that both the above copyright notice(s) and this
210N/A# permission notice appear in supporting documentation.
210N/A#
210N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
210N/A# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
210N/A# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
210N/A# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
210N/A# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
210N/A# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
210N/A# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
210N/A# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
210N/A# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
210N/A#
210N/A# Except as contained in this notice, the name of a copyright holder
210N/A# shall not be used in advertising or otherwise to promote the sale, use
210N/A# or other dealings in this Software without prior written authorization
210N/A# of the copyright holder.
210N/A#
210N/A###########################################################################
210N/A#
210N/A# ident "@(#)fc-cache.sh 1.1 08/02/24 SMI"
210N/A#
210N/A
851N/APATH=/usr/bin:/usr/sbin
210N/A
911N/A. /lib/svc/share/smf_include.sh
911N/A
911N/AUSAGE="Usage: $0 <method>"
911N/A
210N/Aif [ $# -ne 1 ] ; then
210N/A echo $USAGE
210N/A exit 2
493N/Afi
493N/A
210N/AMETHOD=$1
493N/A
493N/Acase $METHOD in
493N/A start)
210N/A # Continue with rest of script
210N/A ;;
210N/A -*)
210N/A echo $USAGE
210N/A exit 2
493N/A ;;
*)
echo "Invalid method $METHOD"
exit 2
;;
esac
getprop() {
PROPVAL=""
svcprop -q -p $1 application/font/fc-cache
if [ $? -eq 0 ] ; then
PROPVAL=$(svcprop -p $1 application/font/fc-cache)
if [ "$PROPVAL" == "\"\"" ] ; then
PROPVAL=""
fi
return
fi
return
}
ARGS=""
POSTCMD=""
RETVAL=$SMF_EXIT_OK
getprop options/force_rebuild
if [ "$PROPVAL" = "true" ] ; then
ARGS="$ARGS -f"
POSTCMD="svccfg -s application/font/fc-cache setprop options/force_rebuild=false"
fi
/usr/bin/fc-cache $ARGS
if [ $? -ne 0 ] ; then
RETVAL=$SMF_EXIT_MON_DEGRADE
fi
if [ "$POSTCMD" != "" ] ; then
eval $POSTCMD
fi
exit $RETVAL