diff options
author | Holger Levsen <holger@layer-acht.org> | 2013-01-12 13:50:36 +0100 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2013-01-12 13:50:36 +0100 |
commit | 86f6c0231b52669daa45890bbdf532f26f26acd9 (patch) | |
tree | 2ddcbfffa7dafa3c1dc703b1cc9001f2a33b2c4b | |
parent | ee08df4803b5c67fe28282564413b878a9a25f5f (diff) | |
download | jenkins.debian.net-86f6c0231b52669daa45890bbdf532f26f26acd9.tar.xz |
g-i: detect if .iso cannot be downloaded
-rwxr-xr-x | bin/g-i-installation.sh | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/bin/g-i-installation.sh b/bin/g-i-installation.sh index 8aa395bb..4ee545f9 100755 --- a/bin/g-i-installation.sh +++ b/bin/g-i-installation.sh @@ -649,11 +649,24 @@ trap cleanup_all INT TERM EXIT # if [ ! -z "$IMAGE" ] ; then fetch_if_newer "$IMAGE" "$URL" - - sudo mkdir -p $IMAGE_MNT - grep -q $IMAGE_MNT /proc/mounts && sudo umount -l $IMAGE_MNT - sleep 1 - sudo mount -o loop,ro $IMAGE $IMAGE_MNT + # is this really an .iso? + if [ $(file "$IMAGE" | grep -c "ISO 9660") -eq 1 ] ; then + # yes, so let's mount it + sudo mkdir -p $IMAGE_MNT + grep -q $IMAGE_MNT /proc/mounts && sudo umount -l $IMAGE_MNT + sleep 1 + sudo mount -o loop,ro $IMAGE $IMAGE_MNT + else + # something went wrong + figlet "no .iso" + echo "ERROR: no valid .iso found" + if [ $(file "$IMAGE" | grep -c "HTML document") -eq 1 ] ; then + mv "$IMAGE" "$IMAGE.html" + lynx --dump "$IMAGE.html" + rm "$IMAGE.html" + fi + exit 1 + fi else # # else netboot gtk |