|
|
540e8b |
#!/bin/bash
|
|
|
540e8b |
#
|
|
|
540e8b |
# render_checkAbsolutePaths.sh -- This function retrives absolute
|
|
|
540e8b |
# files and checks their existence. In order for design templates to
|
|
|
540e8b |
# point different artistic motifs, design templates make use of
|
|
|
540e8b |
# external files that point to specific artistic motif background
|
|
|
540e8b |
# images. If such external files doesn't exist, print a message and
|
|
|
540e8b |
# stop script execution. We cannot continue without background
|
|
|
540e8b |
# information.
|
|
|
540e8b |
#
|
|
|
540e8b |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
540e8b |
#
|
|
|
540e8b |
# This program is free software; you can redistribute it and/or
|
|
|
540e8b |
# modify it under the terms of the GNU General Public License as
|
|
|
540e8b |
# published by the Free Software Foundation; either version 2 of the
|
|
|
540e8b |
# License, or (at your option) any later version.
|
|
|
540e8b |
#
|
|
|
540e8b |
# This program is distributed in the hope that it will be useful, but
|
|
|
540e8b |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
540e8b |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
540e8b |
# General Public License for more details.
|
|
|
540e8b |
#
|
|
|
540e8b |
# You should have received a copy of the GNU General Public License
|
|
|
540e8b |
# along with this program; if not, write to the Free Software
|
|
|
540e8b |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
540e8b |
# USA.
|
|
|
540e8b |
#
|
|
|
540e8b |
# ----------------------------------------------------------------------
|
|
|
540e8b |
# $Id$
|
|
|
540e8b |
# ----------------------------------------------------------------------
|
|
|
540e8b |
|
|
|
540e8b |
function render_checkAbsolutePaths {
|
|
|
540e8b |
|
|
|
540e8b |
local FILE=''
|
|
|
540e8b |
local ABSPATHS=''
|
|
|
540e8b |
|
|
|
540e8b |
# Define absolute path of file we need to retrive absolute paths
|
|
|
540e8b |
# from.
|
|
|
540e8b |
FILE="$1"
|
|
|
540e8b |
|
|
|
540e8b |
# Verify existence of file we need to retrive absolute paths from.
|
|
|
540e8b |
cli_checkFiles $FILE 'f'
|
|
|
540e8b |
|
|
|
540e8b |
# Retrive absolute paths from file.
|
|
|
540e8b |
ABSPATHS=$(egrep '="/[a-zA-Z0-9_./-]+" ' $FILE \
|
|
|
540e8b |
| sed -r "s/ /\n/g" | egrep '(sodipodi:absref|xlink:href)=' \
|
|
|
540e8b |
| sed -r "s/.+=\"(\/.+)\"/\1/" | sort | uniq)
|
|
|
540e8b |
|
|
|
540e8b |
# Verify absolute paths retrived from file.
|
|
|
540e8b |
for FILE in $ABSPATHS;do
|
|
|
540e8b |
cli_checkFiles $FILE
|
|
|
540e8b |
done
|
|
|
540e8b |
|
|
|
540e8b |
}
|