[X2Go-Commits] [live-build-x2go] 154/166: timestamp is now checked before BWLIMIT is determined -> faster, less traffic
git-admin at x2go.org
git-admin at x2go.org
Mon Nov 20 02:17:08 CET 2017
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch feature/mate-minidesktop
in repository live-build-x2go.
commit eb96dadd73eae17a806bda72e690267238033ccf
Author: Stefan Baur (BAUR-ITCS) <kontakt at baur-itcs.de>
Date: Wed Jul 26 17:17:59 2017 +0200
timestamp is now checked before BWLIMIT is determined -> faster, less traffic
---
.../lib/live/config/2400-live-autoupdate | 66 ++++++++++++++++------
1 file changed, 48 insertions(+), 18 deletions(-)
diff --git a/config/includes.chroot/lib/live/config/2400-live-autoupdate b/config/includes.chroot/lib/live/config/2400-live-autoupdate
index 2e749ee..0770aca 100755
--- a/config/includes.chroot/lib/live/config/2400-live-autoupdate
+++ b/config/includes.chroot/lib/live/config/2400-live-autoupdate
@@ -2,6 +2,20 @@
# this is not /bin/bash, so "echo -e" is not supported, but the default when calling "echo"
+check_timestamp ()
+{ #this attempts to download a timestamp file
+ echo -n "\n$(date +'%F | %T | ')'$0': starting timestamp download ..."
+ if ! $DOWNLOADCOMMANDFORTIMESTAMP; then
+ return 1
+ else
+ RUNNINGVERSION=$(stat -c %Y /lib/live/mount/rootfs/filesystem.squashfs/lib)
+ if [ $RUNNINGVERSION -ge $(cat $TEMPDIR/x2go-tce-timestamp) ] ; then
+ return 5
+ fi
+ fi
+ return 0
+}
+
show_versions ()
{ # This prints the TCE versions that are stored on the local medium to the log output
LISTOFTIMESTAMPFILES=$(find /lib/live/mount/findiso/boot -name "x2go-tce-timestamp")
@@ -276,6 +290,23 @@ echo -n " live-autoupdater (backgrounding update task)"
if echo "$DOWNLOADURL" | grep -q "^http" || \
echo "$DOWNLOADURL" | grep -q "^ftp"
then
+ DOWNLOADCOMMANDFORTIMESTAMP="wget -Nr -l 1 -nd -P "$TEMPDIR" \
+ --progress=bar:force \
+ $DOWNLOADURL/x2go-tce-timestamp"
+
+ check_timestamp
+ if [ $? -eq 1 ]; then
+ echo -n "\n$(date +'%F | %T | ')'$0': an error occurred during timestamp download; trying full download instead ..."
+ elif [ $? -eq 5 ]; then
+ cleanup
+ echo -n "\n$(date +'%F | %T | ')'$0': Nothing to do. - Files on server not newer than '$RUNNINGSYSTEMNAME'."
+ echo -n "\n$(date +'%F | %T | ')'$0': ('$RUNNINGSYSTEMNAME' is Version $RUNNINGVERSION - $(date --date=@$RUNNINGVERSION))."
+ return 0 # current is newest, nothing to do, we want to avoid
+ # unneccessary writes to the medium
+ else
+ : # NOP
+ fi
+
# Attempt to determine available bandwidth & to set BWLIMIT accordingly
echo -n "\n$(date +'%F | %T | ')'$0': Attempting to determine available bandwidth for wget.\n"
wget -Nr -P /tmp/ -nd \
@@ -311,12 +342,26 @@ echo -n " live-autoupdater (backgrounding update task)"
DOWNLOADCOMMAND="wget -Nr -l 1 -nd -P "$TEMPDIR" \
--progress=bar:force \
--limit-rate=${BWLIMIT}k $DOWNLOADURL"
- DOWNLOADCOMMANDFORTIMESTAMP="wget -Nr -l 1 -nd -P "$TEMPDIR" \
- --progress=bar:force \
- --limit-rate=${BWLIMIT}k $DOWNLOADURL/x2go-tce-timestamp"
elif echo "$DOWNLOADURL" | grep -q "^rsync"; then
+ DOWNLOADCOMMANDFORTIMESTAMP="rsync -aPv --inplace $DOWNLOADURL/x2go-tce-timestamp \
+ $TEMPDIR"
+
+ check_timestamp
+ if [ $? -eq 1 ]; then
+ echo -n "\n$(date +'%F | %T | ')'$0': an error occurred during timestamp download; trying full download instead ..."
+ elif [ $? -eq 5 ]; then
+ cleanup
+ echo -n "\n$(date +'%F | %T | ')'$0': Nothing to do. - Files on server not newer than '$RUNNINGSYSTEMNAME'."
+ echo -n "\n$(date +'%F | %T | ')'$0': ('$RUNNINGSYSTEMNAME' is Version $RUNNINGVERSION - $(date --date=@$RUNNINGVERSION))."
+ return 0 # current is newest, nothing to do, we want to avoid
+ # unneccessary writes to the medium
+ else
+ : # NOP
+ fi
+
+
# Attempt to determine available bandwidth & to set BWLIMIT accordingly
echo -n "\n$(date +'%F | %T | ')'$0': Attempting to determine available bandwidth for rsync.\n"
rsync -hh -aPv -W --inplace --log-file=/tmp/dl.log $DOWNLOADURL/x2go-tce-initrd.img \
@@ -348,8 +393,6 @@ echo -n " live-autoupdater (backgrounding update task)"
echo -n "\n$(date +'%F | %T | ')'$0': Determined bandwidth limit: '$BWLIMIT KB/s'"
DOWNLOADCOMMAND="rsync -aPv --inplace --bwlimit=$BWLIMIT $DOWNLOADURL/ \
$TEMPDIR"
- DOWNLOADCOMMANDFORTIMESTAMP="rsync -aPv --inplace --bwlimit=$BWLIMIT $DOWNLOADURL/x2go-tce-timestamp \
- $TEMPDIR"
else
[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
echo -n "\n$(date +'%F | %T | ')'$0': Unsupported download mechanism - aborting."
@@ -361,19 +404,6 @@ echo -n " live-autoupdater (backgrounding update task)"
# Proceed to download from update location
#
- echo -n "\n$(date +'%F | %T | ')'$0': starting timestamp download ..."
- if ! $DOWNLOADCOMMANDFORTIMESTAMP; then
- echo -n "\n$(date +'%F | %T | ')'$0': an error occurred during timestamp download; trying full download instead ..."
- else
- RUNNINGVERSION=$(stat -c %Y /lib/live/mount/rootfs/filesystem.squashfs/lib)
- if [ $RUNNINGVERSION -ge $(cat $TEMPDIR/x2go-tce-timestamp) ] ; then
- cleanup
- echo -n "\n$(date +'%F | %T | ')'$0': Nothing to do. - Files on server not newer than '$RUNNINGSYSTEMNAME'."
- echo -n "\n$(date +'%F | %T | ')'$0': ('$RUNNINGSYSTEMNAME' is Version $RUNNINGVERSION - $(date --date=@$RUNNINGVERSION))."
- return 0 # current is newest, nothing to do, we want to avoid
- # unneccessary writes to the medium
- fi
- fi
echo -n "\n$(date +'%F | %T | ')'$0': starting download ..."
while ! $DOWNLOADCOMMAND; do
--
Alioth's /srv/git/code.x2go.org/live-build-x2go.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/live-build-x2go.git
More information about the x2go-commits
mailing list