3 ## Download the list of images. Also use this opportunity to check
4 ## the Internet connection and availability of the server.
6 IMGLIST="imagelist-fremantle-01"
8 mv $IMGLIST $IMGLIST.old
9 wget -t 3 http://qole.org/$IMGLIST
12 Cannot download the list of available images.\n\
13 Something is wrong with either your Internet connection\n\
14 or the qole.org file server.\n\n\
15 Check your Internet connection and the status\n\
16 of the server by browsing to http://qole.org"`
17 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "Download Error" "$MSG1"
22 "`awk -F ',' '/^[0-9],/ {print $2":"$1","}' $IMGLIST`Cancel:0" \
23 "`awk -F ',' '/^[0-9],/ {print $2":"$6}' $IMGLIST`"
26 #Both 0 and 1 are Cancel
28 if [ "$IMGCHOICE" -le "1" ] ; then
32 DLURL=`awk -F"," '$1=='$IMGCHOICE' {print $3}' $IMGLIST`
33 PKGNAME1=`awk -F"," '$1=='"$IMGCHOICE"' {print $6}' $IMGLIST`
34 BIGTAR1=`awk -F"," '$1=='"$IMGCHOICE"' {print $4"."$5}' $IMGLIST`
35 BIGIMG1=`awk -F"," '$1=='"$IMGCHOICE"' {print $4}' $IMGLIST`
36 MD51=`awk -F"," '$1=='"$IMGCHOICE"' {print $7}' $IMGLIST`
37 IMGCMPRSS=`awk -F"," '$1=='"$IMGCHOICE"' {print $5}' $IMGLIST`
46 ## Make sure the chroot is closed, to avoid spurious mounts
48 sudo closechroot >/dev/null
50 ## Ask where the user wishes to install the package with gxmessage:
52 export GXMSG=`printf "\
53 Where do you want your Debian image file installed?\n\
54 You need approximately 2.3GB initially.\n\
55 Free space left in internal memory or your memory card:\n\n"; \
56 df -h | grep "mmcblk.p1" | awk '{print $6 ": " $4 " free, " $2 " total (" $5 " full)"}' | sort`
57 gxmessage -center -buttons MyDocs:2,MicroSD:3 -geometry 690x380 -title "Choose Memory Card" "$GXMSG"
62 export SDCARD="/home/user/MyDocs"
65 export SDCARD="/media/mmc1"
72 echo "Downloading and extracting $BIGIMG1 to $SDCARD..."
76 ## HERE ARE THE REST OF THE VARIABLES:
78 export INSTPATH="/home/user/img-install"
79 export TARPATH="$SDCARD"
80 export EXTPATH1=$TARPATH
83 #export CLEANUP="sudo rm -r $INSTPATH ; sudo rm /usr/share/applications/image-install.desktop "
84 export CLEANUP="echo All done!"
88 # Download first package
91 echo "Downloading $PKGNAME1 package..."
95 if [ -f $TARPATH/$BIGTAR1 ] ; then
96 echo You already have the big image file!
97 echo Checking to see if it is good...
98 if [ "`md5sum $TARPATH/$BIGTAR1 | awk '{print $1}'`" = "$MD51" ] ; then
106 while test $TEST != $GOOD
109 if [ ! "$GOTIT" = "yes" ] ; then
110 wget -c $DLURL/$BIGTAR1
113 if test -e $TARPATH/$BIGTAR1
118 if [ ! "$GOTIT" = "yes" ] ; then
119 echo Testing the file to see if it is good.
120 export TEST=`md5sum $TARPATH/$BIGTAR1 | awk '{print $1}'`
125 if test $TEST = $GOOD
130 # Warn the user that the decompression is going to take a long time.
132 export MSG1=`printf "\
133 Extracting the image file.\n\
134 This could take a very long time and could\n\
135 cause your device to become unresponsive."`
136 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "Decompressing" "$MSG1" &
139 echo "Extracting $BIGTAR1 package..."
141 TARERR="Unknown lzma error"
142 # read -p 'press enter' key
144 lzma -kd $TARPATH/$BIGTAR1
145 if [ "$?" = 0 ] ; then
146 rm -rf $TARPATH/$BIGTAR1
148 touch /home/user/.synchroot
149 ./msgnotify /usr/share/sounds/game-chess_checkmate.wav
150 export MSG1=`printf "CONGRATULATIONS!\n\nAll has gone well!\n\nSuccess installing $PKGNAME1 package!"`
151 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x250 -title "SUCCESS!" "$MSG1"
153 ./msgnotify /usr/share/sounds/ui-information_note.wav
154 export ERR1=`printf "ERROR! DECOMPRESSION FAILED!\nUnable to install $PKGNAME1\n$TARERR"`
155 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0 -geometry 640x380 -title "DECOMPRESSION ERROR" "$ERR1"
159 ./msgnotify /usr/share/sounds/ui-information_note.wav
160 export ERR1=`printf "$PKGNAME1 package appears damaged.\nPress OK to try downloading again.\nCancel keeps the damaged file."`
161 gxmessage -center -alignbuttons right -buttons GTK_STOCK_OK:0,GTK_STOCK_CANCEL:1 -geometry 640x100 -title "DOWNLOAD ERROR" "$ERR1"
162 if [ "$?" = 1 ] ; then