ubuntuusers.de

zenitygui for flashing neo images

Autor:
Rorschach
Datum:
11. August 2008 12:58
Code:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# dfu-util Image-Flashing Gui 0.1 


dfutils_path='~/Desktop/neo/dfu-util'
tmp_error_log_path='/tmp/error-log'


ans=$(zenity  --list --text "What do you wanna flash?" --title "dfu-util gui" --radiolist --column "Pick" --column "Option" TRUE Root-Filesystem FALSE Kernel FALSE Bootloader)

if [ $ans == "Root-Filesystem" ];then
	du_param='-a rootfs -R -D'
elif [ $ans == "Kernel" ];then
	du_param='-a kernel -R -D'
elif [ $ans == "Bootloader" ];then
	du_param='-a u-boot -R -D'
fi

img_file=$(zenity --file-selection --title="Select an image-file")

touch $tmp_error_log_path

zenity --info --text "The flashing will now start.\n\nMake sure your Neo is connected to the USB-Device and booted into the Nor (for kernel and rootfs) or Nand (for u-boot) screen before proceeding.\nRemember that flashing a large image like a rootfs will take some time so don't abort it."
$dfutils_path $du_param $img_file 2> $tmp_error_log_path | zenity --progress --pulsate --percentage=0 --title "Flashing in progress.." --auto-close

if [ "${PIPESTATUS[0]}" != "0" ];then
	zenity --error --text "Some error occured while flashing.\nError message:\n`cat $tmp_error_log_path`"
fi

rm $tmp_error_log_path
exit 0