NeoTool (Correction!)
Joop Boonen
joop_boonen at web.de
Sun Feb 15 14:41:40 CET 2009
On Sun, February 15, 2009 2:35 pm, Joop Boonen wrote:
> All,
>
> I've changed a few things in NeoTool.
> 1) No need to run it as root any more as long as you are in the uucp
> group.
> 2) The config is saved in ~/.neotoolrc
> 3) The backup directory can be chosen, the default is: ~/openmoko/backups
>
> I couldn't reach the original maintainer yet. So i build version 1.2.1 for
> now, in the rpm packages.
>
> Regards,
>
> Joop Boonen.
>
> I couldn't reach the original maintainer yet.
>
> This is the NeoTool.patch:
I accedently added the wrong patch.
THis is the rioght one:
--- NeoTool-old 2009-02-14 21:07:33.000000000 +0100
+++ NeoTool 2009-02-15 14:38:51.000000000 +0100
@@ -1,5 +1,5 @@
#!/bin/bash
-VERSION='1.2'
+VERSION='1.2.1'
#########################################################
# NeoTool $VERSION
# By AntiSol, antisol (at) internode (dot) on (dot) net
@@ -41,12 +41,16 @@
# /data/openmoko/backups/{date}/{image}_backup
# and the {date} directory will be created by
NeoTool, assuming /data/openmoko/backups exists
# and you have permission.
+# v1.2.1 - 15/02/2009 - joop_boonen (at) web (dot) de
+# - Can now run as non root the user should be add to group
uucp
+# - The config is now written in ~/.neotoolrc
+# - The backup directory can now be choosen default
~/openmoko/backups
#
#########################################################
-settings_file='/etc/frutil'
+settings_file="$HOME/.neotoolrc"
tmp_error_log_path='/tmp/flash-error-log'
-tmpfile='/tmp/frutil.tmp'
+tmpfile='/tmp/neotool.tmp'
function find_dfu {
#use 'which'...
@@ -75,7 +79,7 @@
clear
echo 'Downloading dfu-util...'
rm ./dfu-util > /dev/null 2>&1
- wget
http://downloads.openmoko.org/daily/dfu-util
+ wget
http://downloads.openmoko.org/distro/releases/Om2008.9/dfu-util
chmod a+x ./dfu-util >/dev/null
dfutils_path='./dfu-util'
else
@@ -185,8 +189,8 @@
function flash {
- if [ "$user" != root ]; then
- zenity --error --text "You can only flash your device if
you are root!"
+ if [ "$groups" = "${groups/uucp/}" ]; then
+ zenity --error --text "You can only flash your device if
you are in the uucp group!"
return
fi
@@ -318,7 +322,7 @@
}
function setup_menu {
- sans=`zenity --title "NeoTool Configurification" --text "Choose an
option" --list --height=320 --width=500 --column "" --column "" 1 "Locate
dfu-util ($dfutils_path)" 2 "Set your device's IP ($FRIP)" 3 "Choose
backup filename ($backupfn)" 4 "Setup date command ($datecmd)" 5 "Test
settings defined in (3) and (4)" 6 "Save These Settings" 7 "Reset to
defaults" 8 "Back to Main Menu"`
+ sans=`zenity --title "NeoTool Configurification" --text "Choose an
option" --list --height=320 --width=500 --column "" --column "" 1 "Locate
dfu-util ($dfutils_path)" 2 "Set your device's IP ($FRIP)" 3 "Choose
backup filename ($backupfn)" 4 "Setup date command ($datecmd)" 5 "Choose
backup directory ($backupdir)" 6 "Test settings defined in (3), (4) and
(5)" 7 "Save These Settings" 8 "Reset to defaults" 9 "Back to Main Menu"`
}
@@ -355,29 +359,31 @@
fi
;;
5)
- tmp=${backupfn//"{date}"/"`$datecmd`"}
+ oldbackupdir="$backupdir"
+ backupdir=$(zenity --entry --text "`printf "Enter
the default directoryname to be used for backups.\nuse '{image}' for the
Image type (kernel, rootfs, etc), \nand '{date}' for the date.\n the file
extension will be added automatically."`" --entry-text "$backupdir"
--title "Configure Backup Directoryname")
+ if [ -z "$backupdir" ]; then
+ backupdir=$oldbackupdir
+ fi
+ ;;
+ 6)
+ tmp=$backupdir"/"${backupfn//"{date}"/"`$datecmd`"}
tmp=${tmp//"{image}"/"rootfs"}".jffs2\n"${tmp//"{image}"/"kernel"}".bin"
zenity --info --title "Example Backup File" --text
"Using the rules defined by current settings,
backup filenames will look something like
this:\n\n$tmp"
;;
- 6)
- if [ "$user" != root ]; then
- zenity --error --text "You are not root, cannot
save settings!"
- else
+ 7)
echo "dfutils_path='$dfutils_path'" > $settings_file
echo "FRIP='$FRIP'" >> $settings_file
echo "backupfn='$backupfn'" >> $settings_file
echo "datecmd='$datecmd'" >> $settings_file
+ echo "backupdir='$backupdir'" >> $settings_file
zenity --info --text "Settings saved to
$settings_file" --title "Done."
- fi;;
+ ;;
- 7)
- if [ "$user" != root ]; then
- zenity --error --text "You are not root, cannot
modify settings!"
- else
+ 8)
rm -f $settings_file
zenity --info --text "Settings will reset to
default once you restart this tool" --title
"Done."
- fi;;
+ ;;
*) return;;
@@ -390,8 +396,8 @@
}
function show_dfu_msg {
- if [ "$user" != root ]; then
- zenity --error --text "The remaining backup tasks cannot
be completed, because you are not running NeoTool as root!"
+ if [ "$groups" = "${groups/uucp/}" ]; then
+ zenity --error --text "The remaining backup tasks cannot
be completed, because you are not running NeoTool while your in the uucp
group!"
return -1
fi
@@ -641,7 +647,7 @@
if [ -z "$rootfs_type" ]; then
rootfs_type=$old_rootfs_type
fi
- FSIMG=${backupfn//"{date}"/"`$datecmd`"}".$rootfs_type"
+
FSIMG=$backupdir"/"${backupfn//"{date}"/"`$datecmd`"}".$rootfs_type"
FSIMG=${FSIMG//"{image}"/"rootfs"}
#echo fsimg = $FSIMG
@@ -737,16 +743,16 @@
rootfs_type=jffs2
kernel_type=scp
- FSIMG=${backupfn//"{date}"/"`$datecmd`"}".$rootfs_type"
+ FSIMG=$backupdir"/"${backupfn//"{date}"/"`$datecmd`"}".$rootfs_type"
FSIMG=${FSIMG//"{image}"/"rootfs"}
- KIMAGE=${backupfn//"{date}"/"`$datecmd`"}".bin"
+ KIMAGE=$backupdir"/"${backupfn//"{date}"/"`$datecmd`"}".bin"
KIMAGE=${KIMAGE//"{image}"/"kernel"}
- UIMAGE=${backupfn//"{date}"/"`$datecmd`"}".bin"
+ UIMAGE=$backupdir"/"${backupfn//"{date}"/"`$datecmd`"}".bin"
UIMAGE=${UIMAGE//"{image}"/"u-boot"}
- SIMAGE=${backupfn//"{date}"/"`$datecmd`"}".gz"
+ SIMAGE=$backupdir"/"${backupfn//"{date}"/"`$datecmd`"}".gz"
SIMAGE=${SIMAGE//"{image}"/"splash"}
#echo fsimg = $FSIMG
@@ -789,11 +795,11 @@
exit
fi
-#check user...
-user=`whoami`
+#check groups... uucp is needed to allow access to the serial usb interface
+groups=`groups`
-if [ "$user" != root ]; then
- zenity --title "You are not root!" --question --text 'This utility
should be run as root. You can proceed, but you will not be able to save
your settings or flash your Neo.\n\n Do you want to continue?'
+if [ "$groups" = "${groups/uucp/}" ]; then
+ zenity --title "You are not root!" --question --text 'You should
be in the uucp group otherwise you wont be able to flash amd contact your
Neo via the serial usb interface.\n\n Do you want to continue?'
if [ $? != 0 ]; then
echo "exiting."
@@ -810,7 +816,11 @@
check_dfu
if [ -z "$backupfn" ]; then
- backupfn="./Neo_{image}_Backup_{date}"
+ backupfn="Neo_{image}_Backup_{date}"
+fi
+
+if [ -z "$backupdir" ]; then
+ backupdir="$HOME/openmoko/backups"
fi
if [ -z "$datecmd" ]; then
More information about the community
mailing list