Joel Newkirk wrote:
On Sun, 7 Sep 2008 14:50:20 -0400, "Charles Pax" <[EMAIL PROTECTED]>
wrote:
On Sun, Sep 7, 2008 at 1:19 PM, Dale Maggee
<[EMAIL PROTECTED]>wrote:
I was more bored and wanted to exercise my scripting skillz, so I made
some changes to this script.
I saved your code into a file called "flasher" and make it executable. I
get the following error.
./flasher: line 67: syntax error near unexpected token `('
./flasher: line 67: `the USB-Device and booted into the Nor (for kernel
and
rootfs) or Nand'
-Charles
Something like a bash script really MUST be sent as an attachment, to
ensure this breakage doesn't happen. Meanwhile you can go through the
script and removed the extra newlines, so that echo statements and comments
(the things I noted glancing at the script) are not wrapped.
j
aah, damn word wrap!
here it is as an attachment, hope they're allowed.
-Dale
#!/bin/bash
# dfu-util Image-Flashing Gui 0.2
function check_dfu {
if [ ! -x $dfutils_path ]; then
#look in current folder...
if [ -x './dfu-util' ]; then
dfutils_path='./dfu-util'
else
zenity --info --text "The dfu utility could not be
found at $dfutils_path, or is not exceutable. Please point me to the
dfu-util..."
dfutils_path=$(zenity --file-selection --title="Select
the dfu-util executable:" --filename="$dfutils_path")
if [ -z "$dfutils_path" ]; then
echo "Cancelled!"
exit
fi
#check selection...
check_dfu
fi
fi
}
function perform_flash {
# $1 - what we're flashing (for display)
# $2 - dfu-params
# $3 - file to flash
echo
echo "*** Flashing $1 with $3 ..."
echo
$dfutils_path $2 $3 2> $tmp_error_log_path
# add the following line to the previous line to get back the zenity
progress dialog:
# | zenity --progress --pulsate --percentage=0 --title "Flashing in
progress.." --auto-close
if [ "${PIPESTATUS[0]}" != "0" ];then
zenity --error --text "Some error occured while flashing
$1.\n\nError message:\n`cat $tmp_error_log_path`"
exit
else
#sleep to allow dfu to reset...
sleep 2
fi
}
dfutils_path='/usr/local/bin/dfu-util'
check_dfu
tmp_error_log_path='/tmp/flash-error-log'
ans=$(zenity --list --text "What do you wanna flash?" --title "dfu-util gui"
--checklist --column "Pick" --column "Option" TRUE Root-Filesystem TRUE Kernel
FALSE Bootloader)
if [ -z "$ans" ]; then
#handle cancel / no selection...
echo "Nothing to do!"
exit
fi
txt="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.\n\n"
if [ -n "`echo $ans | grep Root-Filesystem`" ];then
du_param_r='-a rootfs -R -D'
rootfs=True
img_file_r=$(zenity --file-selection --title="Select an image-file for
the ROOTFS:")
if [ "$img_file_r" = "" ]; then
echo "Cancelled!"
exit
fi
txt="$txt - Flashing rootfs with $img_file_r \n\n"
fi
if [ -n "`echo $ans | grep Kernel`" ];then
du_param_k='-a kernel -R -D'
kernel=True
img_file_k=$(zenity --file-selection --title="Select an image-file for
the KERNEL:")
if [ "$img_file_k" = "" ]; then
echo "Cancelled!"
exit
fi
txt="$txt - Flashing kernel with $img_file_k \n\n"
fi
if [ -n "` echo $ans | grep Bootloader`" ];then
du_param_u='-a u-boot -R -D'
uboot=True
img_file_u=$(zenity --file-selection --title="Select an image-file for
UBOOT:")
if [ "$img_file_u" = "" ]; then
echo "Cancelled!"
exit
fi
txt="$txt - Flashing uboot with $img_file_u \n\n"
fi
touch $tmp_error_log_path
zenity --info --text "$txt"
if [ "$rootfs" = True ]; then
perform_flash rootfs "$du_param_r" "$img_file_r"
fi
if [ "$kernel" = True ]; then
perform_flash kernel "$du_param_k" "$img_file_k"
fi
if [ "$uboot" = True ]; then
perform_flash uboot "$du_param_u" "$img_file_u"
fi
rm $tmp_error_log_path
exit 0
_______________________________________________
Openmoko community mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/community