[wpkg-users] Software Updates

Carlos R. Pasqualini pasqualinic at fcal.uner.edu.ar
Thu Sep 19 21:51:18 CEST 2013


El mar, 17-09-2013 a las 15:38 +0000, Shier, Jon escribió:
> Has anyone written anything that updates the software packages that
> you want to distribute? Seems like I have to manually check weekly if
> new software has come out. What do you guys do? I see someone wrote an
> updater for chrome. I have something similar for ccleaner, but would
> be nice if there was something that could read your packages and the
> check to see if they are up-to-date.
> 
>  

Hi:


In the server i host the install packages i use linux, so a little bit
of bash makes me the trick. I know may be it is not the best way, but it
works like a charm for me!

(some info is in spanish, as it is my language)


firefox.sh
---------------------------------------------------
!/bin/bash
WORKDIR='/srv/repositorio/software/navegadores'
LASTF="$WORKDIR/firefox.last"
XML='/srv/wpkg/packages/firefox.xml'
LAST=`cat $LASTF`
URL='http://www.mozilla.org/en-US/firefox/all.html'
DATE=`date +%Y%m%d`

#NEW=`wget -q $URL -O - | grep -m 1 curVersion |awk '{gsub("<td class=
\"curVersion\" >","",$0);gsub("</td>","",$0); print $1}'`
NEW=`wget -q $URL -O - |grep 'es-AR'|grep 'os=win'|awk -F 'firefox-'
'{print $2}'|awk -F '&' '{print $1}'`

if [[ $NEW != $LAST ]]; then
        echo -e "diferencia\nNuevo: $NEW Vs. $LAST\n URL: $URL"
        FILE="Firefox Setup $NEW.exe"

        cd $WORKDIR;
        MD5ORI=`wget -q
http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/$NEW/MD5SUMS -O
-|grep "win32/es-AR/$FILE"|awk '{print $1}'`

        if [[ -f $FILE ]]; then
                MD5=`md5sum "$FILE" | awk '{print $1}'`
                if [[ $MD5 != $MD5ORI ]]; then
                        rm -v "$FILE"
                fi
        fi
        if [[ ! -f $FILE ]]; then
                wget -q
"http://download.mozilla.org/?product=firefox-$NEW&os=win&lang=es-AR" -O
"$FILE"
                MD5=`md5sum "$FILE" | awk '{print $1}'`
        fi
        if [[ $MD5 != $MD5ORI ]]; then
                echo "La descarga no ha sido satisfactoria:"
                echo "File: $FILE"
                echo "MD5 según mozilla:        $MD5ORI"
                echo "MF5 obtenido local:       $MD5"
                exit
        fi
        cp -v $XML firefox_$LAST.xml
        sed -e "s/$LAST/$NEW/g" firefox_$LAST.xml > $XML
        diff firefox_$LAST.xml $XML
        echo -n $NEW > $LASTF
fi
------------------------------


flash.sh
-------------------------------------------------------------
#!/bin/bash
cd /srv/repositorio/software/navegadores/flash

LASTF='flash.last'
URL='http://www.adobe.com/products/flashplayer/distribution3.html'
OLDVERSION=`cat $LASTF`
VERSION=`wget -q $URL -O -|grep 'Flash Player' |grep -m 1 '</span>'|awk
'{gsub("</span>","",$0);print $3}'`

if [[ $VERSION != $OLDVERSION ]]; then
        echo "Nuevo flash player $VERSION"

        SHORTVERSION=`echo $VERSION|awk '{gsub("\\\.","_",$0);print$0}'`
        OLDSHORTVERSION=`echo $OLDVERSION|awk '{gsub("\\\.","_",
$0);print$0}'`

        mkdir $VERSION || exit
        if [[ -d $VERSION ]]; then
# no uso mas los uninstall_*
#               cp $OLDVERSION/uninstall_flash_player_* $VERSION
                cd $VERSION
                wget
http://download.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_11_active_x.msi
                wget
http://download.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_11_plugin.msi
                cat /srv/wpkg/packages/flash.xml > flash_$OLDVERSION.xml
                cat /srv/wpkg/packages/flash.xml |sed -e
"s/$OLDSHORTVERSION/$SHORTVERSION/" -e "s/$OLDVERSION/$VERSION/"
> /tmp/newflash.xml
                cat /tmp/newflash.xml > /srv/wpkg/packages/flash.xml
                cat /tmp/newflash.xml > flash_$VERSION.xml
                cd /srv/repositorio/software/navegadores/flash
                echo -n $VERSION > $LASTF
        fi
fi
-----------------------------------------------------------

as you can see, the most important change between programs is the filter
to obtain the software's current version, and the actions (if we have or
don't have a way to check download integrity).


if you need more examples i have:

/srv/repositorio/software/navegadores/flash/newflash.sh
/srv/repositorio/software/navegadores/firefox.sh
/srv/repositorio/software/Antivirus/AVG/new_avg.sh
/srv/repositorio/software/skype/skype.sh
/srv/repositorio/software/academico/geogebra/newgeogebra.sh
/srv/repositorio/software/video/vlc/vlc.sh
/srv/repositorio/software/pdf/nitropdf/nitropdf.sh


In a normal day, i notice that there is a new version of, says Firefox,
because when i start a computer wpkg updates to the latest version. As i
use Linux on my desktop, sometimes that day its indeed a few days
later ;-)


Best Regards



Charly





More information about the wpkg-users mailing list