[luci] How does LuCI hook into the back-end?

Kunal Punjabi kpunjabi at ubicom.com
Fri Jul 10 02:11:58 CEST 2009


Hi JoW,

Thank you very much for the prompt response. I have a follow-up question
on your clarification, leading into another question. Ps. Sorry for the
duplicate message sent earlier, I wasn't sure the message made it to the
mailing list due to its size.

 

You said..

>> You need to do this in the init script then, by comparing the current

/proc/mtab against the state saved in uci (e.g. if it is mounted and

config says enabled = 0, then call umount, else call mount - if states

match, do nothing).

 

That makes sense at a high level, but on digging deeper I found that I
was lost again. The console does not have /proc/mtab entry.

This is a snippet from /etc/init.d/fstab  (which comes from
openwrt/build_dir/ARCH/root-ARCH/etc/init.d/fstab)

By the way is this entire file generated by LuCi? If so how come
grepping the LuCi directory does not show any of the functions defined
here?

 

start() {                       

        config_load fstab


        echo '# WARNING: this is an auto generated file, please use uci
to set static filesystems' > /tmp/fsta

        config_foreach do_mount mount


        config_foreach do_swapon swap


        mount -a


        [ -x /sbin/swapon ] && swapon -a


}


 


stop() {                                                 

        config_load fstab


        config_foreach do_unmount mount

        config_foreach do_swapoff swap 

}              

 

 

 

As you said if I need to unmount the drive when the 'x' button is
clicked, I would need to call umount in the init script, but isnt that
what the stop() function above does already? It looks like it is doing a
umount for multiple entries here (given the config_foreach clause)

 

Unless there is another 'hook' that I am missing..

 

The only places calling stop() are..

 

luci-0.8.6/libs/sgi-webuci/root/etc/init.d/boa:stop() {

luci-0.8.6/libs/lucittpd/root/etc/init.d/lucittpd:stop() {

luci-0.8.6/libs/cbi/htdocs/luci-static/resources/cbi.js:
event.stop();

luci-0.8.6/libs/cbi/dist/www/luci-static/resources/cbi.js:
event.stop();

luci-0.8.6/applications/luci-splash/root/etc/init.d/luci_splash:stop() {

luci-0.8.6/contrib/package/olsrd-luci/files/etc/init.d/olsrd:stop() {

luci-0.8.6/modules/admin-core/root/etc/init.d/luci_hosts:stop() {

luci-0.8.6/modules/admin-core/root/etc/init.d/luci_ethers:stop() {

luci-0.8.6/modules/admin-core/dist/etc/init.d/luci_hosts:stop() {

luci-0.8.6/modules/admin-core/dist/etc/init.d/luci_ethers:stop() {

luci-0.8.6/ipkg/luci-cbi/www/luci-static/resources/cbi.js:
event.stop();

luci-0.8.6/ipkg/luci-admin-core/etc/init.d/luci_hosts:stop() {

luci-0.8.6/ipkg/luci-admin-core/etc/init.d/luci_ethers:stop() {

 

 

The only places calling do_unmount() are

root-ubicom32/etc/rc.d/S20fstab:do_unmount() {

root-ubicom32/etc/rc.d/S20fstab:        config_foreach do_unmount mount

root-ubicom32/etc/init.d/fstab:do_unmount() {

root-ubicom32/etc/init.d/fstab: config_foreach do_unmount mount

 

If you could point me in the right direction, that would be very much
appreciated.

 

Thanks,

Kunal

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.subsignal.org/pipermail/luci/attachments/20090709/54fe7be8/attachment.htm 


More information about the luci mailing list