Blame Extras/update-backgrounds.sh

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