#!/bin/bash
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../gconf/gconf.postinstall
# Copyright (C) 2006 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2004 Clifford Wolf
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---

umask 022
SCHEMA_DIR=D_sysconfdir/gconf/schemas
export GCONF_CONFIG_SOURCE="`D_bindir/gconftool-2 --get-default-source`"

echo "(Re-)Generating Gnome gconf schemes ..."
while read schema; do
    D_bindir/gconftool-2 --makefile-install-rule $schema | \
	sed -e '/^[A-Z].*ed schema/d' -e '/[^ ]*/d'
done < <(
    if [ -f $SCHEMA_DIR/.stamp ]; then
	find $SCHEMA_DIR -newer $SCHEMA_DIR/.stamp -name "*.schemas"
    else
	find $SCHEMA_DIR -name "*.schemas"
    fi)

touch $SCHEMA_DIR/.stamp

echo "Correcting Gnome gconf permissions (installed incorrectly by Gnome) ..."
find D_sysconfdir/gconf -type d | xargs chmod 0755
find D_sysconfdir/gconf -type f | xargs chmod 0644