Mythtv/MiniMyth/Updateminimyth

From MattWiki
Jump to: navigation, search

This script will download the newest version of MiniMyth and update my system.

It first downloads the version file and compares that version number to the current install version of minimyth if it determines that the version dose not match it will then download the current release, untar it and move the files to their current locations. It dose not delete any older versions on your server.

# /bin/bash
# Version: 1.2 - 30-Jan-2007 - Matt Rude - info at mattrude dot com
TFTPDIR=/tftpboot/PXEClient
#URL="http://linpvr.org/minimyth/download/test/latest"
URL="http://linpvr.org/minimyth/download/test/latest-svn"
##############################################################################
if [ -e $TFTPDIR/version ]; then
 mv $TFTPDIR/version $TFTPDIR/version.last
else
 touch $TFTPDIR/version.log
 touch $TFTPDIR/version.last
fi

cd $TFTPDIR
wget $URL/version > /dev/null 2>&1
VER=`cat $TFTPDIR/version`
OLDVER=`cat $TFTPDIR/version.last`

if [ "$VER" = "$OLDVER" ]; then
 exit 0
else
 echo "`date` Upgraded to version: $VER" >> version.log

 rm -f $TFTPDIR/kerne*
 rm -f $TFTPDIR/rootf*
 rm -fr $TFTPDIR/conf/default/theme*

 wget $URL/ram-minimyth-$VER.tar.bz2 > /dev/null 2>&1
 tar -xjf ram-minimyth-$VER.tar.bz2
 rm -rf ram-minimyth-$VER.tar.bz2

 RAMDIR=$TFTPDIR/ram-minimyth-$VER

 mkdir -p $TFTPDIR/conf/default
 cp $RAMDIR/kernel $TFTPDIR/kernel-$VER
 cp $RAMDIR/rootfs $TFTPDIR/rootfs-$VER
 cp -r $RAMDIR/themes $TFTPDIR/conf/default/themes-$VER

 ln -s kernel-$VER kernel
 ln -s rootfs-$VER rootfs
 cd $TFTPDIR/conf/default
 ln -s themes-$VER themes
 mythtvosd --template=scroller --scroll_text="minimyth upgraded to: $VER" > /dev/null
fi
chown -R matt:matt $TFTPDIR/*
exit 0