--- /dev/null
+#!/bin/sh
+
+## New! Ask where the user wishes to install the package with gxmessage:
+
+export GXMSG=`printf "\
+Where do you want your Mer image installed?
+You need approximately 1.3GB initially.\n\
+Free space left on your memory cards:\n\n"; \
+df -h | grep "media\/mmc" | awk '{print $6 ": " $4 " free, " $2 " total (" $5 " full)"}' | sort`
+gxmessage -center -buttons MMC1:1,MMC2:2 -geometry 690x380 -title "Choose Memory Card" "$GXMSG"
+export SDNO=$?
+
+case "$SDNO" in
+ 1)
+ export SDCARD="mmc1"
+ ;;
+ *)
+ export SDCARD="mmc2"
+ ;;
+esac
+
+echo "Downloading and extracting to /media/$SDCARD..."
+
+#exit 0
+
+## HERE ARE THE VARIABLES:
+
+export INSTPATH="/home/user/img-install"
+export TARPATH="/media/$SDCARD"
+export DLURL="http://qole.org/files"
+export BZ2CMD1="bunzip2"
+export BZ2CMD2=""
+
+export EXTPATH1=$TARPATH
+export PKGNAME1="EASY MER IMAGE FILE"
+export BIGTAR1="easy-mer-015-1-img.bz2"
+export MD51="7eb7864526f157fb352438e460746a53"
+export EXTCMD1="mv $TARPATH/easy-mer-015-1-img $TARPATH/mer_015-1.img.ext2"
+export TARCMD1="$BZ2CMD1 $TARPATH/$BIGTAR1 $BZ2CMD2"
+
+#export CLEANUP="sudo rm -r $INSTPATH ; sudo rm /usr/share/applications/image-install.desktop "
+export CLEANUP="echo All done!"
+
+## HERE'S THE SCRIPT:
+
+# Download first package
+
+export GOTIT="no"
+
+if [ -f $TARPATH/$BIGTAR1 ] ; then
+ echo You already have the big image file!
+ echo Checking to see if it is good...
+ if [ "`$INSTPATH/md5sum $TARPATH/$BIGTAR1 | awk '{print $1}'`" = "$MD51" ] ; then
+ export GOTIT="yes"
+ echo Yes it is good.
+ fi
+fi
+
+echo " "
+
+export GOOD=1
+export TEST=2
+
+while test $TEST != $GOOD
+do
+ cd $TARPATH
+ if [ ! "$GOTIT" = "yes" ] ; then
+ echo "Downloading $PKGNAME1 package..."
+ wget -c $DLURL/$BIGTAR1
+ fi
+
+ if test -e $TARPATH/$BIGTAR1
+ then
+
+ cd $INSTPATH
+ export GOOD=$MD51
+ if [ ! "$GOTIT" = "yes" ] ; then
+ echo Testing the file to see if it is good.
+ export TEST=`$INSTPATH/md5sum $TARPATH/$BIGTAR1 | awk '{print $1}'`
+ else
+ export TEST=$MD51
+ fi
+
+ if test $TEST = $GOOD
+ then
+
+ cd $EXTPATH1
+ echo Extracting the image file. This will take some time.
+ TARERR=`$TARCMD1 2>&1`
+ if [ "$?" = 0 ] ; then
+ rm -rf $TARPATH/$BIGTAR1
+ $EXTCMD1
+ export MSG1=`printf "CONGRATULATIONS!\n\nAll has gone well!\n\nSuccess installing $PKGNAME1 package!"`
+ gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "SUCCESS!" "$MSG1"
+ else
+ export ERR1=`printf "ERROR! TAR FAILED!\nUnable to install $PKGNAME1\n$TARERR"`
+ gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x380 -title "TAR ERROR" "$ERR1"
+ exit 99
+ fi
+ else
+ export ERR1=`printf "$PKGNAME1 package appears damaged.\nPress OK to try downloading again.\nCancel keeps the damaged file."`
+ gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0,GTK_STOCK_CANCEL:1 -geometry 640x100 -title "DOWNLOAD ERROR" "$ERR1"
+ if [ "$?" = 1 ] ; then
+ exit 99
+ fi
+ rm $TARPATH/$BIGTAR1
+ fi
+ fi
+done
+
+# Stop if only getting one package
+
+ $CLEANUP
+ exit 0
+