hello all,
not a specific pli question, but since there are some good programmers on the pli team....
for a plugin i'm working on (xmltvimport) , i'm looking for a way to detect the best place to store downloaded files (E2) .
so first
- usb
- cf
- harddisk
- mount
but i'm having a hard time to detect these, and see if there writable.
i also noticed that some mountpoints are different between E2 boxes.
so is there a good way to do this??
thanks , arnold
Detect cf/usb/hdd/mount
Started by arnoldl, 08 Jul 2009 17:55
3 replies to this topic
Re: Detect cf/usb/hdd/mount #2
Re: Detect cf/usb/hdd/mount #3
Posted 8 July 2009 - 20:58
hey peterg ,
thanks for the reply.
tried catching the mount output, but still gave me problems.
some autofs mounted devices(usb) are not shown there if i remeber correct (has been a while since i was working on this).
until now i was using :
this worked for me , with a mounted hdd , but i believe failed on a int. hdd (dm800) and failed with usb.
on this dm800 the output of mount is :
[mail]root@dm800[/mail]:~# mount
/dev/root on / type jffs2 (rw,noatime)
none on /dev type devfs (rw)
proc on /proc type proc (rw,nodiratime)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw)
usbdevfs on /proc/bus/usb type usbfs (rw)
/dev/mtdblock/2 on /boot type jffs2 (ro,noatime)
tmpfs on /var type tmpfs (rw)
tmpfs on /tmp type tmpfs (rw)
/dev/sda1 on /autofs/sda1 type ext3 (rw)
/dev/sdb1 on /autofs/sdb1 type ext3 (rw)
[mail]root@dm800[/mail]:~#
so there is no mount to media/usb or media/hdd...
in this case , how to detect that i can write to usb and/or hdd ??
thanks,
thanks for the reply.
tried catching the mount output, but still gave me problems.
some autofs mounted devices(usb) are not shown there if i remeber correct (has been a while since i was working on this).
until now i was using :
path='/tmp' if self.checkPath('/media/cf'): path='/media/cf/' if self.checkPath('/media/usb'): path='/media/usb/' if self.checkPath('/media/hdd'): path='/media/hdd/' print "Downloading : " + sourcefile + " To local path : " + path def checkPath(self,path): f = os.popen('mount', "r") for l in f.xreadlines(): if l.find(path)!=-1: return True return False
this worked for me , with a mounted hdd , but i believe failed on a int. hdd (dm800) and failed with usb.
on this dm800 the output of mount is :
[mail]root@dm800[/mail]:~# mount
/dev/root on / type jffs2 (rw,noatime)
none on /dev type devfs (rw)
proc on /proc type proc (rw,nodiratime)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw)
usbdevfs on /proc/bus/usb type usbfs (rw)
/dev/mtdblock/2 on /boot type jffs2 (ro,noatime)
tmpfs on /var type tmpfs (rw)
tmpfs on /tmp type tmpfs (rw)
/dev/sda1 on /autofs/sda1 type ext3 (rw)
/dev/sdb1 on /autofs/sdb1 type ext3 (rw)
[mail]root@dm800[/mail]:~#
so there is no mount to media/usb or media/hdd...
in this case , how to detect that i can write to usb and/or hdd ??
thanks,
Re: Detect cf/usb/hdd/mount #4
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users