3 ## New! Ask where the user wishes to install the package with gxmessage:
5 export GXMSG=`printf "\
6 Where do you want your Debian image file installed?\n\
7 You need approximately 1.3GB initially.\n\
8 Free space left on your memory cards:\n\n"; \
9 df -h | grep "media\/mmc" | awk '{print $6 ": " $4 " free, " $2 " total (" $5 " full)"}' | sort`
10 gxmessage -center -buttons MMC1:1,MMC2:2 -geometry 690x380 -title "Choose Memory Card" "$GXMSG"
22 echo "Downloading and extracting to /media/$SDCARD..."
26 ## HERE ARE THE VARIABLES:
28 export INSTPATH="/home/user/img-install"
29 export TARPATH="/media/$SDCARD"
30 export DLURL="http://qole.org/files"
31 export BZ2CMD1="gtar -xjf"
34 #export BZ2CMD1="bzcat"
35 #export BZ2CMD2="| tar xf -"
36 export GZCMD1="tar -xzf"
38 export EXTPATH1=$TARPATH
39 export PKGNAME1="EASY DEBIAN IMAGE FILE"
40 export BIGTAR1="debian-squeeze-img.tar.bz2"
41 export TARCMD1="$BZ2CMD1 $TARPATH/$BIGTAR1 $BZ2CMD2"
42 export MD51="4cd74df14840b3be5f47487a17daa6d9"
45 #Set SKIPPKG2=1 to skip the second package.
48 export EXTPATH2=$EXTPATH1
49 export PKGNAME2="SECOND TEST"
50 export BIGTAR2="test2.tgz"
51 export TARCMD2="$GZCMD1 $TARPATH/$BIGTAR2"
52 export MD52="ec3ccde37f4cd026fd03911df7579d6a"
55 #export CLEANUP="sudo rm -r $INSTPATH ; sudo rm /usr/share/applications/image-install.desktop "
56 export CLEANUP="echo All done!"
60 # Download first package
64 if [ -f $TARPATH/$BIGTAR1 ] ; then
65 echo You already have the big image file!
66 echo Checking to see if it is good...
67 if [ "`$INSTPATH/md5sum $TARPATH/$BIGTAR1 | awk '{print $1}'`" = "$MD51" ] ; then
73 echo "Downloading $PKGNAME1 package..."
78 while test $TEST != $GOOD
81 if [ ! "$GOTIT" = "yes" ] ; then
82 wget -c $DLURL/$BIGTAR1
85 if test -e $TARPATH/$BIGTAR1
90 if [ ! "$GOTIT" = "yes" ] ; then
91 echo Testing the file to see if it is good.
92 export TEST=`$INSTPATH/md5sum $TARPATH/$BIGTAR1 | awk '{print $1}'`
101 echo Extracting the image file. This will take some time.
102 TARERR=`$TARCMD1 2>&1`
103 if [ "$?" = 0 ] ; then
104 rm -rf $TARPATH/$BIGTAR1
106 export MSG1=`printf "CONGRATULATIONS!\n\nAll has gone well!\n\nSuccess installing $PKGNAME1 package!"`
107 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "SUCCESS!" "$MSG1"
109 export ERR1=`printf "ERROR! TAR FAILED!\nUnable to install $PKGNAME1\n$TARERR"`
110 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x380 -title "TAR ERROR" "$ERR1"
114 export ERR1=`printf "$PKGNAME1 package appears damaged.\nPress OK to try downloading again.\nCancel keeps the damaged file."`
115 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0,GTK_STOCK_CANCEL:1 -geometry 640x100 -title "DOWNLOAD ERROR" "$ERR1"
116 if [ "$?" = 1 ] ; then
124 # Stop if only getting one package
126 if test $SKIPPKG2 == 1
132 # Download second package
135 echo "Downloading $PKGNAME2 package..."
139 while test $TEST2 != $GOOD2
142 wget -c $DLURL/$BIGTAR2
143 if test -e $TARPATH/$BIGTAR2
147 export TEST2=`$INSTPATH/md5sum $TARPATH/$BIGTAR2 | awk '{print $1}'`
149 if test $TEST2 = $GOOD2
152 TARERR=`$TARCMD2 2>&1`
153 if [ "$?" = 0 ] ; then
154 rm -rf $TARPATH/$BIGTAR2
156 export MSG2=`printf "CONGRATULATIONS!\n\nAll has gone well!\n\nSuccess installing $PKGNAME2 package!"`
157 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "SUCCESS!" "$MSG2"
159 export ERR2=`printf "ERROR! ERROR! ERROR!\nTAR FAILED!\n\nUnable to install $PKGNAME2\n\n$TARERR"`
160 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "TAR ERROR" "$ERR2"
164 echo "$PKGNAME2 package seems damaged, trying again!"