Blame Scripts/Bash/Functions/Render/Config/Identity/Themes/Distro/rebrand-logos.sh

4c79b5
#!/bin/bash
4c79b5
#
4c79b5
# Rebrand CentOS Logos in your local system using images from your
4c79b5
# working copy of the CentOS Artwork Repository. Run this script (as
4c79b5
# root) if you want to see how CentOS Icons, inside CentOS Artwork
4c79b5
# Repository, look in your system.
4c79b5
#
9f5f2e
# Copyright (C) 2009-2011 Alain Reguera Delgado
4c79b5
# 
4c79b5
# This program is free software; you can redistribute it and/or
4c79b5
# modify it under the terms of the GNU General Public License as
4c79b5
# published by the Free Software Foundation; either version 2 of the
4c79b5
# License, or (at your option) any later version.
4c79b5
# 
4c79b5
# This program is distributed in the hope that it will be useful, but
4c79b5
# WITHOUT ANY WARRANTY; without even the implied warranty of
4c79b5
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c79b5
# General Public License for more details.
4c79b5
#
4c79b5
# You should have received a copy of the GNU General Public License
4c79b5
# along with this program; if not, write to the Free Software
4c79b5
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
4c79b5
# USA.
4c79b5
# 
4c79b5
# ----------------------------------------------------------------------
4c79b5
# Scripts > Identity > Themes > Distro
4c79b5
# ----------------------------------------------------------------------
4c79b5
4c79b5
# Check user id.
4c79b5
if [ $UID -ne 0 ];then
4c79b5
   cli_printMessage "`gettext "You need to run this script as root user."`"
4c79b5
   exit
4c79b5
fi
4c79b5
4c79b5
SRC_LOGOS=~/artwork/trunk/Identity/Brands
4c79b5
WORKPLACE=$(pwd)
4c79b5
TRG=/usr/share/pixmaps/redhat
4c79b5
4c79b5
# Actually, images related to CentOS Logos are contained in files that
4c79b5
# begin its filename with the word `redhat'. We use that pattern here
4c79b5
# to rebrand the images with the appropriate CentOS information.
4c79b5
for FILE in $TRG/redhat*;do
4c79b5
4c79b5
   # If FILE is a symbolic link continue.
4c79b5
   if [ -h $FILE ];then
4c79b5
      continue;
4c79b5
   fi
4c79b5
4c79b5
   # Get image properties. There are images that doesn't have the
4c79b5
   # width on the filename so we used the identify utility to get
4c79b5
   # it and other image properties.
4c79b5
   PROP=`identify $FILE`
4c79b5
4c79b5
   # Define image name.
f9b0b6
   NAME=$(basename $FILE)
4c79b5
4c79b5
   # Define image width.
4c79b5
   WIDTH=`echo $PROP | cut -d' ' -f3 | cut -dx -f1`
4c79b5
4c79b5
   # Check if image specifies emboss in its name. If so, consider it
4c79b5
   # as an emboss effect applied to the image an use the appropriate
4c79b5
   # emboss source for it.
4c79b5
   echo $NAME | grep emboss >> /dev/null
4c79b5
   if [ $? -eq 0 ];then
4c79b5
      EFFECT='-emboss'
4c79b5
   else
4c79b5
      EFFECT=
4c79b5
   fi
4c79b5
4c79b5
   # Define image format. We use only three characters in the image
4c79b5
   # extension.
4c79b5
   FORMAT=`echo $PROP \
4c79b5
         | cut -d' ' -f2 \
4c79b5
         | tr '[:upper:]' '[:lower:]' \
4c79b5
         | sed -r 's!^([a-z]{3}).*!\1!'`
4c79b5
4c79b5
   # Define the appropriate source image. This is the source image we
4c79b5
   # use to rebrand.
4c79b5
   LOGO=$SRC_LOGOS/Img/centos/horizontal/5c-a/violet/${WIDTH}${EFFECT}.${FORMAT}
4c79b5
4c79b5
   # If LOGO doesn't exist go to Logos section, render it, come
4c79b5
   # back here and continue.
4c79b5
   if [ ! -f $LOGO ];then
4c79b5
      cd $SRC_LOGOS
4c79b5
      ./render.sh centos/horizontal/5c-a/violet/$WIDTH
4c79b5
      cd $WORKPLACE
4c79b5
   fi
4c79b5
4c79b5
   # Rebrand FILE with the appropriate CentOS Logo image.
4c79b5
   if [ -f $LOCATION ] || [ -h $LOCATION ];then
4c79b5
      /bin/cp --remove-destination \
4c79b5
         --verbose \
4c79b5
         -Z system_u:object_r:usr_t \
4c79b5
         $LOGO $FILE
4c79b5
   fi
4c79b5
done
4c79b5
4c79b5
# Copy gnome-startup.png image. This image have no source inside Logos
4c79b5
# section. The original verison was copied from the distribution and
4c79b5
# rebranded using GIMP. After that I put it on inside Logos/Img/ to be
4c79b5
# used as source image on rebranding.
4c79b5
cp $SRC_LOGOS/Img/gnome-startup.png $TRG/