usb_Storage
Posted: Fri Feb 18, 2011 5:28 am
I'm using a dir-825 with a custom compiled image.
When I first plug a drive into the usb (after an install or firstboot) things work great. but after a reboot the init script fails to work. The problem is the line where it tries to turn the MB size into GB
The shell can't do the math. (no matter how I try to get it to) That stops the /tmp/mounted_usb_storage.tab from being created, which stops my disks showing up in the web page.
I've had to change the line to
[edit]
df -h doesn't work. it converts from bytes to mb so it would need an extra if to see if it was G or M then divide it back? I can't figure out how the web page comes up with its file size: share_size=$(df -h | grep "$d" | awk '{ print $2 }' |sed 's/\(.*\)./\1/' )
comes up with a size in kb.
[/edit]
I
I think that also the /tmp/usb_restart.lock is broken. It never gets removed?
needs to be
I think the same is true for the restart option.
When I first plug a drive into the usb (after an install or firstboot) things work great. but after a reboot the init script fails to work. The problem is the line where it tries to turn the MB size into GB
Code: Select all
share_size=$(df | grep "$d" | awk '{ print $2 }')
if [ -z "$share_size" ] ; then share_size="-" ; fi
if [ -n "$share_size" ] ; then share_size=$[(($share_size*1024)) ; fi
I've had to change the line to
Code: Select all
share_size=$(df -h| grep "$d" | awk '{ print $2 }')
if [ -z "$share_size" ] ; then share_size="-" ; fi
if [ -n "$share_size" ] ; then share_size=$share_size ; fi
df -h doesn't work. it converts from bytes to mb so it would need an extra if to see if it was G or M then divide it back? I can't figure out how the web page comes up with its file size: share_size=$(df -h | grep "$d" | awk '{ print $2 }' |sed 's/\(.*\)./\1/' )
comes up with a size in kb.
[/edit]
I
I think that also the /tmp/usb_restart.lock is broken. It never gets removed?
Code: Select all
stop()
{
got_lock=$(usb_lock)
if [ "$got_lock" = "1" ] ; then
do_stop
usb_unlock
fi
}
Code: Select all
stop()
{
got_lock=$(usb_lock)
if [ "$got_lock" = "0" ] ; then
do_stop
usb_unlock
fi
}