Alan Coopersmith wrote:
> 
> I've posted a webrev for the changes to implement the force_rebuild
> property in the fc-cache SMF service in the X Consolidation at:
> 
>         http://cr.opensolaris.org/~alanc/fc-cache-force-rebuild/

Quick five min race through
http://cr.opensolaris.org/~alanc/fc-cache-force-rebuild/XW_S11_mod.patch
(patch code is quoted as "> "):

> +++ new/open-src/lib/fontconfig/fc-cache.sh   2008-02-25 14:57:27.810371000 
> -0800
> @@ -0,0 +1,96 @@
> +#!/bin/ksh

/bin is a softlink to /usr/bin and /usr/bin/ksh needs (depending on
SOlaris version) the "-p" switch, e.g. using...
#!/usr/bin/ksh -p
... may be better...

[snip]
> +PATH=/usr/bin:/usr/sbin
> +
> +. /lib/svc/share/smf_include.sh
> +
> +USAGE="Usage: $0 <method>"
> +
> +if [ $# -ne 1 ] ; then

Please use (( $# != 1 )) instead of [ $# -ne 1 ] , e.g. the ksh
arithmetric comparisation instead of the "test" builtin

> +    echo $USAGE
> +    exit 2

Isn't there an SMF return code for this case ?

> +fi
> +
> +METHOD=$1
> +
> +case $METHOD in
> +    start)
> +     # Continue with rest of script
> +     ;;
> +    -*)
> +     echo $USAGE

Please put quotes around "$USAGE" ?
BTW: Is it normal for SMF scripts that the usage message goes to stdout
?

> +     exit 2

See above (SMF return code) ...

> +     ;;
> +    *)
> +     echo "Invalid method $METHOD"
> +     exit 2

See above (SMF return code) ...

> +     ;;
> +esac
> +
> +getprop() {

Please use ksh function usage (see
http://www.opensolaris.org/os/project/shell/shellstyle/#use_ksh_style_function_syntax).

> +    PROPVAL=""

Erm... since PROPVAL is a global variable it may be better to add a
global declaration before "getprop" gets called the first time...
> +    svcprop -q -p $1 application/font/fc-cache

Please put quotes around the "$1" ...

> +    if [ $? -eq 0 ] ; then

Please use (( $? == 0 )) instead of [ $? -eq 0 ] (see above).

> +     PROPVAL=$(svcprop -p $1 application/font/fc-cache)
> +     if [ "$PROPVAL" == "\"\"" ] ; then

Please use [[ ]] ...

> +         PROPVAL=""
> +     fi
> +     return
> +    fi
> +    return
> +}
> +
> +ARGS=""
> +POSTCMD=""
> +RETVAL=$SMF_EXIT_OK

Please use...
-- snip --
integer RETVAL=$SMF_EXIT_OK
-- snip --

> +
> +getprop options/force_rebuild
> +if [ "$PROPVAL" = "true" ] ; then

Please use [[ ]] ...

> +    ARGS="$ARGS -f"
> +    POSTCMD="svccfg -s application/font/fc-cache setprop 
> options/force_rebuild=false"
> +fi
> +
> +/usr/bin/fc-cache $ARGS

Uhm... is "ARGS" one argument or is it supposed to contain multiple
arguments ?

> +if [ $? -ne 0 ] ; then

Please use (( $? != 0 )) instead of [ $? -ne 0 ]

> +    RETVAL=$SMF_EXIT_MON_DEGRADE
> +fi
> +
> +if [ "$POSTCMD" != "" ] ; then
> +    eval $POSTCMD

Urrgh... is the "eval" really neccesary ?

> +fi
> +
> +exit $RETVAL

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)

Reply via email to