summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2012-12-07 21:54:35 +0100
committerHolger Levsen <holger@layer-acht.org>2012-12-08 15:37:29 +0100
commita44d5a1fb99808a73af639f43dab658e86028315 (patch)
treeda3364cfaddbeeb6bfbc2b72ee2539160d9452ef /bin
parentceaa417fad1acc400c610f17e2e59852aa5fe209 (diff)
downloadjenkins.debian.net-a44d5a1fb99808a73af639f43dab658e86028315.tar.xz
Introduce new function fetch_if_newer() to update files from URLs when
the URL have a newer version / timestamp.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/cd_tester.sh27
1 files changed, 14 insertions, 13 deletions
diff --git a/bin/cd_tester.sh b/bin/cd_tester.sh
index 8db295a6..3f2b268b 100755
--- a/bin/cd_tester.sh
+++ b/bin/cd_tester.sh
@@ -50,6 +50,17 @@ mkdir -p results
WORKSPACE=$(pwd)
RESULTS=$WORKSPACE/results
+fetch_if_newer() {
+ url="$2"
+ file="$1"
+
+ curlopts=""
+ if [ -f $file ] ; then
+ curlopts="-z $file"
+ fi
+ curl $curlopts -o $file $url
+}
+
cleanup_all() {
set +x
set +e
@@ -172,13 +183,7 @@ trap cleanup_all INT TERM EXIT
# if there is a CD image...
#
if [ ! -z $IMAGE ] ; then
-
- # Only download if newer image is avaiable
- CURLOPTS=""
- if [ -f $IMAGE ] ; then
- CURLOPTS="-z $IMAGE"
- fi
- curl $CURLOPTS -o $IMAGE $URL
+ fetch_if_newer "$IMAGE" "$URL"
sudo mkdir -p $IMAGE_MNT
grep -q $IMAGE_MNT /proc/mounts && sudo umount -l $IMAGE_MNT
@@ -188,12 +193,8 @@ else
#
# else netboot gtk
#
- # only download if $KERNEL is older than a week...
- if test $(find $KERNEL -mmin +9500) || ! test -f $KERNEL ; then
- curl $URL/$KERNEL > $KERNEL
- curl $URL/$INITRD > $INITRD
- fi
-
+ fetch_if_newer "$KERNEL" "$URL/$KERNEL"
+ fetch_if_newer "$INITRD" "$URL/$INITRD"
fi
bootstrap
monitor_installation