#! /bin/bash
#
# bin/link-cursors
# Part of ComixCursors, a desktop cursor theme.
#
# Copyright © 2010 Ben Finney <ben+gnome@benfinney.id.au>
# Copyright © 2006–2010 Jens Luetkens <j.luetkens@hamburg.de>
#
# This work 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, either version 3 of the License, or
# (at your option) any later version.
#
# This work is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this work. If not, see <http://www.gnu.org/licenses/>.

# Create cursor name symlinks.

cursordir="$1"

linksfile="cursorlinks"

sed -e 's/#.*$//' "${linksfile}" \
    | grep -v '^[[:space:]]*$' \
    | (cd "${cursordir}" ;
        while read orig new ; do
            printf "Creating symlink of %s at %s\n" "$orig" "$new" ;
            ln -sf "$orig" "$new" ;
        done)
