Blame Identity/Webenv/update-backgrounds.sh

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