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-squeeze-m5-img.bz2"
39 export BIGIMG1="debian-squeeze-m5.img.ext2"
40 export BZ2CMD1="bzip2 -dc "
41 export BZ2CMD2=" > $TARPATH/$BIGIMG1"
42 export TARCMD1="$BZ2CMD1 $TARPATH/$BIGTAR1 $BZ2CMD2"
43 export MD51="f769bb84c99f75821bdfa37e5ea34e86"
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 # Oh wow, this is even more of an ugly hack than my
105 # usual ugly hacks. So sorry you had to see this.
107 # TARERR=`$TARCMD1 2>&1`
108 TARERR="unspecified bzip2 error"
110 $BZ2CMD1 $TARPATH/$BIGTAR1 > $TARPATH/$BIGIMG1
111 if [ "$?" = 0 ] ; then
112 rm -rf $TARPATH/$BIGTAR1
114 export MSG1=`printf "CONGRATULATIONS!\n\nAll has gone well!\n\nSuccess installing $PKGNAME1 package!"`
115 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "SUCCESS!" "$MSG1"
117 export ERR1=`printf "ERROR! TAR FAILED!\nUnable to install $PKGNAME1\n$TARERR"`
118 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x380 -title "TAR ERROR" "$ERR1"
122 export ERR1=`printf "$PKGNAME1 package appears damaged.\nPress OK to try downloading again.\nCancel keeps the damaged file."`
123 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0,GTK_STOCK_CANCEL:1 -geometry 640x100 -title "DOWNLOAD ERROR" "$ERR1"
124 if [ "$?" = 1 ] ; then
132 # Stop if only getting one package
134 if test $SKIPPKG2 == 1
140 # Download second package
143 echo "Downloading $PKGNAME2 package..."
147 while test $TEST2 != $GOOD2
150 wget -c $DLURL/$BIGTAR2
151 if test -e $TARPATH/$BIGTAR2
155 export TEST2=`$INSTPATH/md5sum $TARPATH/$BIGTAR2 | awk '{print $1}'`
157 if test $TEST2 = $GOOD2
160 TARERR=`$TARCMD2 2>&1`
161 if [ "$?" = 0 ] ; then
162 rm -rf $TARPATH/$BIGTAR2
164 export MSG2=`printf "CONGRATULATIONS!\n\nAll has gone well!\n\nSuccess installing $PKGNAME2 package!"`
165 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "SUCCESS!" "$MSG2"
167 export ERR2=`printf "ERROR! ERROR! ERROR!\nTAR FAILED!\n\nUnable to install $PKGNAME2\n\n$TARERR"`
168 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "TAR ERROR" "$ERR2"
172 echo "$PKGNAME2 package seems damaged, trying again!"