components/desktop/desktop-cache/files/pixbuf-loaders-installer
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, 2014, 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
# for each architecture 
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    47
#   if loader file exist 
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    48
#      get the list of modules newer than the loader file
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    49
#   else
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    50
#      make list greater than zero
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    51
#
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    52
#   if list generate loader list     
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    53
#
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    54
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    55
ARCH64=`/bin/isainfo -k`
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    56
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    57
if [[ $ARCH64 != "amd64" ]] && [[ "$ARCH64" != "sparcv9" ]]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    58
  ARCH64=""
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    59
fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    60
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    61
start_pixbuf_loaders_installer ()
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    62
{
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    63
for DIR in "" $ARCH64; do
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    64
  test -x /usr/bin/$DIR/gdk-pixbuf-query-loaders || {
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    65
      echo "gdk-pixbuf-query-loaders not installed"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    66
      continue
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    67
  }
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    68
  test -w /etc/$DIR/gtk-2.0 || {
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    69
      echo "/etc/$DIR/gtk-2.0 is not writable, skipping."
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    70
      return
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 [ -a "/etc/$DIR/gtk-2.0/gdk-pixbuf.loaders" ] && [ ! -w "/etc/$DIR/gtk-2.0/gdk-pixbuf.loaders" ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    73
    echo "/etc/$DIR/gtk-2.0/gdk-pixbuf.loaders is not writable, skipping."
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    74
    return
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    75
  fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    76
  if [ -a "/etc/$DIR/gtk-2.0/gdk-pixbuf.loaders" ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    77
    RESULT=`${FIND_NEWER} -f -c -m --name '*.so' \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    78
	--newer /etc/$DIR/gtk-2.0/gdk-pixbuf.loaders \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    79
	/usr/lib/$DIR/gdk-pixbuf-2.0/*/loaders 2>/dev/null`
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    80
  else
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    81
    RESULT="no gdk pixbuf loaders file"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    82
  fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    83
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    84
  if [ -n "$RESULT" ]; then 
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    85
    echo "updating/creating gdk pixbuf loaders file"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    86
    /usr/bin/$DIR/gdk-pixbuf-query-loaders > /etc/$DIR/gtk-2.0/gdk-pixbuf.loaders
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    87
    if [ $? -ne 0 ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    88
      echo "gdk-pixbuf-query-loaders exited with an error while generating the installer file /etc/$DIR/gtk-2.0/gdk-pixbuf.loaders"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    89
      exit $SMF_EXIT_ERR_FATAL
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    90
    else
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    91
      echo "gdk pixbuf loaders installed in /etc/$DIR/gtk-2.0/gdk-pixbuf.loaders"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    92
    fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    93
  fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    94
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    95
  test -w /usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0 || {
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    96
      echo "/usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0 is not writable, skipping."
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    97
      return
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    98
  }
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    99
  if [ -a "/usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0/loaders.cache" ] && [ ! -w "/usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0/loaders.cache" ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   100
    echo "/usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0/loaders.cache is not writable, skipping."
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   101
    return
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   102
  fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   103
  if [ -a "/usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0/loaders.cache" ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   104
    RESULT=`${FIND_NEWER} -f -c -m --name '*.so' \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   105
	--newer /usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0/loaders.cache \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   106
	/usr/lib/$DIR/gdk-pixbuf-2.0/*/loaders 2>/dev/null`
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   107
  else
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   108
    RESULT="no loaders cache file"
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
  if [ -n "$RESULT" ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   112
    echo "updating/creating loaders cache file"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   113
    /usr/bin/$DIR/gdk-pixbuf-query-loaders > /usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0/loaders.cache
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   114
    if [ $? -ne 0 ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   115
      echo "gdk-pixbuf-query-loaders exited with an error while generating the installer file /usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0/loaders.cache"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   116
      exit $SMF_EXIT_ERR_FATAL
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   117
    else
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   118
      echo "loaders cache installed in /usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0/loaders.cache"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   119
    fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   120
  fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   121
done
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   122
}
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   123
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   124
refresh_pixbuf_loaders_installer ()
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   125
{
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   126
for DIR in "" $ARCH64; do
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   127
  test -x /usr/bin/$DIR/gdk-pixbuf-query-loaders || {
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   128
      echo "gdk-pixbuf-query-loaders not installed"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   129
      continue
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   130
  }
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   131
  test -w /etc/$DIR/gtk-2.0 || {
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   132
      echo "/etc/$DIR/gtk-2.0 is not writable, skipping."
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   133
      return
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   134
  }
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   135
  if [ -a "/etc/$DIR/gtk-2.0/gdk-pixbuf.loaders" ] && [ ! -w "/etc/$DIR/gtk-2.0/gdk-pixbuf.loaders" ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   136
    echo "/etc/$DIR/gtk-2.0/gdk-pixbuf.loaders is not writable, skipping."
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   137
    return
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   138
  fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   139
  if [ -a "/etc/$DIR/gtk-2.0/gdk-pixbuf.loaders" ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   140
    RESULT=`/usr/bin/find /usr/lib/$DIR/gdk-pixbuf-2.0/*/loaders/*.so ! -type d \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   141
	   -follow -print 2>/dev/null`
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
    RESULT="no gdk pixbuf loaders file"
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
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   146
  if [ -n "$RESULT" ]; then 
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   147
    echo "updating/creating gdk pixbuf loaders file"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   148
    /usr/bin/$DIR/gdk-pixbuf-query-loaders > /etc/$DIR/gtk-2.0/gdk-pixbuf.loaders
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   149
    if [ $? -ne 0 ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   150
      echo "gdk-pixbuf-query-loaders exited with an error while generating the installer file /etc/$DIR/gtk-2.0/gdk-pixbuf.loaders"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   151
      exit $SMF_EXIT_ERR_FATAL
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   152
    else
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   153
      echo "gdk pixbuf loaders installed in /etc/$DIR/gtk-2.0/gdk-pixbuf.loaders"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   154
    fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   155
  fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   156
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   157
  test -w /usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0 || {
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   158
      echo "/usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0 is not writable, skipping."
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   159
      return
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   160
  }
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   161
  if [ -a "/usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0/loaders.cache" ] && [ ! -w "/usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0/loaders.cache" ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   162
    echo "/usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0/loaders.cache is not writable, skipping."
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   163
    return
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
  if [ -a "/usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0/loaders.cache" ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   166
    RESULT=`/usr/bin/find /usr/lib/$DIR/gdk-pixbuf-2.0/*/loaders/*.so ! -type d \
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   167
           -follow -print 2>/dev/null`
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   168
  else
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   169
    RESULT="no loaders cache file"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   170
  fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   171
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   172
  if [ -n "$RESULT" ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   173
    echo "updating/creating loaders cache file"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   174
    /usr/bin/$DIR/gdk-pixbuf-query-loaders > /usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0/loaders.cache
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   175
    if [ $? -ne 0 ]; then
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   176
      echo "gdk-pixbuf-query-loaders exited with an error while generating the installer file /usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0/loaders.cache"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   177
      exit $SMF_EXIT_ERR_FATAL
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   178
    else
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   179
      echo "loaders cache installed in /usr/lib/$DIR/gdk-pixbuf-2.0/2.10.0/loaders.cache"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   180
    fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   181
  fi
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   182
done
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
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   185
METHOD=$1
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   186
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   187
case "$METHOD" in
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   188
    'start')
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   189
	# Continue with rest of script
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   190
	;;
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   191
    'refresh')
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   192
	# Continue with rest of script
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   193
	;;
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   194
    -*)
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   195
	echo $USAGE
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   196
	exit 2
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   197
	;;
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   198
    *)
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   199
	echo "Invalid method $METHOD"
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   200
	exit 2
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   201
	;;
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   202
esac
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   203
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   204
${METHOD}_pixbuf_loaders_installer
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   205
d78a523a8925 23169122 Move desktop-cache package to Userland
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   206
exit $SMF_EXIT_OK