• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

bootable/newinstaller


Commit MetaInfo

Revision3d751646e5042a9ae9ad898d4ed22842baed4b69 (tree)
Time2011-01-09 16:32:42
AuthorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

1-install: handle errors more properly

Change Summary

Incremental Difference

--- a/install/scripts/1-install
+++ b/install/scripts/1-install
@@ -1,6 +1,6 @@
11 #
22 # By Chih-Wei Huang <cwhuang@linux.org.tw>
3-# Last updated 2010/12/23
3+# Last updated 2011/01/09
44 #
55 # License: GNU Public License
66 # We explicitely grant the right to use the scripts
@@ -147,6 +147,7 @@ create_data_img()
147147 losetup /dev/loop6 data.img
148148 mke2fs -jL /data /dev/loop6 > /dev/tty6
149149 fi
150+ [ $? -ne 0 ] && dialog --msgbox "\n Failed to create data.img." 7 33
150151 else
151152 dialog --title " Warning " --msgbox \
152153 "\nOK. So data will be save to a RAMDISK(tmpfs), and lose after power off." 8 49
@@ -169,9 +170,14 @@ create_sdcard_img()
169170 losetup /dev/loop7 $sdcard
170171 newfs_msdos -L sdcard /dev/loop7 > /dev/tty7 2>&1
171172 fi
173+ if [ $? -eq 0 ]; then
174+ sed -i "s|\(SDCARD=\S\+\?\s*\)||; s|\(SRC=\S\+\?\s*\)|\1 SDCARD=/$sdcard|" $menulst
175+ msg="The fake SD card is created successfully"
176+ else
177+ msg="Failed to create a fake SD card"
178+ fi
172179 cd /
173- sed -i "s|\(SDCARD=\S\+\?\s*\)||; s|\(SRC=\S\+\?\s*\)|\1 SDCARD=/$sdcard|" $menulst
174- dialog --ok-label Reboot --msgbox "\n The fake SD card is created successfully." 7 47
180+ dialog --ok-label Reboot --msgbox "\n $msg." 7 47
175181 }
176182
177183 install_to()
@@ -222,24 +228,27 @@ install_to()
222228 rm -rf system*
223229 ( ( cd /; find $files | $CPIO -H newc -o ) | pv -ns ${size}k | ( $CPIO -iud > /dev/null; echo $? > /tmp/result )) 2>&1 \
224230 | progress_bar "Installing Android-x86" "Expect to write $size KB..."
231+ result=$((`cat /tmp/result`*255))
225232
226- chmod 644 *
227- chown 0.0 *
228- mv mnt/$SRC/* . && rm -rf mnt
229- [ -d android ] && mv android/* . && rmdir android
233+ if [ $result -eq 0 ]; then
234+ chmod 644 *
235+ chown 0.0 *
236+ mv mnt/$SRC/* . && rm -rf mnt
237+ [ -d android ] && mv android/* . && rmdir android
230238
231- case "$fs" in
232- vfat|fuseblk)
233- create_data_img
234- ;;
235- *)
236- mkdir data
237- ;;
238- esac
239+ case "$fs" in
240+ vfat|fuseblk)
241+ create_data_img
242+ ;;
243+ *)
244+ mkdir data
245+ ;;
246+ esac
247+ fi
239248
240249 sync
241250
242- return $((`cat /tmp/result`*255))
251+ return $result
243252 }
244253
245254 install_hd()
@@ -267,7 +276,7 @@ do_install()
267276 until install_hd; do
268277 if [ $retval -eq 255 ]; then
269278 dialog --title ' Error! ' --yes-label Retry --no-label Reboot \
270- --yesno '\n Installation failed!' 7 35
279+ --yesno '\nInstallation failed! Please check if you have enough free disk space to install Android-x86.' 8 51
271280 [ $? -eq 1 ] && rebooting
272281 fi
273282 done