3 ## 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 in internal memory or your memory card:\n\n"; \
9 df -h | grep "mmcblk.p1" | awk '{print $6 ": " $4 " free, " $2 " total (" $5 " full)"}' | sort`
10 gxmessage -center -buttons MyDocs:1,MicroSD:2 -geometry 690x380 -title "Choose Memory Card" "$GXMSG"
15 export SDCARD="/home/user/MyDocs"
18 export SDCARD="/media/mmc1"
22 echo "Downloading and extracting to $SDCARD..."
26 ## HERE ARE THE VARIABLES:
28 export INSTPATH="/home/user/img-install"
29 export TARPATH="$SDCARD"
30 export DLURL="http://qole.org/files"
32 #export BZ2CMD1="bzcat"
33 #export BZ2CMD2="| tar xf -"
34 export GZCMD1="tar -xzf"
36 export EXTPATH1=$TARPATH
37 export PKGNAME1="EASY DEBIAN IMAGE FILE"
38 export BIGTAR1="debian-m5-v2.img.ext2.bz2"
39 export BIGIMG1="debian-m5-v2.img.ext2"
40 export BZ2CMD1="bzip2 -dc "
41 export BZ2CMD2=" > $TARPATH/$BIGIMG1"
42 export TARCMD1="$BZ2CMD1 $TARPATH/$BIGTAR1 $BZ2CMD2"
43 export MD51="1c02d35d6453fd35390ae025bd930ba2"
46 #Set SKIPPKG2=1 to skip the second package.
49 export EXTPATH2=$EXTPATH1
50 export PKGNAME2="SECOND TEST"
51 export BIGTAR2="test2.tgz"
52 export TARCMD2="$GZCMD1 $TARPATH/$BIGTAR2"
53 export MD52="ec3ccde37f4cd026fd03911df7579d6a"
56 #export CLEANUP="sudo rm -r $INSTPATH ; sudo rm /usr/share/applications/image-install.desktop "
57 export CLEANUP="echo All done!"
61 # Download first package
65 if [ -f $TARPATH/$BIGTAR1 ] ; then
66 echo You already have the big image file!
67 echo Checking to see if it is good...
68 if [ "`$INSTPATH/md5sum $TARPATH/$BIGTAR1 | awk '{print $1}'`" = "$MD51" ] ; then
74 echo "Downloading $PKGNAME1 package..."
79 while test $TEST != $GOOD
82 if [ ! "$GOTIT" = "yes" ] ; then
83 wget -c $DLURL/$BIGTAR1
86 if test -e $TARPATH/$BIGTAR1
91 if [ ! "$GOTIT" = "yes" ] ; then
92 echo Testing the file to see if it is good.
93 export TEST=`$INSTPATH/md5sum $TARPATH/$BIGTAR1 | awk '{print $1}'`
102 echo Extracting the image file. This will take some time.
104 TARERR=`$TARCMD1 2>&1`
105 # TARERR="unspecified bzip2 error"
107 $BZ2CMD1 $TARPATH/$BIGTAR1
108 # > $TARPATH/$BIGIMG1
109 if [ "$?" = 0 ] ; then
110 # rm -rf $TARPATH/$BIGTAR1
112 export MSG1=`printf "CONGRATULATIONS!\n\nAll has gone well!\n\nSuccess installing $PKGNAME1 package!"`
113 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "SUCCESS!" "$MSG1"
115 export ERR1=`printf "ERROR! TAR FAILED!\nUnable to install $PKGNAME1\n$TARERR"`
116 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x380 -title "TAR ERROR" "$ERR1"
120 export ERR1=`printf "$PKGNAME1 package appears damaged.\nPress OK to try downloading again.\nCancel keeps the damaged file."`
121 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0,GTK_STOCK_CANCEL:1 -geometry 640x100 -title "DOWNLOAD ERROR" "$ERR1"
122 if [ "$?" = 1 ] ; then
130 # Stop if only getting one package
132 if test $SKIPPKG2 == 1
138 # Download second package
141 echo "Downloading $PKGNAME2 package..."
145 while test $TEST2 != $GOOD2
148 wget -c $DLURL/$BIGTAR2
149 if test -e $TARPATH/$BIGTAR2
153 export TEST2=`$INSTPATH/md5sum $TARPATH/$BIGTAR2 | awk '{print $1}'`
155 if test $TEST2 = $GOOD2
158 TARERR=`$TARCMD2 2>&1`
159 if [ "$?" = 0 ] ; then
160 rm -rf $TARPATH/$BIGTAR2
162 export MSG2=`printf "CONGRATULATIONS!\n\nAll has gone well!\n\nSuccess installing $PKGNAME2 package!"`
163 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "SUCCESS!" "$MSG2"
165 export ERR2=`printf "ERROR! ERROR! ERROR!\nTAR FAILED!\n\nUnable to install $PKGNAME2\n\n$TARERR"`
166 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "TAR ERROR" "$ERR2"
170 echo "$PKGNAME2 package seems damaged, trying again!"