[luci] How do you tell LuCI to not check for a non-existent directory?

Kunal Punjabi kpunjabi at ubicom.com
Fri Jul 24 03:35:54 CEST 2009


Hi everyone,

 

By default OpenWRT (which uses LuCI) has a system->Mount Points page,
where one can mount devices from.

 

 

Adding an entry to the "Mount Points" section of this page and then
pressing "Save and Apply" causes the USB device to get mounted *if and
only if* the "mount point" directory being mounted to already exists.

If the directory does not exist, the device is obviously not mounted and
returns the following error:

Value "/mnt/usb" of option "fstab. at mount[0].target" does not validate as
datatype "directory"

 

I would like to automatically create the directory if it does not exist
and disable this check, and I think my code should be creating the
directory if it does not exist (I am using a mount -p command in the
do_mount() function).

However, when I try to mount to a non-existent directory from the UI
(luci), I still see the same error.

Value "/mnt/usb" of option "fstab. at mount[0].target" does not validate as
datatype "directory"

 

I suspect that the error gets triggered before the back end gets a
chance to create the mount point (ie before do_mount gets called).
However I could not find the option for disabling the check in the LuCi
documentation

The only thing I found that was somewhat close was this.

https://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/fs.l
ua?rev=4889

 

	
64
<https://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/fs.
lua?rev=4889#L64> 

--- Checks wheather the given path exists and points to a regular file.

65
<https://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/fs.
lua?rev=4889#L65> 

-- @param filename      String containing the path of the file to test

66
<https://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/fs.
lua?rev=4889#L66> 

-- @return                      Boolean indicating wheather given path
points to regular file

67
<https://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/fs.
lua?rev=4889#L67> 

function isfile(filename)

68
<https://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/fs.
lua?rev=4889#L68> 

        return fs.stat(filename, "type") == "reg"

69
<https://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/fs.
lua?rev=4889#L69> 

End

70
<https://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/fs.
lua?rev=4889#L70> 

	
71
<https://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/fs.
lua?rev=4889#L71> 

--- Checks wheather the given path exists and points to a directory.

72
<https://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/fs.
lua?rev=4889#L72> 

-- @param dirname       String containing the path of the directory to
test

73
<https://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/fs.
lua?rev=4889#L73> 

-- @return                      Boolean indicating wheather given path
points to directory

74
<https://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/fs.
lua?rev=4889#L74> 

function isdirectory(dirname)

75
<https://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/fs.
lua?rev=4889#L75> 

        return fs.stat(dirname, "type") == "dir"

76
<https://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/fs.
lua?rev=4889#L76> 

End

77
<https://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/fs.
lua?rev=4889#L77> 

	

 

However, I don't see any references to isfile, isdirectory, or even
fs.stat in the model/controller responsible.

luci-0.8.6/modules/admin-full/luasrc/model/cbi/admin_system/fstab.lua

 

Does anyone have an idea how the check for the directory being present
can be disabled? The documentation doesn't have this as far as I know.

 

Thanks,

Kunal

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.subsignal.org/pipermail/luci/attachments/20090723/c32376e8/attachment-0001.htm 


More information about the luci mailing list