Invoking the script

Yesterday I wrote about the script that will update category descriptions. Today I’ll show the script that will invoke that script.

This script will fetch the file via cvsweb,

config.sh contains all the setting particular to this installation.

This code is now in beta and will move to production after it’s been invoked at least once.

#!/bin/sh

if [ ! -f config.sh ]
then
        echo "config.sh not found..."
        exit 1
fi

. config.sh

if [ $OFFLINE = 1 ]
then
        exit 0
fi

if [ "${WWWENPORTSCATEGORIES}x" = 'x' -o "${SPOOLINGDIR}x" = 'x' ]
then
        echo "please set WWWENPORTSCATEGORIES and SPOOLINGDIR in config.sh"
        exit 1
fi

CATEGORIES="${SPOOLINGDIR}/categories"

if [ -r ${WWWENPORTSCATEGORIES} ]
then
        fetch -q -o ${CATEGORIES} "http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/www/en/ports/categories?rev=HEAD&content-type=text/plain"
        if [ $? = 0 ]
        then
                /usr/bin/perl categories_update_descriptions.pl ${CATEGORIES}
        else
                logger -t FreshPorts $0 could not fetch the categories file
        fi

        # regardless of any errors, we should remove this as we don't want to keep doing this
        rm ${WWWENPORTSCATEGORIES}
else
        logger -t FreshPorts $0 was invoked but ${WWWENPORTSCATEGORIES} was not set.
fi
Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top