Blame Identity/Models/Html/update-backgrounds.sh

d6e8d8
#!/bin/bash
d6e8d8
#
d6e8d8
# Update Background Images.
d6e8d8
#
d6e8d8
# This script is used to copy background images from a Theme into the
d6e8d8
# different extra works here in trunk/Extras directory.
d6e8d8
#
d6e8d8
# --
d6e8d8
# CentOS Artowk SIG | https://projects.centos.org/trac/artwork
d6e8d8
d6e8d8
#
d6e8d8
# Initializations
d6e8d8
#
d6e8d8
THEMEDIR=../Themes
d6e8d8
d6e8d8
function updateBG {
d6e8d8
d6e8d8
    if [ "$TARGET_BG_HTML" != "NONE" ];then
d6e8d8
        printf "   HTML : "
d6e8d8
        cp $SOURCE_BG_HTML $TARGET_BG_HTML
d6e8d8
        printf " Updated.\n"
d6e8d8
    fi
d6e8d8
d6e8d8
    if [ "$TARGET_BG_HEAD" != "NONE" ];then
d6e8d8
        printf " HEADER : "
d6e8d8
        cp $SOURCE_BG_HEAD $TARGET_BG_HEAD
d6e8d8
        printf " Updated.\n"
d6e8d8
    fi
d6e8d8
d6e8d8
    if [ "$TARGET_BG_TOC" != "NONE" ];then
d6e8d8
        printf "    TOC : "
d6e8d8
        cp $SOURCE_BG_TOC $TARGET_BG_TOC
d6e8d8
        printf " Updated.\n"
d6e8d8
    fi
d6e8d8
}
d6e8d8
d6e8d8
#
d6e8d8
# Add some presentation.
d6e8d8
#
d6e8d8
clear;
d6e8d8
echo '---------------------------------------------------'
d6e8d8
echo ' CentOS Artwort SIG -> Update Backgrounds'
d6e8d8
echo '---------------------------------------------------'
d6e8d8
#
d6e8d8
# Define Theme to use.
d6e8d8
#
d6e8d8
THEMES=`ls $THEMEDIR | sed 's!/$!!g'`
d6e8d8
echo 'Select the theme you want to apply:'
d6e8d8
select i in $THEMES;do
d6e8d8
    THEME=$i;
d6e8d8
    SOURCE_BG_HTML=$THEMEDIR/$THEME/Backgrounds/img/html-bg.png
d6e8d8
    SOURCE_BG_HEAD=$THEMEDIR/$THEME/Backgrounds/img/header-bg.png
d6e8d8
    SOURCE_BG_TOC=$THEMEDIR/$THEME/Backgrounds/img/toc-bg.png
d6e8d8
    break;
d6e8d8
done
d6e8d8
d6e8d8
#
d6e8d8
# Verify Theme Background Images
d6e8d8
#
d6e8d8
for i in `echo $SOURCE_BG_HTML $SOURCE_BG_HEAD $SOURCE_BG_TOC`;do
d6e8d8
    ls $i > /dev/null 2>&1; 
d6e8d8
    if [ "$?" != "0" ];then
d6e8d8
        echo "Background image can't be found in $THEME theme."
d6e8d8
        echo '---------------------------------------------------'
d6e8d8
        exit 1;
d6e8d8
    fi
d6e8d8
done
d6e8d8
#
d6e8d8
# Define Background Image Paths
d6e8d8
#
d6e8d8
for i in `ls`;do
d6e8d8
    if [ -d $i ];then
d6e8d8
        case $i in
d6e8d8
            Apache                      )
d6e8d8
            echo '---------------------------------------------------'
d6e8d8
            echo " Updating $i backgrounds"
d6e8d8
            echo '---------------------------------------------------'
d6e8d8
            TARGET_BG_HTML=$i/error/include/img/html-background.png
d6e8d8
            TARGET_BG_HEAD=$i/error/include/img/header-background.png
d6e8d8
            TARGET_BG_TOC=NONE # No Toc image here
d6e8d8
            updateBG;
d6e8d8
            ;;
d6e8d8
            BrowserDefaultPage          )
d6e8d8
            echo '---------------------------------------------------'
d6e8d8
            echo " Updating $i backgrounds"
d6e8d8
            echo '---------------------------------------------------'
d6e8d8
            TARGET_BG_HTML=$i/img/html-background.png
d6e8d8
            TARGET_BG_HEAD=$i/img/header-background.png
d6e8d8
            TARGET_BG_TOC=NONE # No Toc image here
d6e8d8
            updateBG;
d6e8d8
            ;;
d6e8d8
            Mantis                      )
d6e8d8
            echo '---------------------------------------------------'
d6e8d8
            echo " Updating $i backgrounds"
d6e8d8
            echo '---------------------------------------------------'
d6e8d8
            TARGET_BG_HTML=$i/images/html-background.png
d6e8d8
            TARGET_BG_HEAD=$i/images/header-background.png
d6e8d8
            TARGET_BG_TOC=NONE # No Toc image here
d6e8d8
            updateBG;
d6e8d8
            ;;
d6e8d8
            Moin                        )
d6e8d8
            echo '---------------------------------------------------'
d6e8d8
            echo " Updating $i backgrounds"
d6e8d8
            echo '---------------------------------------------------'
d6e8d8
            TARGET_BG_HTML=$i/Mettle/img/moin-html-background.png
d6e8d8
            TARGET_BG_HEAD=$i/Mettle/img/moin-header-background.png
d6e8d8
            TARGET_BG_TOC=$i/Mettle/img/moin-toc-background.png
d6e8d8
            updateBG;
d6e8d8
            ;; 
d6e8d8
            Trac                        )
d6e8d8
            echo '---------------------------------------------------'
d6e8d8
            echo " Updating $i backgrounds"
d6e8d8
            echo '---------------------------------------------------'
d6e8d8
            TARGET_BG_HTML=$i/htdocs/background.png
d6e8d8
            TARGET_BG_HEAD=$i/htdocs/header-background.png
d6e8d8
            TARGET_BG_TOC=$i/htdocs/toc.png
d6e8d8
            updateBG;
d6e8d8
            ;; 
d6e8d8
            Punbb                       )
d6e8d8
            echo '---------------------------------------------------'
d6e8d8
            echo " Updating $i backgrounds"
d6e8d8
            echo '---------------------------------------------------'
d6e8d8
            TARGET_BG_HTML=$i/img/html-background.png
d6e8d8
            TARGET_BG_HEAD=$i/img/header-background.png
d6e8d8
            TARGET_BG_TOC=NONE # No Toc image here
d6e8d8
            updateBG;
d6e8d8
            ;; 
d6e8d8
d6e8d8
            # NOTE: If you add other works that use backgrounds,
d6e8d8
            # header, or table of content (toc) images add it here.
d6e8d8
            #
d6e8d8
d6e8d8
        esac
d6e8d8
    fi
d6e8d8
d6e8d8
done
d6e8d8
echo '---------------------------------------------------'
d6e8d8
exit 0;