|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# Rebrand CentOS Symbol 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 Symbols 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 |
# ----------------------------------------------------------------------
|
|
|
418249 |
# $Id$
|
|
|
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_SYMBOLS=~/artwork/trunk/Identity/Brands
|
|
|
4c79b5 |
WORKPLACE=$(pwd)
|
|
|
4c79b5 |
TRG=/usr/share/pixmaps/redhat
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Actually, images related to CentOS Symbol are contained in files
|
|
|
4c79b5 |
# that begin its filename with the words `shadowman', and `rpm'. We
|
|
|
4c79b5 |
# use that pattern here to rebrand the images with the appropriate
|
|
|
4c79b5 |
# CentOS information.
|
|
|
4c79b5 |
for FILE in $TRG/{shadowman,rpm}*;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 use the identify utility to get it
|
|
|
4c79b5 |
# and other image properties.
|
|
|
4c79b5 |
PROP=`identify $FILE`
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Define image name.
|
|
|
4c79b5 |
NAME=`basename $FILE`
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Define image width.
|
|
|
4c79b5 |
WIDTH=`echo $PROP | cut -d' ' -f3 | cut -dx -f1`
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Define image format. We are using only three characters in the
|
|
|
4c79b5 |
# image 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 |
SYMBOL=$SRC_SYMBOLS/Img/centos/symbol/5c-a/violet/${WIDTH}.${FORMAT}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# If SYMBOL doesn't exist go to Logos section, render it, come
|
|
|
4c79b5 |
# back here and continue.
|
|
|
4c79b5 |
if [ ! -f $SYMBOL ];then
|
|
|
4c79b5 |
cd $SRC_SYMBOLS
|
|
|
4c79b5 |
./render.sh centos/symbols/5c-a/violet/$WIDTH
|
|
|
4c79b5 |
cd $WORKPLACE
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Rebrand FILE with CentOS Symbol
|
|
|
4c79b5 |
if [ -f $LOCATION ] || [ -h $LOCATION ]; then
|
|
|
4c79b5 |
/bin/cp --remove-destination \
|
|
|
4c79b5 |
--verbose \
|
|
|
4c79b5 |
-Z system_u:object_r:usr_t \
|
|
|
4c79b5 |
$SYMBOL $FILE
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
done
|