void-packages

Void Source Packages
git clone git://ezup.dev/void-packages.git
Log | Files | Refs | README | LICENSE

gconf-schemas (2572B)


      1#!/bin/sh
      2#
      3# (Un)registers GConf schemas/entries into the schemas database directory.
      4#
      5# The following variables can be defined by a package to register .entries
      6# and .schemas files:
      7#
      8#  gconf_entries - A list of .entries files to register.  When using this
      9#                  variable, packages need to be fixed to not register
     10#                  them and to install those files to GCONF_SCHEMAS_DIR.
     11#  gconf_schemas - A list of .schemas files to register.  When using this
     12#                  variable, packages need to be fixed to not register
     13#                  them and to install those files to GCONF_SCHEMAS_DIR.
     14#
     15# Arguments:	$ACTION = [run/targets]
     16#		$TARGET = [post-install/pre-remove]
     17#		$PKGNAME
     18#		$VERSION
     19#		$UPDATE = [yes/no]
     20#
     21ACTION="$1"
     22TARGET="$2"
     23PKGNAME="$3"
     24VERSION="$4"
     25UPDATE="$5"
     26
     27# The gconftool-2 binary program.
     28GCONFTOOL2="usr/bin/gconftool-2"
     29
     30# Default configuration source (database).
     31GCONF_CONFIG_SOURCE="xml::/etc/gconf/gconf.xml.defaults"
     32
     33# Where .schemas files go.
     34GCONF_SCHEMAS_DIR="usr/share/gconf/schemas"
     35
     36case "$ACTION" in
     37targets)
     38	echo "post-install pre-remove"
     39	;;
     40run)
     41	if [ ! -x "$GCONFTOOL2" ]; then
     42		exit 0
     43	fi
     44	if [ -z "$gconf_entries" -a -z "$gconf_schemas" ]; then
     45		return 0
     46	fi
     47
     48	case "$TARGET" in
     49	post-install)
     50		for f in ${gconf_schemas}; do
     51			if [ ! -f "${GCONF_SCHEMAS_DIR}/${f}" ]; then
     52				continue
     53			fi
     54			GCONF_CONFIG_SOURCE="$GCONF_CONFIG_SOURCE" \
     55				${GCONFTOOL2} --makefile-install-rule \
     56				${GCONF_SCHEMAS_DIR}/${f} >/dev/null
     57			if [ $? -eq 0 ]; then
     58				echo "Registered GConf schema: ${f}."
     59			fi
     60		done
     61		for f in ${gconf_entries}; do
     62			if [ ! -f "${GCONF_SCHEMAS_DIR}/${f}" ]; then
     63				continue
     64			fi
     65			${GCONFTOOL2} --config-source=${GCONF_CONFIG_SOURCE} \
     66				--direct --load ${GCONF_SCHEMAS_DIR}/${f} \
     67				>/dev/null
     68			if [ $? -eq 0 ]; then
     69				echo "Registered GConf entry: ${f}."
     70			fi
     71		done
     72		;;
     73	pre-remove)
     74		for f in ${gconf_entries}; do
     75			if [ ! -f "${GCONF_SCHEMAS_DIR}/${f}" ]; then
     76				continue
     77			fi
     78			${GCONFTOOL2} --config-source=${GCONF_CONFIG_SOURCE} \
     79				--direct --unload ${GCONF_SCHEMAS_DIR}/${f} \
     80				>/dev/null
     81			if [ $? -eq 0 ]; then
     82				echo "Unregistered GConf entry: ${f}."
     83			fi
     84		done
     85		for f in ${gconf_schemas}; do
     86			if [ ! -f "${GCONF_SCHEMAS_DIR}/${f}" ]; then
     87				continue
     88			fi
     89			GCONF_CONFIG_SOURCE="${GCONF_CONFIG_SOURCE}" \
     90				${GCONFTOOL2} --makefile-uninstall-rule \
     91				${GCONF_SCHEMAS_DIR}/${f} >/dev/null
     92			if [ $? -eq 0 ]; then
     93				echo "Unregistered GConf schema: ${f}."
     94			fi
     95		done
     96		;;
     97	esac
     98	;;
     99*)
    100	exit 1
    101	;;
    102esac
    103
    104exit 0