6 # The contents of this file are subject to the terms of the
7 # Common Development and Distribution License (the "License").
8 # You may not use this file except in compliance with the License.
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
25 # Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
28 PATH
=/usr
/bin
:/usr
/sbin
30 .
/lib
/svc
/share
/smf_include.sh
32 USAGE
="Usage: $0 <method>"
34 if [[ $# -ne 1 ]] ; then
43 # Continue with rest of script
50 print
"Invalid method $METHOD" >&2
56 # In February 2023 we stopped to create and update GIO module cache for 32-bit
57 # modules at /usr/lib/gio/modules/giomodule.cache so this file is never created
58 # on new installations. However, if we are updating from an older installation
59 # the file could be there occupying space and possibly create confusion.
61 # So let's cleanup that.
63 # The following two lines should be removed only after there are no modules
64 # delivered to /usr/lib/gio/modules/ and some reasonable time passed so
65 # everybody already updated their installations and there is no
66 # /usr/lib/gio/modules lingering around.
68 rm -f /usr
/lib
/gio
/modules
/giomodule.cache
69 rmdir /usr
/lib
/gio
/modules
2> /dev
/null
72 MODULE_DIR
="/usr/lib/64/gio/modules"
73 CACHE_FILE
="${MODULE_DIR}/giomodule.cache"
75 if [[ ! -r "${CACHE_FILE}" ]] ; then
76 # Need to create initial file
78 elif [[ "${MODULE_DIR}" -nt "${CACHE_FILE}" ]] ; then
79 # Directory has been updated - file may have been added or removed
81 elif [[ -n "$(find ${MODULE_DIR} -newer ${CACHE_FILE})" ]] ; then
82 # At least one file has been updated
86 if [[ "${NEED_COMPILE}" -ne 0 ]] ; then
87 # In a case we uninstalled latest GIO module we need to cleanup the
88 # cache file because if there are no GIO modules installed then
89 # gio-querymodules below does nothing and succeeds silently. If there
90 # are GIO modules installed the cleanup is harmless because the cache
91 # file will be created again by gio-querymodules call below.
93 rmdir "${MODULE_DIR}" 2> /dev
/null
94 [[ -d "${MODULE_DIR}" ]] ||
exit $SMF_EXIT_OK
97 /usr
/bin
/gio-querymodules
"${MODULE_DIR}"
99 if [[ $result -ne 0 ]] ; then
100 print
"/usr/bin/gio-querymodules failed with exit code $result"
101 exit $SMF_EXIT_ERR_FATAL
103 if [[ ! -r "${CACHE_FILE}" ]] ; then
104 exit $SMF_EXIT_ERR_FATAL
106 # Since gio-querymodules renames the result into place, update
107 # the file mtime after moving so it matches the directory mtime.
108 touch -c -r "${MODULE_DIR}" "${CACHE_FILE}"