2012-03-12 15:18:41 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Makedist automatic build script
|
|
|
|
# Copyright (c) 2007-2009 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
|
|
|
#
|
|
|
|
. /etc/sysconfig/makedist
|
|
|
|
SOURCEDIR=/var/makedist
|
|
|
|
DESTBASEDIR=/var/ftp/pub/openmamba/devel/media
|
|
|
|
DESTBASEURL=/pub/openmamba/devel/media
|
|
|
|
[ "$TODAYDATE" ] || TODAYDATE=`date +%Y%m%d`
|
|
|
|
GLOBDOWNLOADSFILE=$DESTBASEDIR/downloads.inc
|
2012-03-12 15:41:49 +01:00
|
|
|
LANGS="it en es"
|
2012-03-12 15:18:41 +01:00
|
|
|
|
|
|
|
tmpfile=`mktemp`
|
|
|
|
|
|
|
|
[ $tmpfile ] || {
|
|
|
|
echo "Error: cannot create temporary files; aborting."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
for l in $LANGS; do
|
|
|
|
for d in `find $DESTBASEDIR/*/$l -maxdepth 0 -type d`; do
|
|
|
|
> $tmpfile
|
2012-03-12 15:41:49 +01:00
|
|
|
for f in `find $d -maxdepth 1 -name \*.iso -o -name \*.cpio.gz -o -name \*.tar.gz -o -name \*.tar.xz -o -name \*.tar.bz2`; do
|
2012-03-12 15:18:41 +01:00
|
|
|
echo `stat -c %Z $f` `basename $f` >> $tmpfile
|
|
|
|
done
|
|
|
|
|
|
|
|
filecount=0
|
|
|
|
for f in `cat $tmpfile | sort -r | awk '{ print $2 }' `; do
|
|
|
|
if [ $filecount = 0 ]; then
|
|
|
|
[ "$VERBOSE" -o "$SIMULATE" ] && echo "KEEP $f"
|
|
|
|
else
|
|
|
|
[ "$VERBOSE" -o "$SIMULATE" ] && echo "MOVE $f"
|
|
|
|
[ "$SIMULATE" ] && continue
|
|
|
|
[ -e $d/old ] || mkdir -p $d/old
|
|
|
|
mv $d/$f $d/old/
|
|
|
|
[ -e $d/$f.MD5.txt ] && mv $d/$f.MD5.txt $d/old/
|
|
|
|
[ -e $d/$f.torrent ] && mv $d/$f.torrent $d/old/
|
|
|
|
fi
|
|
|
|
filecount=`expr $filecount + 1`
|
|
|
|
done
|
|
|
|
# echo
|
|
|
|
# ls --sort=time $d/*.iso $d/*.cpio.gz
|
|
|
|
#find $DESTBASEDIR -name *.iso
|
|
|
|
done
|
|
|
|
done
|