File update_dcraw of Package dcraw

#! /bin/sh

# Call this script to update dcraw files to latest version.
# "wget", "rcs" and "lynx" packages are required for the update

wget -N http://www.cybercom.net/~dcoffin/dcraw/parse.c
wget -N http://www.cybercom.net/~dcoffin/dcraw/fujiturn.c
wget -N http://www.cybercom.net/~dcoffin/dcraw/rawphoto.c
wget -N http://www.cybercom.net/~dcoffin/dcraw/clean_crw.c
wget -N http://www.cybercom.net/~dcoffin/dcraw/fuji_green.c
mv badpixels .badpixels
wget -N http://www.cybercom.net/~dcoffin/dcraw/.badpixels
mv .badpixels badpixels
( URL="http://www.cybercom.net/~dcoffin/dcraw/" ; echo -e "$URL:\n" ; LC_ALL=C lynx -display_charset=utf-8 -dump "$URL" | sed '1d;3,4d' ) >README
OLDVERSION=`sed -ne 's/^Version:[[:space:]]*\([0-9.]\+\)[[:space:]]*$/\1/p' dcraw.spec`
NEWVERSION=`lynx -dump http://www.cybercom.net/~dcoffin/dcraw/archive/ | sed -n -e 's/^.*dcraw-\([0-9.]\+\)\.tar\.gz.*$/\1/p' |sort -nr |head -1`
wget -N http://www.cybercom.net/~dcoffin/dcraw/archive/dcraw-${NEWVERSION}.tar.gz
sed -i -e "s/^\(Version:[[:space:]]*\)[0-9.]\+[[:space:]]*$/\1${NEWVERSION}/" dcraw.spec
tar --strip-components=1 -xf dcraw-${OLDVERSION}.tar.gz dcraw/dcraw.c
rm dcraw-${OLDVERSION}.tar.gz
wget -N http://www.cybercom.net/~dcoffin/dcraw/RCS/dcraw.c,v
rlog dcraw.c >dcraw.log
rm -f dcraw.c dcraw.c,v
wget -N http://www.cybercom.net/~dcoffin/dcraw/RCS/parse.c,v
rlog parse.c >parse.log
rm parse.c,v
echo
echo "********************************************************************"
echo "********************************************************************"
echo "Please check, whether packaged file list is up to date."
echo "You can look at dcraw.log and parse.log for the complete change log."
echo "Before submit, please call:"
echo "rm dcraw.log parse.log"