Extending NUT package to work with multiple UPSs

  • Hello,

    I am rewriting the pfsense NUT package to work with multiple UPSs. Everything is working, except deleting UPSs. The issue is that I need to reload NUT when a UPS is deleted, but as far as I can see there is no way to apply a delete action in the XML.

    I am using pkg.php and the <adddeleteeditpagefields>XML tag to create the add/modify/remove list of UPSs.

    Here is the code:
    pkg/nut.xml:                http://pastebin.com/f6qM2F87
    pkg/nut.inc:                  http://pastebin.com/MsYsvUWC
    www/status_nut.php :  http://pastebin.com/0Zbvbfdb

    What I need is for a sync_package() to happen on removal of a UPS, but I am constrained by using nut.xml. If there was a <custom_php_remove_command>that I could specify in nut.xml, I would just add:


    As a possible workaround for this problem, I am considering writing a new /www/ page with the table of UPSs which would look the same as pkg.php?xml=nut.xml, but I would be able add an action to the delete button.

    Is this a good solution? Is there a better way? Any advice is appreciated.</custom_php_remove_command></adddeleteeditpagefields>