#!/bin/bash # keep generated files up to date with mirror content # $Id$ # configuration PATH=$PATH:/usr/local/bin DIR=$HOME/ftp/mandrake # ensure proper umask umask 022 # set all update tasks here update() { subdir=$1 if [ ! -d "$subdir" ]; then return fi # update only if newer files present MD5_FILE=$subdir/media_info/MD5SUM [ -f $MD5_FILE ] || MD5_FILE=$subdir/MD5SUM if [ -f $MD5_FILE ]; then # MD5SUM is the latest file we touch NEW_FILES=`find $subdir -newer $MD5_FILE` if [ -z "$NEW_FILES" ]; then return fi fi # hdlist generation echo "Generating hdlist for $subdir" if [ -f $subdir/media_info/info.xml.lzma ]; then extraflags= # rpm5 workaround [ "${subdir#$DIR/cooker}" != "$subdir" ] && extraflags="--clean" genhdlist2 --allow-empty-media $extraflags $subdir return fi genhdlist-old --dest $subdir . arch=`basename $subdir` # nanar stuff if [ "$arch" == src ]; then echo "Penguin Liberation Front sources" > $subdir/version else echo "Penguin Liberation Front for $arch" > $subdir/version fi date >> $subdir/version pushd $subdir md5sum *hdlist.cz > MD5SUM # since 2007, index should be in media_info for the installer # we link it [ -d media_info ] || mkdir media_info for file in pubkey hdlist.cz synthesis.hdlist.cz MD5SUM; do [ ! -f media_info/$file ] || rm -f media_info/$file [ ! -f $file ] || cp -l $file media_info done popd } for section in $DIR/free $DIR/non-free; do for version in $section/*; do if [ -L $version ]; then continue fi if [ ! -d $version ]; then continue fi if [ `basename $version` == src ]; then update $version else for arch in $version/*; do if [ ! -d $arch ]; then continue fi update $arch done fi done done for section in $DIR/{2007.0,2007.1,2008.0,2008.1,2009.0,2009.1,2010.0,2010.1,2011}/*; do for subversion in $section/*; do for type in $subversion/*; do if [ `basename $type` == source ]; then update $type else for arch in $type/*; do update $arch done fi done done done for section in $DIR/cooker/*; do for type in $section/*; do if [ `basename $type` == source ]; then update $type else for arch in $type/*; do update $arch done fi done done