3 ## Download the list of images. Also use this opportunity to check
4 ## the Internet connection and availability of the server.
6 IMGLIST="imagelist-0.9.40"
8 mv $IMGLIST $IMGLIST.old
9 wget -t 3 http://qole.org/$IMGLIST
12 Cannot download the list of available images.\n\
14 Something is wrong with either your Internet connection\n\
15 or the qole.org file server.\n\n\
16 Check your Internet connection and the status\n\
17 of the server by browsing to http://qole.org"`
18 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "Download Error" "$MSG1"
23 "`awk -F ',' '/^[0-9],/ {print $2":"$1","}' $IMGLIST`Cancel:0" \
24 "`awk -F ',' '/^[0-9],/ {print $2":"$6}' $IMGLIST`"
27 #Both 0 and 1 are Cancel
29 if [ "$IMGCHOICE" -le "1" ] ; then
33 DLURL=`awk -F"," '$1=='$IMGCHOICE' {print $3}' $IMGLIST`
34 PKGNAME1=`awk -F"," '$1=='"$IMGCHOICE"' {print $6}' $IMGLIST`
35 BIGTAR1=`awk -F"," '$1=='"$IMGCHOICE"' {print $4"."$5}' $IMGLIST`
36 BIGIMG1=`awk -F"," '$1=='"$IMGCHOICE"' {print $4}' $IMGLIST`
37 MD51=`awk -F"," '$1=='"$IMGCHOICE"' {print $7}' $IMGLIST`
38 IMGCMPRSS=`awk -F"," '$1=='"$IMGCHOICE"' {print $5}' $IMGLIST`
47 ## Make sure the chroot is closed, to avoid spurious mounts
49 sudo closechroot >/dev/null
51 ## Ask where the user wishes to install the package with gxmessage:
53 export GXMSG=`printf "\
54 Where do you want your Debian image file installed?\n\
55 You need approximately 2.3GB initially.\n\
56 Free space left in internal memory or your memory card:\n\n"; \
57 df -h | grep "mmcblk.p1" | awk '{print $6 ": " $4 " free, " $2 " total (" $5 " full)"}' | sort`
58 gxmessage -center -buttons MyDocs:2,MicroSD:3 -geometry 690x380 -title "Choose Memory Card" "$GXMSG"
63 export SDCARD="/home/user/MyDocs"
66 export SDCARD="/media/mmc1"
73 echo "Downloading and extracting $BIGIMG1 to $SDCARD..."
77 ## HERE ARE THE REST OF THE VARIABLES:
79 export INSTPATH="/home/user/img-install"
80 export TARPATH="$SDCARD"
81 export EXTPATH1=$TARPATH
84 #export CLEANUP="sudo rm -r $INSTPATH ; sudo rm /usr/share/applications/image-install.desktop "
85 export CLEANUP="echo All done!"
89 # Download first package
92 echo "Downloading $PKGNAME1 package..."
96 if [ -f $TARPATH/$BIGTAR1 ] ; then
97 echo You already have the big image file!
98 echo Checking to see if it is good...
99 if [ "`$INSTPATH/md5sum $TARPATH/$BIGTAR1 | awk '{print $1}'`" = "$MD51" ] ; then
107 while test $TEST != $GOOD
110 if [ ! "$GOTIT" = "yes" ] ; then
111 wget -c $DLURL/$BIGTAR1
114 if test -e $TARPATH/$BIGTAR1
119 if [ ! "$GOTIT" = "yes" ] ; then
120 echo Testing the file to see if it is good.
121 export TEST=`$INSTPATH/md5sum $TARPATH/$BIGTAR1 | awk '{print $1}'`
126 if test $TEST = $GOOD
131 # Warn the user that the decompression is going to take a long time.
133 export MSG1=`printf "\
134 Extracting the image file.\n\
135 This could take a very long time and could\n\
136 cause your device to become unresponsive."`
137 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "Decompressing" "$MSG1" &
140 echo "Extracting $BIGTAR1 package..."
142 TARERR="Unknown lzma error"
143 # read -p 'press enter' key
145 lzma -kd $TARPATH/$BIGTAR1
146 if [ "$?" = 0 ] ; then
147 rm -rf $TARPATH/$BIGTAR1
149 export MSG1=`printf "CONGRATULATIONS!\n\nAll has gone well!\n\nSuccess installing $PKGNAME1 package!"`
150 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "SUCCESS!" "$MSG1"
152 export ERR1=`printf "ERROR! DECOMPRESSION FAILED!\nUnable to install $PKGNAME1\n$TARERR"`
153 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x380 -title "DECOMPRESSION ERROR" "$ERR1"
157 export ERR1=`printf "$PKGNAME1 package appears damaged.\nPress OK to try downloading again.\nCancel keeps the damaged file."`
158 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0,GTK_STOCK_CANCEL:1 -geometry 640x100 -title "DOWNLOAD ERROR" "$ERR1"
159 if [ "$?" = 1 ] ; then