#! /bin/sh
#
# debian/wrap-cursor-themes
#
# Copyright © 2010 Ben Finney <ben+debian@benfinney.id.au>
# Copyright © 2005–2008 Sune Vuorela <debian@pusling.com>
#
# This is free software; you may copy, modify, and/or distribute this work
# under the terms of the GNU General Public License, version 2 or later.
# No warranty expressed or implied.
#
# On Debian systems, the complete text of version 2 of the GNU General
# Public License can be found in ‘/usr/share/common-licenses/GPL-2’.

# Create named wrapper theme files for each of the installed themes.

set -e

icons_builddir=${PACKAGE_BUILDDIR}/usr/share/icons
wrapperdir=${PACKAGE_BUILDDIR}/etc/X11/cursors

temp_theme=$(mktemp -t)
for theme_dir in ${icons_builddir}/ComixCursors-* ; do
    theme_name=$(basename $theme_dir)
    theme_file=${theme_dir}/index.theme
    {
        grep -v Inherits $theme_file
        printf "Inherits = %s\n" $theme_name
    } > $temp_theme
    wrapped_theme=${wrapperdir}/${theme_name}.theme
    install -m 644 $temp_theme $wrapped_theme
done 
rm $temp_theme
