From ec0f955d70ff0a41624fcc521b54f9b981a8fc94 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 11 Apr 2010 12:50:35 +0200 Subject: [PATCH] Added gconf-schemas new trigger. Two new vars can be used in templates to handle GConf schemas files, gconf_entries and gconf_schemas. --HG-- extra : convert_revision : 315756b79166538ef0efae5a70c7ec8d9f7f61d9 --- xbps-src/shutils/metadata_scripts.sh | 20 ++++++ xbps-src/shutils/tmpl_funcs.sh | 1 + xbps-src/triggers/Makefile | 2 +- xbps-src/triggers/gconf-schemas | 92 ++++++++++++++++++++++++++++ 4 files changed, 114 insertions(+), 1 deletion(-) create mode 100755 xbps-src/triggers/gconf-schemas diff --git a/xbps-src/shutils/metadata_scripts.sh b/xbps-src/shutils/metadata_scripts.sh index 5631ac0bf70..bf5b0d4f545 100644 --- a/xbps-src/shutils/metadata_scripts.sh +++ b/xbps-src/shutils/metadata_scripts.sh @@ -198,6 +198,26 @@ _EOF fi fi + # + # Handle GConf schemas/entries files with gconf-schemas. + # + if [ -n "${gconf_entries}" -o -n "${gconf_schemas}" ]; then + if find . -type f -name \*.schemas \ + -o -name \*.entries 2>&1 >/dev/null; then + _add_trigger gconf-schemas + fi + if [ -n "${gconf_entries}" ]; then + echo "export gconf_entries=\"${gconf_entries}\"" \ + >> $tmpf + echo >> $tmpf + fi + if [ -n "${gconf_schemas}" ]; then + echo "export gconf_schemas=\"${gconf_schemas}\"" \ + >> $tmpf + echo >> $tmpf + fi + fi + # # Write the INSTALL/REMOVE package scripts. # diff --git a/xbps-src/shutils/tmpl_funcs.sh b/xbps-src/shutils/tmpl_funcs.sh index d5ddaafbe1a..cbe2d3a411b 100644 --- a/xbps-src/shutils/tmpl_funcs.sh +++ b/xbps-src/shutils/tmpl_funcs.sh @@ -77,6 +77,7 @@ reset_tmpl_vars() abi_depends api_depends triggers openrc_services \ replaces system_accounts build_wrksrc create_wrksrc \ ignore_vdeps_dir noverifyrdeps conflicts \ + gconf_entries gconf_schemas \ XBPS_EXTRACT_DONE XBPS_CONFIGURE_DONE \ XBPS_BUILD_DONE XBPS_INSTALL_DONE FILESDIR DESTDIR \ SRCPKGDESTDIR PATCHESDIR" diff --git a/xbps-src/triggers/Makefile b/xbps-src/triggers/Makefile index 2c3d4264eb5..5c1696c8e59 100644 --- a/xbps-src/triggers/Makefile +++ b/xbps-src/triggers/Makefile @@ -3,7 +3,7 @@ include ../vars.mk TRIGGERS= gtk-icon-cache info-files mimedb register-shell TRIGGERS+= xml-catalog gtk-immodules initramfs-tools openrc-service TRIGGERS+= update-desktopdb gtk-pixbuf-loaders pango-modules x11-fonts -TRIGGERS+= system-accounts +TRIGGERS+= system-accounts gconf-schemas .PHONY: all all: diff --git a/xbps-src/triggers/gconf-schemas b/xbps-src/triggers/gconf-schemas new file mode 100755 index 00000000000..b3efde8ed99 --- /dev/null +++ b/xbps-src/triggers/gconf-schemas @@ -0,0 +1,92 @@ +#!/bin/sh -e +# +# (Un)registers GConf schemas/entries into the schemas database directory. +# +# The following variables can be defined by a package to register .entries +# and .schemas files: +# +# gconf_entries - A list of .entries files to register. When using this +# variable, packages need to be fixed to not register +# them and to install those files to GCONF_SCHEMAS_DIR. +# gconf_schemas - A list of .schemas files to register. When using this +# variable, packages need to be fixed to not register +# them and to install those files to GCONF_SCHEMAS_DIR. +# +# Arguments: $ACTION = [run/targets] +# $TARGET = [post-install/pre-remove] +# $PKGNAME +# $VERSION +# $UPDATE = [yes/no] +# +ACTION="$1" +TARGET="$2" +PKGNAME="$3" +VERSION="$4" +UPDATE="$5" + +# The gconftool-2 binary program. +GCONFTOOL2="usr/bin/gconftool-2" + +# Default configuration source (database). +GCONF_CONFIG_SOURCE="xml::/etc/gconf/gconf.xml.defaults" + +# Where .schemas files go. +GCONF_SCHEMAS_DIR="usr/share/gconf/schemas" + +case "$ACTION" in +targets) + echo "post-install pre-remove" + ;; +run) + if [ ! -x "$GCONFTOOL2" ]; then + exit 0 + fi + if [ -z "$gconf_entries" -a -z "$gconf_schemas" ]; then + return 0 + fi + + case "$TARGET" in + post-install) + for f in ${gconf_schemas}; do + GCONF_CONFIG_SOURCE="$GCONF_CONFIG_SOURCE" \ + ${GCONFTOOL2} --makefile-install-rule \ + ${GCONF_SCHEMAS_DIR}/${f} >/dev/null + if [ $? -eq 0 ]; then + echo "Registered GConf schema: ${f}." + fi + done + for f in ${gconf_entries}; do + ${GCONFTOOL2} --config-source=${GCONF_CONFIG_SOURCE} \ + --direct --load ${GCONF_SCHEMAS_DIR}/${f} \ + >/dev/null + if [ $? -eq 0 ]; then + echo "Registered GConf entry: ${f}." + fi + done + ;; + pre-remove) + for f in ${gconf_entries}; do + ${GCONFTOOL2} --config-source=${GCONF_CONFIG_SOURCE} \ + --direct --unload ${GCONF_SCHEMAS_DIR}/${f} \ + >/dev/null + if [ $? -eq 0 ]; then + echo "Unregistered GConf entry: ${f}." + fi + done + for f in ${gconf_schemas}; do + GCONF_CONFIG_SOURCE="${GCONF_CONFIG_SOURCE}" \ + ${GCONFTOOL2} --makefile-uninstall-rule \ + ${GCONF_SCHEMAS_DIR}/${f} >/dev/null + if [ $? -eq 0 ]; then + echo "Unregistered GConf schema: ${f}." + fi + done + ;; + esac + ;; +*) + exit 1 + ;; +esac + +exit 0