|
|
0a3f74 |
#!/bin/bash
|
|
|
0a3f74 |
#
|
|
|
2a08b7 |
# svg_doMetadata.sh -- This function updates metadata values inside
|
|
|
2a08b7 |
# scalable vector graphic (SVG) files using default values from The
|
|
|
2a08b7 |
# CentOS Project.
|
|
|
0a3f74 |
#
|
|
|
3b0984 |
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
|
|
|
fa95b1 |
#
|
|
|
fa95b1 |
# This program is free software; you can redistribute it and/or modify
|
|
|
fa95b1 |
|
|
|
dcd347 |
|
|
|
dcd347 |
|
|
|
fa95b1 |
#
|
|
|
74a058 |
|
|
|
74a058 |
|
|
|
0a3f74 |
|
|
|
0a3f74 |
# General Public License for more details.
|
|
|
0a3f74 |
#
|
|
|
0a3f74 |
|
|
|
0a3f74 |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
0a3f74 |
# ----------------------------------------------------------------------
|
|
|
0a3f74 |
# $Id$
|
|
|
0a3f74 |
# ----------------------------------------------------------------------
|
|
|
0a3f74 |
|
|
|
2a08b7 |
function svg_doMetadata {
|
|
|
0a3f74 |
|
|
|
0a3f74 |
|
|
|
b8145c |
local TEMPLATE="${TUNEUP_BACKEND_CONFIG}/metadata.sed"
|
|
|
0a3f74 |
|
|
|
0a3f74 |
|
|
|
371be2 |
cli_checkFiles $TEMPLATE
|
|
|
0a3f74 |
|
|
|
0a3f74 |
|
|
|
2a08b7 |
local TITLE=$(basename "$FILE")
|
|
|
0a3f74 |
|
|
|
0a3f74 |
|
|
|
2a08b7 |
local URL=$(echo $FILE | sed 's!/home/centos!https://projects.centos.org/svn!')
|
|
|
0a3f74 |
|
|
|
0a3f74 |
# Build keywords from file path. Do not include filename, it is
|
|
|
0a3f74 |
|
|
|
2a08b7 |
local KEY=''
|
|
|
2a08b7 |
local KEYS=$(dirname "$FILE" | cut -d/ -f6- | tr '/' '\n')
|
|
|
0a3f74 |
|
|
|
0a3f74 |
# Build keywords using SVG standard format. Note that this
|
|
|
0a3f74 |
|
|
|
0a3f74 |
|
|
|
0a3f74 |
# new line of each line using one backslash (\). As we are doing
|
|
|
0a3f74 |
|
|
|
0a3f74 |
|
|
|
0a3f74 |
|
|
|
0a3f74 |
KEYS=$(\
|
|
|
0a3f74 |
for KEY in $KEYS;do
|
|
|
0a3f74 |
echo " <rdf:li>$KEY</rdf:li>\\"
|
|
|
0a3f74 |
done)
|
|
|
0a3f74 |
|
|
|
0a3f74 |
|
|
|
371be2 |
local INSTANCE=$(cli_getTemporalFile $TEMPLATE)
|
|
|
0a3f74 |
|
|
|
2a08b7 |
|
|
|
371be2 |
cp $TEMPLATE $INSTANCE
|
|
|
0a3f74 |
|
|
|
0a3f74 |
# Check template instance. We cannot continue if the template
|
|
|
0a3f74 |
|
|
|
654911 |
cli_checkFiles $INSTANCE
|
|
|
0a3f74 |
|
|
|
0a3f74 |
|
|
|
0a3f74 |
sed -r -i \
|
|
|
2a08b7 |
-e "s!=TITLE=!$TITLE!" \
|
|
|
0a3f74 |
-e "s!=URL=!$URL!" \
|
|
|
0a3f74 |
-e "s!=DATE=!$(date "+%Y-%m-%d")!" $INSTANCE
|
|
|
0a3f74 |
sed -i -r "/=KEYWORDS=/c\\${KEYS}" $INSTANCE
|
|
|
0a3f74 |
sed -i -r 's/>$/>\\/g' $INSTANCE
|
|
|
63de38 |
cli_replaceTMarkers $INSTANCE
|
|
|
0a3f74 |
|
|
|
0a3f74 |
# Update scalable vector graphic using template instance.
|
|
|
0a3f74 |
sed -i -f $INSTANCE $FILE
|
|
|
0a3f74 |
|
|
|
0a3f74 |
|
|
|
0a3f74 |
if [[ -f $INSTANCE ]];then
|
|
|
0a3f74 |
rm $INSTANCE
|
|
|
0a3f74 |
fi
|
|
|
0a3f74 |
|
|
|
0a3f74 |
|
|
|
0a3f74 |
sed -i -r '/^[[:space:]]*$/d' $FILE
|
|
|
0a3f74 |
|
|
|
0a3f74 |
}
|