|
Alain Reguera Delgado |
8f60cb |
#!/bin/bash
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# svg_convertPngToDm.sh -- This function standardize production of
|
|
Alain Reguera Delgado |
8f60cb |
# display managers (e.g., Gdm and Kdm). This function copies all files
|
|
Alain Reguera Delgado |
8f60cb |
# needed into a temporal directory, realize expansion of translation
|
|
Alain Reguera Delgado |
8f60cb |
# markers and packs all the files into a tar.gz package that is used
|
|
Alain Reguera Delgado |
8f60cb |
# for installation. This function must be used as last-rendition
|
|
Alain Reguera Delgado |
8f60cb |
# action for Gdm and Kdm directory specific base-rendition actions.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# Copyright (C) 2009-2013 The CentOS Project
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# This program is free software; you can redistribute it and/or modify
|
|
Alain Reguera Delgado |
8f60cb |
# it under the terms of the GNU General Public License as published by
|
|
Alain Reguera Delgado |
8f60cb |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
Alain Reguera Delgado |
8f60cb |
# your option) any later version.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# This program is distributed in the hope that it will be useful, but
|
|
Alain Reguera Delgado |
8f60cb |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Alain Reguera Delgado |
8f60cb |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Alain Reguera Delgado |
8f60cb |
# General Public License for more details.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# You should have received a copy of the GNU General Public License
|
|
Alain Reguera Delgado |
8f60cb |
# along with this program; if not, write to the Free Software
|
|
Alain Reguera Delgado |
8f60cb |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# ----------------------------------------------------------------------
|
|
Alain Reguera Delgado |
8f60cb |
# $Id$
|
|
Alain Reguera Delgado |
8f60cb |
# ----------------------------------------------------------------------
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
function svg_convertPngToDm {
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Print separator line.
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage '-' --as-separator-line
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Initialize source and destination local variables.
|
|
Alain Reguera Delgado |
8f60cb |
local SRC=''
|
|
Alain Reguera Delgado |
8f60cb |
local DST=''
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Initialize display manager type.
|
|
Alain Reguera Delgado |
8f60cb |
local DM=$(render_getConfigOption "${ACTION}" '2')
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Initialize screen resolutions used by display manager theme.
|
|
Alain Reguera Delgado |
8f60cb |
# These are the different screen resolutions a display manager
|
|
Alain Reguera Delgado |
8f60cb |
# theme is built for. The amount of screen resolution a display
|
|
Alain Reguera Delgado |
8f60cb |
# manager theme can be built for is limited to the amount of
|
|
Alain Reguera Delgado |
8f60cb |
# background files provided by the artistic motif used to build
|
|
Alain Reguera Delgado |
8f60cb |
# the display manager theme.
|
|
Alain Reguera Delgado |
8f60cb |
local RESOLUTION=''
|
|
Alain Reguera Delgado |
8f60cb |
local RESOLUTIONS=$(render_getConfigOption "${ACTION}" '3')
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Verify screen resolutions. We cannot produce display manager
|
|
Alain Reguera Delgado |
8f60cb |
# theme if no screen resolution has been specified.
|
|
Alain Reguera Delgado |
8f60cb |
if [[ "$RESOLUTIONS" == '' ]];then
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "`gettext "There is no resolution information to process."`" --as-error-line
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Initialize theme information we are going to build the display
|
|
Alain Reguera Delgado |
8f60cb |
# manager theme for.
|
|
Alain Reguera Delgado |
8f60cb |
local THEME=$(cli_getPathComponent $ACTIONVAL --motif)
|
|
Alain Reguera Delgado |
8f60cb |
local THEME_NAME=$(cli_getPathComponent $ACTIONVAL --motif-name)
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Initialize temporal directory where we collect all files needed
|
|
Alain Reguera Delgado |
8f60cb |
# in order to create the tar.gz file. This intermediate step is
|
|
Alain Reguera Delgado |
8f60cb |
# also needed in order to expand translation markers from XML and
|
|
Alain Reguera Delgado |
8f60cb |
# Desktop definitions.
|
|
Alain Reguera Delgado |
8f60cb |
local TMPDIR=$(cli_getTemporalFile 'dm')
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Initialize source location for brands. This is the place where
|
|
Alain Reguera Delgado |
8f60cb |
# brand information, needed to build the display manager theme, is
|
|
Alain Reguera Delgado |
8f60cb |
# retrieved from.
|
|
Alain Reguera Delgado |
8f60cb |
local BRAND_BASEDIR=${TCAR_WORKDIR}/Identity/Images/Brands
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Initialize source location for artistic motif's backgrounds.
|
|
Alain Reguera Delgado |
8f60cb |
# This is the place where background information needed to ubild
|
|
Alain Reguera Delgado |
8f60cb |
# the display manager theme is retrieved from.
|
|
Alain Reguera Delgado |
8f60cb |
local BGS=${TCAR_WORKDIR}/Identity/Images/Themes/${THEME}/Backgrounds/Img/Png
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Initialize file variables. File variables are used build and
|
|
Alain Reguera Delgado |
8f60cb |
# process the file relation between source and target locations.
|
|
Alain Reguera Delgado |
8f60cb |
local FILE=''
|
|
Alain Reguera Delgado |
8f60cb |
local FILES=''
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Define major release from template.
|
|
Alain Reguera Delgado |
8f60cb |
local MAJOR_RELEASE=$(cli_getPathComponent "$TEMPLATE" "--release-major")
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Define file relation between source and target locations, based
|
|
Alain Reguera Delgado |
8f60cb |
# on whether we are producing GDM or KDM. Use the colon character
|
|
Alain Reguera Delgado |
8f60cb |
# (`:') as separator; on the left side we put the file's source
|
|
Alain Reguera Delgado |
8f60cb |
# location and in the right side the file's target location.
|
|
Alain Reguera Delgado |
8f60cb |
# Presently, both GDM and KDM are very similar on files with the
|
|
Alain Reguera Delgado |
8f60cb |
# exception that GDM does use icons near actions buttons (e.g.,
|
|
Alain Reguera Delgado |
8f60cb |
# shutdown, reboot, session, language) and KDM doesn't.
|
|
Alain Reguera Delgado |
8f60cb |
case ${DM} in
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
Gdm )
|
|
Alain Reguera Delgado |
8f60cb |
FILES="\
|
|
Alain Reguera Delgado |
8f60cb |
${BRAND_BASEDIR}/Symbols/48/${TCAR_BRAND}.png:${TCAR_BRAND}-symbol.png
|
|
Alain Reguera Delgado |
8f60cb |
${OUTPUT}/screenshot.png:screenshot.png
|
|
Alain Reguera Delgado |
8f60cb |
$(dirname $TEMPLATE)/GdmGreeterTheme.xml:${THEME_NAME}.xml
|
|
Alain Reguera Delgado |
8f60cb |
$(dirname $TEMPLATE)/GdmGreeterTheme.desktop:GdmGreeterTheme.desktop
|
|
Alain Reguera Delgado |
8f60cb |
$(dirname $TEMPLATE)/icon-language.png:icon-language.png
|
|
Alain Reguera Delgado |
8f60cb |
$(dirname $TEMPLATE)/icon-reboot.png:icon-reboot.png
|
|
Alain Reguera Delgado |
8f60cb |
$(dirname $TEMPLATE)/icon-session.png:icon-session.png
|
|
Alain Reguera Delgado |
8f60cb |
$(dirname $TEMPLATE)/icon-shutdown.png:icon-shutdown.png
|
|
Alain Reguera Delgado |
8f60cb |
"
|
|
Alain Reguera Delgado |
8f60cb |
;;
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
Kdm )
|
|
Alain Reguera Delgado |
8f60cb |
FILES="\
|
|
Alain Reguera Delgado |
8f60cb |
${BRAND_BASEDIR}/Symbols/48/${TCAR_BRAND}.png:${TCAR_BRAND}-symbol.png
|
|
Alain Reguera Delgado |
8f60cb |
${OUTPUT}/screenshot.png:screenshot.png
|
|
Alain Reguera Delgado |
8f60cb |
$(dirname $TEMPLATE)/GdmGreeterTheme.xml:${THEME_NAME}.xml
|
|
Alain Reguera Delgado |
8f60cb |
$(dirname $TEMPLATE)/GdmGreeterTheme.desktop:GdmGreeterTheme.desktop
|
|
Alain Reguera Delgado |
8f60cb |
"
|
|
Alain Reguera Delgado |
8f60cb |
;;
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
* )
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "`eval_gettext "The \\\"\\\$DM\\\" display manager is not supported yet."`" --as-error-line
|
|
Alain Reguera Delgado |
8f60cb |
;;
|
|
Alain Reguera Delgado |
8f60cb |
esac
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
for FILE in $FILES;do
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Define source location.
|
|
Alain Reguera Delgado |
8f60cb |
SRC=$(echo $FILE | cut -d: -f1)
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Define target location.
|
|
Alain Reguera Delgado |
8f60cb |
DST=${TMPDIR}/${THEME_NAME}/$(echo $FILE | cut -d: -f2)
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Verify source files.
|
|
Alain Reguera Delgado |
8f60cb |
cli_checkFiles -e $SRC
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Verify parent directory for target file.
|
|
Alain Reguera Delgado |
8f60cb |
if [[ ! -d $(dirname $DST) ]];then
|
|
Alain Reguera Delgado |
8f60cb |
mkdir -p $(dirname $DST)
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Copy files from source to target location.
|
|
Alain Reguera Delgado |
8f60cb |
cp ${SRC} ${DST}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Expand translation markers.
|
|
Alain Reguera Delgado |
8f60cb |
if [[ ${DST} =~ "\.(xml|desktop)$" ]];then
|
|
Alain Reguera Delgado |
8f60cb |
cli_expandTMarkers "${DST}"
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
done
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Move into temporal directory.
|
|
Alain Reguera Delgado |
8f60cb |
pushd $TMPDIR > /dev/null
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
for RESOLUTION in $RESOLUTIONS;do
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Verify background information. If it doesn't exist go on
|
|
Alain Reguera Delgado |
8f60cb |
# with the next one in the list.
|
|
Alain Reguera Delgado |
8f60cb |
if [[ ! -f $BGS/${RESOLUTION}-final.png ]];then
|
|
Alain Reguera Delgado |
8f60cb |
continue
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Print action message.
|
|
Alain Reguera Delgado |
8f60cb |
if [[ -f ${RESOLUTION}.tar.gz ]];then
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "${OUTPUT}/${RESOLUTION}.tar.gz" --as-updating-line
|
|
Alain Reguera Delgado |
8f60cb |
else
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "${OUTPUT}/${RESOLUTION}.tar.gz" --as-creating-line
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Copy background information.
|
|
Alain Reguera Delgado |
8f60cb |
cp $BGS/${RESOLUTION}-final.png ${THEME_NAME}/background.png
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Create tar.gz file.
|
|
Alain Reguera Delgado |
8f60cb |
tar -czf ${RESOLUTION}.tar.gz ${THEME_NAME}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Move from temporal directory to its final location.
|
|
Alain Reguera Delgado |
8f60cb |
mv ${RESOLUTION}.tar.gz ${OUTPUT}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
done
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Return to where we were initially.
|
|
Alain Reguera Delgado |
8f60cb |
popd > /dev/null
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Remove temporal directory.
|
|
Alain Reguera Delgado |
8f60cb |
rm -r ${TMPDIR}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
}
|