#!/bin/bash
# --- T2-COPYRIGHT-NOTE-BEGIN ---
# T2 SDE: package/*/gconf/gconf.postinstall
# Copyright (C) 2004 - 2022 The T2 SDE Project
# Copyright (C) 1998 - 2004 ROCK Linux Project
# 
# This Copyright note is generated by scripts/Create-CopyPatch,
# 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 version 2.
# --- T2-COPYRIGHT-NOTE-END ---

umask 022
SCHEMA_DIR=/etc/D_prefix/gconf/schemas
export GCONF_CONFIG_SOURCE="`/D_prefix/bin/gconftool-2 --get-default-source`"

echo "(Re-)Generating Gnome gconf schemes ..."
while read schema; do
    /D_prefix/bin/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 /etc/D_prefix/gconf -type d | xargs chmod 0755
find /etc/D_prefix/gconf -type f | xargs chmod 0644