diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass index fd773a0..ad3f537 100644 --- a/eclass/gnome2-utils.eclass +++ b/eclass/gnome2-utils.eclass @@ -28,6 +28,17 @@ DEPEND=">=sys-apps/sed-4" +# Find the GConf schemas that are about to be installed and save their location +# in the GNOME2_ECLASS_SCHEMAS environment variable +gnome2_gconf_savelist() { + pushd "${D}" &> /dev/null + export GNOME2_ECLASS_SCHEMAS=`find etc/gconf/schemas/ -name '*.schemas'` + #echo "preinst: D=\"${D}\"" + #echo "preinst: GNOME2_ECLASS_SCHEMAS=\"${GNOME2_ECLASS_SCHEMAS}\"" + popd &> /dev/null +} + + # Applies any schema files installed by the current ebuild to Gconf's database # using gconftool-2 gnome2_gconf_install() { @@ -35,19 +46,23 @@ gnome2_gconf_install() { return fi + if [[ -z ${GNOME2_ECLASS_SCHEMAS} ]]; then + einfo "No GNOME 2 GConf schemas found" + return + fi + # We are ready to install the GCONF Scheme now unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source) einfo "Installing GNOME 2 GConf schemas" - local contents="${ROOT}var/db/pkg/*/${PN}-${PVR}/CONTENTS" local F - for F in $(grep "^obj /etc/gconf/schemas/.\+\.schemas\b" ${contents} | gawk '{print $2}' ); do - if [[ -e "${F}" ]]; then + for F in ${GNOME2_ECLASS_SCHEMAS}; do + if [[ -e "${ROOT}${F}" ]]; then # echo "DEBUG::gconf install ${F}" - ${GCONFTOOL_BIN} --makefile-install-rule ${F} 1>/dev/null + ${GCONFTOOL_BIN} --makefile-install-rule ${ROOT}${F} 1>/dev/null fi done @@ -68,18 +83,32 @@ gnome2_gconf_uninstall() { return fi + if [[ -z ${GNOME2_ECLASS_SCHEMAS} ]]; then + einfo "No GNOME 2 GConf schemas found" + return + fi + unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source) einfo "Uninstalling GNOME 2 GConf schemas" - local contents="${ROOT}/var/db/pkg/*/${PN}-${PVR}/CONTENTS" local F - for F in $(grep "obj /etc/gconf/schemas" ${contents} | sed 's:obj \([^ ]*\) .*:\1:' ); do - # echo "DEBUG::gconf install ${F}" - ${GCONFTOOL_BIN} --makefile-uninstall-rule ${F} 1>/dev/null + for F in ${GNOME2_ECLASS_SCHEMAS}; do + if [[ -e "${ROOT}${F}" ]]; then + # echo "DEBUG::gconf uninstall ${F}" + ${GCONFTOOL_BIN} --makefile-uninstall-rule ${ROOT}${F} 1>/dev/null + fi done + + # have gconf reload the new schemas + pids=$(pgrep -x gconfd-2) + if [[ $? == 0 ]] ; then + ebegin "Reloading GConf schemas" + kill -HUP ${pids} + eend $? + fi } diff --git a/eclass/gnome2.eclass b/eclass/gnome2.eclass index 4c68f11..f4ec61d 100644 --- a/eclass/gnome2.eclass +++ b/eclass/gnome2.eclass @@ -106,6 +106,10 @@ gnome2_src_install() { rm -fr "${D}/usr/share/applications/mimeinfo.cache" } +gnome2_pkg_preinst() { + gnome2_gconf_savelist +} + gnome2_pkg_postinst() { gnome2_gconf_install fdo-mime_desktop_database_update @@ -117,9 +121,9 @@ gnome2_pkg_postinst() { fi } -#gnome2_pkg_prerm() { -# gnome2_gconf_uninstall -#} +gnome2_pkg_prerm() { + gnome2_gconf_uninstall +} gnome2_pkg_postrm() { fdo-mime_desktop_database_update @@ -131,4 +135,4 @@ gnome2_pkg_postrm() { fi } -EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm +EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_prerm pkg_postrm