components/desktop/desktop-cache/files/gconf-cache
author Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
Wed, 27 Apr 2016 22:34:47 -0700
changeset 5889 d78a523a8925
permissions -rwxr-xr-x
23169122 Move desktop-cache package to Userland
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5889
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     1
#!/bin/ksh -p
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     2
#
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     3
# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     4
#
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     5
# Permission is hereby granted, free of charge, to any person obtaining a
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     6
# copy of this software and associated documentation files (the
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     7
# "Software"), to deal in the Software without restriction, including
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     8
# without limitation the rights to use, copy, modify, merge, publish,
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     9
# distribute, and/or sell copies of the Software, and to permit persons
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    10
# to whom the Software is furnished to do so, provided that the above
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    11
# copyright notice(s) and this permission notice appear in all copies of
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    12
# the Software and that both the above copyright notice(s) and this
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    13
# permission notice appear in supporting documentation.
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    14
#
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    15
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    16
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    17
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    18
# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    19
# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    20
# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    21
# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    22
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    23
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    24
#
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    25
# Except as contained in this notice, the name of a copyright holder
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    26
# shall not be used in advertising or otherwise to promote the sale, use
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    27
# or other dealings in this Software without prior written authorization
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    28
# of the copyright holder.
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    29
#
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    30
###########################################################################
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    31
#
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    32
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    33
PATH=/usr/bin:/usr/sbin
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    34
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    35
. /lib/svc/share/smf_include.sh
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    36
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    37
USAGE="Usage: $0 { start | refresh }"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    38
FIND_NEWER=/usr/share/desktop-cache/find_newer
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    39
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    40
if [ $# -ne 1 ] ; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    41
    echo $USAGE
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    42
    exit 2
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    43
fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    44
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    45
#
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    46
# IF the gconf cache exist then :
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    47
#   find schema files newer than the cache 
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    48
# ELSE
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    49
#   get all schema file
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    50
#
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    51
# generate/merge schema files in the gconf cache
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    52
#
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    53
GCONFDIR="/etc/gconf"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    54
start_gconf_cache ()
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    55
{
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    56
test -w $GCONFDIR || { 
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    57
  echo "$GCONFDIR is not writable, skipping."
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    58
  return
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    59
}
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    60
if [ -a "/etc/gconf/gconf.xml.defaults/%gconf-tree.xml" ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    61
  SCHEMAS=`${FIND_NEWER} -f -m -c --name '*.schemas' \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    62
      --newer /etc/gconf/gconf.xml.defaults/%gconf-tree.xml \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    63
      /etc/gconf/schemas 2>/dev/null`
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    64
  ENTRIES=`${FIND_NEWER} -f -m -c --name '*.entries' \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    65
      --newer /etc/gconf/gconf.xml.defaults/%gconf-tree.xml \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    66
      /etc/gconf/schemas 2>/dev/null`
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    67
else
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    68
  SCHEMAS=`/usr/bin/find /etc/gconf/schemas -name '*.schemas' ! -type d`
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    69
  ENTRIES=`/usr/bin/find /etc/gconf/schemas -name '*.entries' ! -type d`
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    70
fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    71
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    72
if [ -n "$SCHEMAS" ]; then 
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    73
  test -x /usr/bin/gconftool-2 || {
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    74
    echo "gconftool-2 not installed"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    75
    return
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    76
  }
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    77
  echo "Updating GConf cache for the following schemas:"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    78
  echo "$SCHEMAS" | /bin/sed -e 's/^/    /'
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    79
  # redirect stdout to /dev/null because gconftool is too verbose
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    80
  # errors are printed to stderr
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    81
  GCONF_CONFIG_SOURCE=xml:merged:/etc/gconf/gconf.xml.defaults \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    82
    /usr/bin/gconftool-2 --makefile-install-rule $SCHEMAS > /dev/null
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    83
  if [ $? -ne 0 ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    84
    echo "gconftool-2 exited with an error while installing schemas"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    85
    exit $SMF_EXIT_ERR_FATAL
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    86
  else
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    87
    echo "Schema files merged in the GConf cache"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    88
  fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    89
fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    90
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    91
if [ -n "$ENTRIES" ]; then 
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    92
  test -x /usr/bin/gconftool-2 || {
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    93
    echo "gconftool-2 not installed"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    94
    return
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    95
  }
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    96
  echo "Updating GConf cache for the following entries:"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    97
  echo "$ENTRIES" | /bin/sed -e 's/^/    /'
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    98
  # redirect stdout to /dev/null because gconftool is too verbose
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    99
  # errors are printed to stderr
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   100
  /usr/bin/gconftool-2 --direct \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   101
      --config-source=xml:merged:/etc/gconf/gconf.xml.defaults \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   102
      --load $ENTRIES > /dev/null
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   103
  if [ $? -ne 0 ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   104
    echo "gconftool-2 exited with an error while adding entries"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   105
    exit $SMF_EXIT_ERR_FATAL
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   106
  else
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   107
    echo "Entries merged into the GConf cache"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   108
  fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   109
fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   110
}
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   111
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   112
refresh_gconf_cache ()
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   113
{
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   114
test -w $GCONFDIR || { 
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   115
  echo "$GCONFDIR is not writable, skipping."
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   116
  return
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   117
}
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   118
if [ -a "/etc/gconf/gconf.xml.defaults/%gconf-tree.xml" ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   119
  SCHEMAS=`/usr/bin/find /etc/gconf/schemas ! -type d -follow \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   120
    -name '*.schemas' 2>/dev/null`
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   121
  ENTRIES=`/usr/bin/find /etc/gconf/schemas ! -type d -follow \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   122
    -name '*.entries' 2>/dev/null`
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   123
else
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   124
  SCHEMAS=`/usr/bin/find /etc/gconf/schemas -name '*.schemas' ! -type d`
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   125
  ENTRIES=`/usr/bin/find /etc/gconf/schemas -name '*.entries' ! -type d`
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   126
fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   127
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   128
if [ -n "$SCHEMAS" ]; then 
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   129
  test -x /usr/bin/gconftool-2 || {
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   130
    echo "gconftool-2 not installed"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   131
    return
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   132
  }
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   133
  echo "Updating GConf cache for the following schemas:"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   134
  echo "$SCHEMAS" | /bin/sed -e 's/^/    /'
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   135
  # redirect stdout to /dev/null because gconftool is too verbose
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   136
  # errors are printed to stderr
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   137
  GCONF_CONFIG_SOURCE=xml:merged:/etc/gconf/gconf.xml.defaults \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   138
    /usr/bin/gconftool-2 --makefile-install-rule $SCHEMAS > /dev/null
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   139
  if [ $? -ne 0 ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   140
    echo "gconftool-2 exited with an error while installing schemas"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   141
    exit $SMF_EXIT_ERR_FATAL
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   142
  else
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   143
    echo "Schema files merged in the GConf cache"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   144
  fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   145
fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   146
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   147
if [ -n "$ENTRIES" ]; then 
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   148
  test -x /usr/bin/gconftool-2 || {
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   149
    echo "gconftool-2 not installed"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   150
    return
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   151
  }
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   152
  echo "Updating GConf cache for the following entries:"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   153
  echo "$ENTRIES" | /bin/sed -e 's/^/    /'
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   154
  # redirect stdout to /dev/null because gconftool is too verbose
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   155
  # errors are printed to stderr
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   156
  /usr/bin/gconftool-2 --direct \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   157
      --config-source=xml:merged:/etc/gconf/gconf.xml.defaults \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   158
      --load $ENTRIES > /dev/null
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   159
  if [ $? -ne 0 ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   160
    echo "gconftool-2 exited with an error while adding entries"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   161
    exit $SMF_EXIT_ERR_FATAL
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   162
  else
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   163
    echo "Entries merged into the GConf cache"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   164
  fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   165
fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   166
}
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   167
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   168
METHOD=$1
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   169
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   170
case "$METHOD" in
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   171
    'start')
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   172
	# Continue with rest of script
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   173
	;;
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   174
    'refresh')
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   175
	;;
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   176
    -*)
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   177
	echo $USAGE
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   178
	exit 2
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   179
	;;
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   180
    *)
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   181
	echo "Invalid method $METHOD"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   182
	exit 2
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   183
	;;
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   184
esac
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   185
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   186
${METHOD}_gconf_cache
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   187
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   188
exit $SMF_EXIT_OK