2010-11-04 13:53:46 +01:00
|
|
|
#!/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"
|
|
|
|
|
2011-07-01 15:22:10 +02:00
|
|
|
export PATH="$PATH:/usr/local/bin"
|
|
|
|
|
2010-11-04 13:53:46 +01:00
|
|
|
# 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
|
2012-12-09 17:33:03 +01:00
|
|
|
if [ ! -f "${GCONF_SCHEMAS_DIR}/${f}" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
2010-11-04 13:53:46 +01:00
|
|
|
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
|
2012-12-09 17:33:03 +01:00
|
|
|
if [ ! -f "${GCONF_SCHEMAS_DIR}/${f}" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
2010-11-04 13:53:46 +01:00
|
|
|
${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
|
2012-12-09 17:33:03 +01:00
|
|
|
if [ ! -f "${GCONF_SCHEMAS_DIR}/${f}" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
2010-11-04 13:53:46 +01:00
|
|
|
${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
|
2012-12-09 17:33:03 +01:00
|
|
|
if [ ! -f "${GCONF_SCHEMAS_DIR}/${f}" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
2010-11-04 13:53:46 +01:00
|
|
|
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
|