From c65bb01ede3ad4ec203dd4c70f48fa329679a66d Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Sun, 8 Aug 2010 12:56:41 +0200 Subject: [PATCH] autoupdate: add initial support for /etc/repo.conf, some cleanups Signed-off-by: Stephan Raue --- packages/tools/autoupdate/config/repo.conf | 8 +++++++ packages/tools/autoupdate/install | 7 ++++-- .../tools/autoupdate/scripts/autoupdate.devel | 22 ++++++++++-------- .../autoupdate/scripts/autoupdate.release | 23 ++++++++++--------- 4 files changed, 37 insertions(+), 23 deletions(-) create mode 100644 packages/tools/autoupdate/config/repo.conf diff --git a/packages/tools/autoupdate/config/repo.conf b/packages/tools/autoupdate/config/repo.conf new file mode 100644 index 0000000000..fb05131216 --- /dev/null +++ b/packages/tools/autoupdate/config/repo.conf @@ -0,0 +1,8 @@ +# Location of repo + UPDATEURL="http://snapshots.openelec.tv" + +# Setup Download tool (wget/scp) + DL_METHOD="wget" + +# Keyfile to use (with scp method) + KEYFILE= diff --git a/packages/tools/autoupdate/install b/packages/tools/autoupdate/install index c3758e9660..ea0e94f3c1 100755 --- a/packages/tools/autoupdate/install +++ b/packages/tools/autoupdate/install @@ -4,14 +4,17 @@ mkdir -p $INSTALL/usr/bin if [ "$DEVTOOLS" = "yes" ]; then - cp -P $PKG_DIR/scripts/autoupdate.devel $INSTALL/usr/bin/autoupdate + cp $PKG_DIR/scripts/autoupdate.devel $INSTALL/usr/bin/autoupdate else - cp -P $PKG_DIR/scripts/autoupdate.release $INSTALL/usr/bin/autoupdate + cp $PKG_DIR/scripts/autoupdate.release $INSTALL/usr/bin/autoupdate fi mkdir -p $INSTALL/usr/config cp -P $PKG_DIR/config/update.conf $INSTALL/usr/config +mkdir -p $INSTALL/etc + cp $PKG_DIR/config/repo.conf $INSTALL/etc + mkdir -p $INSTALL/etc/crontabs echo -e "* */6 * * *\t/usr/bin/autoupdate" >> $INSTALL/etc/crontabs/root diff --git a/packages/tools/autoupdate/scripts/autoupdate.devel b/packages/tools/autoupdate/scripts/autoupdate.devel index 0ea2856ccc..cfed19aff9 100755 --- a/packages/tools/autoupdate/scripts/autoupdate.devel +++ b/packages/tools/autoupdate/scripts/autoupdate.devel @@ -20,8 +20,16 @@ # http://www.gnu.org/copyleft/gpl.html ################################################################################ -[ -f /storage/.config/update.conf ] && \ - . /storage/.config/update.conf +[ -f /storage/.config/update.conf ] && . /storage/.config/update.conf +[ -f /etc/repo.conf ] && . /etc/repo.conf || exit0 + +download () { + wget -c $1 -P /tmp +} + +send_message () { + xbmc-send --host=127.0.0.1 -a "Notification(Automatic update service:,$1,20000)" +} if [ ! -f /var/lock/update.lock ]; then @@ -30,12 +38,6 @@ if [ ! -f /var/lock/update.lock ]; then # sleep a bit, maybe we have a lot of work ;-) usleep 30000000 - send_message () { - xbmc-send --host=127.0.0.1 -a "Notification(Automatic update service:,$1,20000)" - } - - UPDATEURL="http://snapshots.openelec.tv" - # getting this version THIS_DISTRIBUTION="`cat /etc/distribution`" THIS_ARCH="`cat /etc/arch`" @@ -43,7 +45,7 @@ if [ ! -f /var/lock/update.lock ]; then # get infofile with the latest released version rm -rf /tmp/latest - wget $UPDATEURL/latest -P /tmp + download "$UPDATEURL/latest" NEW_IMAGE="`cat /tmp/latest |grep "$THIS_DISTRIBUTION-$THIS_ARCH"`" NEW_VERSION="`echo "$NEW_IMAGE" | cut -d "-" -f5 | tr -d "r"`" @@ -69,7 +71,7 @@ if [ ! -f /var/lock/update.lock ]; then touch /var/lock/update.lock # downloading the new version - wget -c $UPDATEURL/$NEW_IMAGE.tar.bz2 -P /tmp + download "$UPDATEURL/$NEW_IMAGE.tar.bz2" # extract the image rm -rf /tmp/$NEW_IMAGE diff --git a/packages/tools/autoupdate/scripts/autoupdate.release b/packages/tools/autoupdate/scripts/autoupdate.release index df230a5d89..42a4c632ce 100755 --- a/packages/tools/autoupdate/scripts/autoupdate.release +++ b/packages/tools/autoupdate/scripts/autoupdate.release @@ -20,8 +20,16 @@ # http://www.gnu.org/copyleft/gpl.html ################################################################################ -[ -f /storage/.config/update.conf ] && \ - . /storage/.config/update.conf +[ -f /storage/.config/update.conf ] && . /storage/.config/update.conf +[ -f /etc/repo.conf ] && . /etc/repo.conf || exit0 + +download () { + wget -c $1 -P /tmp +} + +send_message () { + xbmc-send --host=127.0.0.1 -a "Notification(Automatic update service:,$1,20000)" +} if [ ! -f /var/lock/update.lock ]; then @@ -30,12 +38,6 @@ if [ ! -f /var/lock/update.lock ]; then # sleep a bit, maybe we have a lot of work ;-) usleep 30000000 - send_message () { - xbmc-send --host=127.0.0.1 -a "Notification(Automatic Update Service:,$1,20000)" - } - - UPDATEURL="http://releases.openelec.tv" - # getting this version THIS_DISTRIBUTION="`cat /etc/distribution`" THIS_ARCH="`cat /etc/arch`" @@ -46,7 +48,7 @@ if [ ! -f /var/lock/update.lock ]; then # get infofile with the latest released version rm -rf /tmp/latest - wget $UPDATEURL/latest -P /tmp + download "$UPDATEURL/latest" NEW_IMAGE="`cat /tmp/latest |grep "$THIS_DISTRIBUTION-$THIS_ARCH"`" NEW_VERSION="`echo "$NEW_IMAGE" | cut -d "-" -f3`" @@ -76,7 +78,7 @@ if [ ! -f /var/lock/update.lock ]; then touch /var/lock/update.lock # downloading the new version - wget -c $UPDATEURL/$NEW_IMAGE.tar.bz2 -P /tmp + download "$UPDATEURL/$NEW_IMAGE.tar.bz2" # extract the image rm -rf /tmp/$NEW_IMAGE @@ -96,7 +98,6 @@ if [ ! -f /var/lock/update.lock ]; then mv /storage/.update/KERNEL.tmp /storage/.update/KERNEL mv /storage/.update/SYSTEM.tmp /storage/.update/SYSTEM - touch /var/ # cleanup tmp files rm -rf /tmp/$NEW_IMAGE rm -rf /tmp/$NEW_IMAGE.tar.bz2