Should we do anything with this?
-------------- next part --------------
----- mrRED at 4f1DjYiSvJs99JP7Z7ulRTuKdpY ----- 2006.10.25 - 04:40:08GMT -----

I was bored of updating all the other stuff myself... Here's a script that does 
it for me (and can do it for you as well).

Put it in the root of your freenet directory. If you run Windows, then fuck it 
:).. Actually you can get cygwin if you're not up to translate it in stone-age 
batch scripts :)))

I'll put it on my freesite as well (don't you know the address already? it's 
USK at 
KiXvWpbcEGlAZU~3NEc4lfKNRq12xHiD01fcwcNnh1c,a9y0TyYnlm3DraoHEGdVYF9MuxXBbKT0tK-Z85dJgdI,AQABAAE/mrRED/-5/).

$ cat update-all.sh; md5sum update-all.sh
#!/bin/bash

if [ ! -x "$(which wget)" -o ! -x "$(which sha1sum)" ]; then
  echo 'This update sctipt eat wget and sha1sum binaries, what a shame you 
don'"'"'t have them in the PATH! No binaries no updates!'
  exit 1
fi

if [ $(wget --version | head -n1 | cut -d" " -f3 | cut -d"." -f2) -ge 10 ]; then
  DOWNLOADER="wget -o /dev/null --no-check-certificate "
else
  DOWNLOADER="wget -o /dev/null "
fi

cd $(dirname $0)

for pak in Thaw.jar jSite.jar frost.zip; do
  MATCH=$(egrep -o '\..*$' <<< $pak)
  NAME=$(sed s/$MATCH// <<< $pak)

  echo -e "\nChecking for $NAME updates..."
  rm -f $pak.temp $pak.sha1.temp

  i=0
  while ! $DOWNLOADER $NOCERT 
http://downloads.freenetproject.org/alpha/$NAME/$pak.sha1 -O $pak.sha1.temp; do
    ((i++))
    if [ $i -eq 10 ]; then
      break
    fi
  done

  if [ $i -ge 10 ]; then
    echo 'Error: download failed after 10 tries!'
  else
    OLDSUM=$(sha1sum $pak |awk '{print $1}')
    NEWSUM=$(cat $pak.sha1.temp |awk '{print $1}')
    if [ x$NEWSUM = x$OLDSUM ]; then
      echo 'No update available!'
    else
      echo "Updating $NAME..."
      i=0
      while ! $DOWNLOADER $NOCERT 
http://downloads.freenetproject.org/alpha/$NAME/$pak -O $pak.temp; do
        ((i++))
        if [ $i -eq 10 ]; then
          break
        fi
      done
      if [ $i -ge 10 ]; then
        echo 'Error: download failed after 10 tries!'
      else
        TMPSUM=$(sha1sum $pak.temp |awk '{print $1}')
        if [ x$TMPSUM != x$NEWSUM ]; then
          echo 'Error: Checksums doesn'"'"'t match. Better luck next time!'
        else
          mv -f $pak.temp $pak
          mv -f $pak.sha1.temp $pak.sha1
          echo "$NAME succesfully updated."
        fi
      fi
    fi
  fi
  echo 'Cleaning up...'
  rm -f $pak.temp $pak.sha1.temp
done

echo -e "\nWarning: Updating frost means it only updated the .zip file. You 
need to do the actual installation yourself.\n"

286f915e646a9ccd1627ef8c063b6fb3  update-all.sh

mrRED
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20061025/d5bc49af/attachment.pgp>

Reply via email to