+## Download the list of images. Also use this opportunity to check
+## the Internet connection and availability of the server.
+
+IMGLIST="imagelist-0.9.40"
+
+mv $IMGLIST $IMGLIST.old
+wget -t 3 http://qole.org/$IMGLIST
+if [ $? != 0 ] ; then
+ MSG1=`printf "\
+Cannot download the list of available images.\n\
+$? \
+Something is wrong with either your Internet connection\n\
+or the qole.org file server.\n\n\
+Check your Internet connection and the status\n\
+of the server by browsing to http://qole.org"`
+ gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "Download Error" "$MSG1"
+ exit
+fi
+
+gxmessage -buttons \
+ "`awk -F ',' '/^[0-9],/ {print $2":"$1","}' $IMGLIST`Cancel:0" \
+ "`awk -F ',' '/^[0-9],/ {print $2":"$6}' $IMGLIST`"
+IMGCHOICE=$?
+
+#Both 0 and 1 are Cancel
+
+if [ "$IMGCHOICE" -le "1" ] ; then
+ exit 9
+fi
+
+DLURL=`awk -F"," '$1=='$IMGCHOICE' {print $3}' $IMGLIST`
+PKGNAME1=`awk -F"," '$1=='"$IMGCHOICE"' {print $6}' $IMGLIST`
+BIGTAR1=`awk -F"," '$1=='"$IMGCHOICE"' {print $4"."$5}' $IMGLIST`
+BIGIMG1=`awk -F"," '$1=='"$IMGCHOICE"' {print $4}' $IMGLIST`
+MD51=`awk -F"," '$1=='"$IMGCHOICE"' {print $7}' $IMGLIST`
+IMGCMPRSS=`awk -F"," '$1=='"$IMGCHOICE"' {print $5}' $IMGLIST`
+
+#echo $DLURL
+#echo $PKGNAME1
+#echo $BIGTAR1
+#echo $BIGIMG1
+#echo $MD51
+#echo $IMGCMPRSS
+
+## Make sure the chroot is closed, to avoid spurious mounts
+
+sudo closechroot >/dev/null
+