|
|
878a2b |
#!/bin/bash
|
|
|
878a2b |
#
|
|
|
878a2b |
# svg_convertPngToGrub.sh -- This function provides post-rendition
|
|
|
878a2b |
# action used to produce GRUB images.
|
|
|
878a2b |
#
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
# colors contains 14 colors only and is saved in a file named
|
|
|
878a2b |
# `grub.gpl. The `grub.gpl' file is used to build the `grub.ppm' file
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
# `splash.xpm.gz' file.
|
|
|
878a2b |
#
|
|
|
878a2b |
# In order for this function to work, the `grub.gpl' file should have
|
|
|
878a2b |
|
|
|
878a2b |
#
|
|
|
878a2b |
# GIMP Palette
|
|
|
878a2b |
# Name: CentOS-TreeFlower-4-Syslinux
|
|
|
878a2b |
# Columns: 14
|
|
|
878a2b |
#
|
|
|
878a2b |
# 32 76 141 204c8d
|
|
|
878a2b |
# 36 82 146 245292
|
|
|
878a2b |
# 52 93 152 345d98
|
|
|
878a2b |
# 72 108 162 486ca2
|
|
|
878a2b |
# 102 131 176 6683b0
|
|
|
878a2b |
# 126 153 190 7e99be
|
|
|
878a2b |
# 146 170 200 92aac8
|
|
|
878a2b |
# 161 182 209 a1b6d1
|
|
|
878a2b |
# 182 199 219 b6c7db
|
|
|
878a2b |
# 202 214 228 cad6e4
|
|
|
878a2b |
# 221 230 238 dde6ee
|
|
|
878a2b |
# 235 241 245 ebf1f5
|
|
|
878a2b |
# 246 251 254 f6fbfe
|
|
|
878a2b |
# 254 255 252 fefffc
|
|
|
878a2b |
#
|
|
|
03486a |
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is free software; you can redistribute it and/or modify
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
#
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
# General Public License for more details.
|
|
|
878a2b |
#
|
|
|
878a2b |
|
|
|
878a2b |
# along with this program; if not, write to the Free Software
|
|
|
878a2b |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
878a2b |
#
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
# $Id$
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
|
|
|
878a2b |
function svg_convertPngToGrub {
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
local COLORS='14'
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
local OPTIONS=$(render_getConfigOption "$ACTION" '2-')
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
for OPTION in $OPTIONS;do
|
|
|
878a2b |
|
|
|
878a2b |
OPTION=$(echo -n $OPTION | cut -d'=' -f1)
|
|
|
878a2b |
if [[ "$OPTION" =~ "-(mapfile|verbose)" ]];then
|
|
|
878a2b |
cli_printMessage "`eval_gettext "The \\\"\\\$OPTION\\\" option is already used."`" --as-error-line
|
|
|
878a2b |
fi
|
|
|
878a2b |
done
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
local PREFIX="-${COLORS}c"
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
if [[ "$OPTIONS" =~ '-floyd' ]];then
|
|
|
878a2b |
PREFIX="${PREFIX}-floyd"
|
|
|
878a2b |
fi
|
|
|
878a2b |
|
|
|
684e48 |
|
|
|
684e48 |
|
|
|
684e48 |
|
|
|
684e48 |
local LOGS=${FILE}${PREFIX}.log
|
|
|
684e48 |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
local PALETTE_GPL=${MOTIF_DIR}/Palettes/grub.gpl
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
if [[ ! -f $PALETTE_GPL ]];then
|
|
|
878a2b |
svn cp ${MODEL_BASEDIR}/${FLAG_THEME_MODEL}/Palettes/grub.gpl ${PALETTE_GPL}
|
|
|
878a2b |
cli_expandTMarkers ${PALETTE_GPL}
|
|
|
878a2b |
fi
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
local PALETTE_PPM=$(cli_getTemporalFile "grub.ppm")
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
cli_printMessage "${FILE}.pnm" --as-savedas-line
|
|
|
878a2b |
pngtopnm -verbose \
|
|
|
684e48 |
< ${FILE}.png 2>${LOGS} > ${FILE}.pnm
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
cli_printMessage "$PALETTE_GPL" --as-palette-line
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
svg_convertGplToPpm "$PALETTE_GPL" "$PALETTE_PPM" "$COLORS"
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
cli_printMessage "${FILE}${PREFIX}.ppm" --as-savedas-line
|
|
|
878a2b |
pnmremap -verbose -mapfile=$PALETTE_PPM $OPTIONS \
|
|
|
684e48 |
< ${FILE}.pnm 2>>${LOGS} > ${FILE}${PREFIX}.ppm
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
if [[ -f ${PALETTE_PPM} ]];then
|
|
|
878a2b |
rm $PALETTE_PPM
|
|
|
878a2b |
fi
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
cli_printMessage "${FILE}${PREFIX}.xpm.gz" --as-savedas-line
|
|
|
878a2b |
ppmtoxpm \
|
|
|
684e48 |
< ${FILE}${PREFIX}.ppm 2>>${LOGS} > ${FILE}.xpm \
|
|
|
878a2b |
&& gzip --force ${FILE}.xpm \
|
|
|
878a2b |
&& mv ${FILE}.xpm.gz ${FILE}${PREFIX}.xpm.gz
|
|
|
878a2b |
|
|
|
878a2b |
}
|