#!/bin/sh
#updates microcore placing bzimage and microcore.gz in the tce dir
# version 0.5
#argument: -r (release) -c (release candidate)
#jls_legalize (unsenepopiu@tin.it)
. /etc/init.d/tc-functions
PROG_NAME=$(basename $0)
abort(){
echo "Usage: $PROG_NAME [ -r -c ]"
echo "-r for release -c for release candidate"
exit 2
}
case $1 in
-r) FTPDIR="release/distribution_files" ;;
-c) FTPDIR="release_candidates/distribution_files" ;;
*) abort ;;
esac
[ -s /opt/.tcrc ] || exit 1
MIRROR="$(awk '/Mirror/ {print $2}' /opt/.tcrc)"
cd `cat /opt/.tce_dir`
busybox wget ftp://${MIRROR}/${FTPDIR}/bzImage -O bzImage
busybox wget ftp://${MIRROR}/${FTPDIR}/bzImage.md5.txt -O bzImage.md5.txt
busybox md5sum -cs bzImage.md5.txt
if [ $? != 0 ]; then
echo "md5 doesn't match"
exit 1
fi
busybox wget ftp://${MIRROR}/${FTPDIR}/microcore.gz -O microcore.gz
busybox wget ftp://${MIRROR}/${FTPDIR}/microcore.gz.md5.txt -O microcore.gz.md5.txt
busybox md5sum -cs microcore.gz.md5.txt
if [ $? != 0 ]; then
echo "md5 doesn't match"
exit 1
fi
echo "Done!"
exit 0