FreenetWiki : ThawUpdateScript

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Most recent edit on 2008-05-09 03:58:05 by MythBuster [Added support code for Mac OS users]

Additions:
For this script to work for MacOS X users, you will need to install textutils for sha1sum... if you are using fink, execute this command:
%%(fink)
sudo fink install textutils




Edited on 2007-05-13 12:24:53 by JeromeFlesch [bleh]

Additions:
echo "Sorry, can't contact the remote server"

Deletions:
echo "Probleme, impossible de contacter le serveur distant."



Edited on 2007-01-14 23:56:48 by FridiM

Additions:
if [ $# -gt 1 ]; then
_help



Edited on 2007-01-14 23:55:20 by FridiM

Additions:
else



Edited on 2007-01-14 23:53:53 by FridiM

Additions:
_help () {
echo "Thaw Update Script"
echo "$0 [testing|stable]";
}
if [ $1 = "-h" -o $1 = "--help" -o $1 = "-help" ]; then
_help
elif [ $1 = "stable" ]; then RELEASE="Thaw.jar";

Deletions:
if [ $1 = "stable" ]; then RELEASE="Thaw.jar";



Edited on 2007-01-14 23:49:25 by FridiM

Additions:
if test ! -x `which wget` -o ! -x `which sha1sum`; then
echo "You need wget and sha1sum command to perform this update."
if [ $# -eq 1 ]; then
if [ $1 = "stable" ]; then RELEASE="Thaw.jar";
elif [ $1 = "testing" ]; then
RELEASE="Thaw-testing.jar";
echo "testing update..."
RELEASE="Thaw.jar"
if ! wget "http://downloads.freenetproject.org/alpha/Thaw/$RELEASE.sha1" -O sha1.tmp 1>/dev/null 2>&1 ; then
echo "Probleme, impossible de contacter le serveur distant."
if test ! -e $RELEASE; then
touch $RELEASE
sha1_local=`sha1sum $RELEASE | awk '{print \$1}'`
echo -n "Update available. Updating..."
if ! wget "http://downloads.freenetproject.org/alpha/Thaw/$RELEASE" -O $RELEASE 1>/dev/null 2>&1 ; then
echo "$RELEASE updated."
echo "$RELEASE uptodate, nothing done."

Deletions:
if ! wget http://downloads.freenetproject.org/alpha/Thaw/Thaw.jar.sha1 -O sha1.tmp 1>/dev/null 2>&1 ; then
echo "Unable to contact the freenet server, sorry."

if test ! -e Thaw.jar; then
touch Thaw.jar

sha1_local=`sha1sum Thaw.jar | awk '{print \$1}'`


echo "Update available. Updating..."
if ! wget http://downloads.freenetproject.org/alpha/Thaw/Thaw.jar -O Thaw.jar 1>/dev/null 2>&1 ; then
echo "Thaw updated."
echo "Thaw uptodate"



Edited on 2006-12-01 20:48:15 by FridiM

Additions:
if ! wget http://downloads.freenetproject.org/alpha/Thaw/Thaw.jar -O Thaw.jar 1>/dev/null 2>&1 ; then

Deletions:
mv Thaw.jar Thaw.jar.old
if ! wget http://downloads.freenetproject.org/alpha/Thaw/Thaw.jar 1>/dev/null 2>&1 ; then
mv Thaw.jar.old Thaw.jar



Edited on 2006-12-01 20:45:47 by FridiM

Additions:
mv Thaw.jar Thaw.jar.old
mv Thaw.jar.old Thaw.jar


Deletions:
rm Thaw.jar



Edited on 2006-12-01 19:47:08 by JeromeFlesch

Additions:
echo "Unable to contact the freenet server, sorry."

Deletions:
echo "Probleme, impossible de contacter le serveur distant."



Edited on 2006-12-01 19:38:52 by JeromeFlesch

Additions:

Thaw update script



Deletions:

Thaw update script





Edited on 2006-12-01 19:38:18 by JeromeFlesch

Additions:
Homepage

Thaw update script



Deletions:
Thaw update script



Edited on 2006-12-01 19:37:46 by JeromeFlesch

Additions:
Thaw update script

thanks to fridim :)




Oldest known version of this page was edited on 2006-12-01 19:37:22 by JeromeFlesch []
Page view:
#!/bin/bash
echo "Checking for update..."
if ! wget http://downloads.freenetproject.org/alpha/Thaw/Thaw.jar.sha1 -O sha1.tmp 1>/dev/null 2>&1 ; then
    echo "Probleme, impossible de contacter le serveur distant."
    exit 1
fi
 
if test ! -e Thaw.jar; then
    touch Thaw.jar
fi
 
sha1_local=`sha1sum Thaw.jar | awk '{print \$1}'`
sha1_remote=`cat sha1.tmp | awk '{print \$1}'`
rm sha1.tmp
 
echo "Current :   $sha1_local"
echo "On server : $sha1_remote"
 
if test ! "$sha1_local" = "$sha1_remote"; then
    echo "Update available. Updating..."
    rm Thaw.jar
    if ! wget http://downloads.freenetproject.org/alpha/Thaw/Thaw.jar 1>/dev/null 2>&1 ; then
        echo "Unable to connect to server."
        exit 1
    fi
    echo "Thaw updated."
else
    echo "Thaw uptodate"
fi
exit 0
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.1420 seconds