Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
30dcc4861f | |||
b8690bf214 | |||
6592179f55 | |||
369074dbc3 | |||
08ccb2ed05 | |||
ab71db34ab | |||
cdbe0b487e | |||
dea6f469f4 | |||
1baee823e2 | |||
7c0e22d7bc | |||
10338a8620 | |||
ccebcebd6a | |||
8591e9351b | |||
![]() |
ec920251d7 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
||||
*.log
|
||||
*spec-20*
|
||||
*.tar.xz
|
||||
*.bak
|
||||
|
126
LICENSE
126
LICENSE
@ -1,73 +1,119 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
1. Definitions.
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
Preamble
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
|
||||
|
||||
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
4
Makefile
4
Makefile
@ -1,6 +1,6 @@
|
||||
# Makefile for source rpm: e-smith-nutUPS
|
||||
# Makefile for source rpm: smeserver-nutUPS
|
||||
# $Id: Makefile,v 1.1 2016/02/05 22:19:01 stephdl Exp $
|
||||
NAME := e-smith-nutUPS
|
||||
NAME := smeserver-nutUPS
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
|
16
README.md
16
README.md
@ -1,12 +1,20 @@
|
||||
# <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> e-smith-nutUPS
|
||||
# <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> smeserver-nutUPS
|
||||
|
||||
SMEServer Koozali developed git repo for e-smith-nutUPS smeserver
|
||||
SMEServer Koozali developed git repo for smeserver-nutUPS smeserver
|
||||
|
||||
## Wiki
|
||||
<br />https://wiki.koozali.org/
|
||||
|
||||
## Bugzilla
|
||||
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=e-smith-nutUPS&product=SME%20Server%2010.X&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
|
||||
Show list of outstanding bugs:
|
||||
[All](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=NEEDINFO&bug_status=IN_PROGRESS&bug_status=RESOLVED&bug_status=VERIFIED&cf_package=smeserver-nutUPS&classification=SME+Server&list_id=105756&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
|
||||
[Confirmed](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=CONFIRMED&cf_package=smeserver-nutUPS&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
|
||||
[Unconfirmed](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=UNCONFIRMED&cf_package=smeserver-nutUPS&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
|
||||
[Need info](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=NEEDINFO&cf_package=smeserver-nutUPS&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
|
||||
[In progress](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=IN_PROGRESS&cf_package=smeserver-nutUPS&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
|
||||
[Resolved](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=RESOLVED&cf_package=smeserver-nutUPS&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
|
||||
[Verified](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=VERIFIED&cf_package=smeserver-nutUPS&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
|
||||
And a list of outstanding Legacy bugs: (e-smith-nutUPS) [here](https://bugs.koozali.org/buglist.cgi?component=e-smith-nutUPS&product=SME%20Server%2010.X&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
|
||||
|
||||
## Description
|
||||
|
||||
@ -14,4 +22,4 @@ Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?compo
|
||||
*Once it has been checked, then this comment will be deleted*
|
||||
<br />
|
||||
|
||||
e-smith-nutUPS is an open-source software designed to monitor and control an Uninterruptible Power Supply (UPS) device connected to a computer. It offers features such as automatic shutdown of the computer when the UPS battery reaches a critical low-power level, and the capability to remotely monitor and control the UPS from a web browser or from a command line interface. It supports a wide range of UPS devices, and is compatible with most operating systems. With e-smith-nutUPS, users can be assured of reliable and consistent power protection even during power outages.
|
||||
smeserver-nutUPS is an open-source software designed to monitor and control an Uninterruptible Power Supply (UPS) device connected to a computer. It offers features such as automatic shutdown of the computer when the UPS battery reaches a critical low-power level, and the capability to remotely monitor and control the UPS from a web browser or from a command line interface. It supports a wide range of UPS devices, and is compatible with most operating systems. With smeserver-nutUPS, users can be assured of reliable and consistent power protection even during power outages.
|
||||
|
@ -1 +0,0 @@
|
||||
sme10
|
@ -2,7 +2,7 @@
|
||||
|
||||
use esmith::Build::CreateLinks qw(:all);
|
||||
|
||||
my @events = qw(bootstrap-console-save console-save post-install post-upgrade e-smith-nutUPS-update);
|
||||
my @events = qw(bootstrap-console-save console-save post-install post-upgrade smeserver-nutUPS-update);
|
||||
|
||||
templates2events("/etc/sysconfig/ups", @events);
|
||||
templates2events("/usr/lib/systemd/system/nut-server.service.d/50koozali.conf", @events);
|
||||
@ -13,12 +13,12 @@ foreach (qw(ups.conf upsd.users upsmon.conf upssched.conf))
|
||||
templates2events("/etc/ups/$_", @events);
|
||||
}
|
||||
|
||||
foreach (qw(bootstrap-console-save console-save e-smith-nutUPS-update))
|
||||
foreach (qw(bootstrap-console-save console-save smeserver-nutUPS-update))
|
||||
{
|
||||
templates2events("/etc/ups/upsd.conf", $_);
|
||||
}
|
||||
|
||||
my $event="e-smith-nutUPS-update";
|
||||
my $event="smeserver-nutUPS-update";
|
||||
safe_symlink("try-restart", "root/etc/e-smith/events/$event/services2adjust/nut");
|
||||
templates2events("/etc/systemd/system-preset/49-koozali.preset", $event);
|
||||
event_link("systemd-default", $event, "06");
|
||||
|
1
root/etc/e-smith/db/configuration/defaults/nut/MasterUPS
Normal file
1
root/etc/e-smith/db/configuration/defaults/nut/MasterUPS
Normal file
@ -0,0 +1 @@
|
||||
ups@localhost
|
271
root/usr/share/smanager/lib/SrvMngr/Controller/Nutups-Custom.pm
Normal file
271
root/usr/share/smanager/lib/SrvMngr/Controller/Nutups-Custom.pm
Normal file
@ -0,0 +1,271 @@
|
||||
#
|
||||
# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
|
||||
#
|
||||
#
|
||||
# Routines to be edited by the developer to provide content and validation for parameters
|
||||
# and provison of the control data for table(s)
|
||||
#
|
||||
use esmith::util;
|
||||
use esmith::util::network;
|
||||
use esmith::ConfigDB;
|
||||
use esmith::HostsDB;
|
||||
use esmith::AccountsDB;
|
||||
use esmith::NetworksDB;
|
||||
use esmith::DomainsDB;
|
||||
|
||||
use constant FALSE => 0;
|
||||
use constant TRUE => 1;
|
||||
|
||||
|
||||
#The most common ones
|
||||
my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||
#our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||
#our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
||||
#our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
||||
#our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
||||
|
||||
# Validation routines - parameters for each panel
|
||||
|
||||
sub validate_STATUS {
|
||||
my $c = shift;
|
||||
my $prefix_data = shift; #Data hash as parameter
|
||||
# Validation for each field
|
||||
my $ret = "";
|
||||
|
||||
if (! TRUE) #validate $c->param('UPSStatus')
|
||||
{$ret .= 'Validation for UPSStatus failed';}
|
||||
if ($ret eq "") {$ret = 'ok';}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub validate_CONFIG {
|
||||
#return "ok";
|
||||
my $c = shift;
|
||||
my $prefix_data = shift; #Data hash as parameter
|
||||
# Validation for each field
|
||||
my $ret = "";
|
||||
|
||||
if (! TRUE) #validate $c->param('status')
|
||||
{$ret .= 'Validation for status failed';}
|
||||
if (! TRUE) #validate $c->param('Nutmode')
|
||||
{$ret .= 'Validation for Nutmode failed';}
|
||||
if (! TRUE) #validate $c->param('SlaveUPS_Name')
|
||||
{$ret .= 'Validation for SlaveUPS_Name failed';}
|
||||
if (! TRUE) #validate $c->param('MasterUPS_Name')
|
||||
{$ret .= 'Validation for MasterUPS_Name failed';}
|
||||
if (! TRUE) #validate $c->param('UPS_Model')
|
||||
{$ret .= 'Validation for UPS_Model failed';}
|
||||
if (! TRUE) #validate $c->param('UPS_Device')
|
||||
{$ret .= 'Validation for UPS_Device failed';}
|
||||
if (! TRUE) #validate $c->param('UPS_gen_Type')
|
||||
{$ret .= 'Validation for UPS_gen_Type failed';}
|
||||
if (! TRUE) #validate $c->param('UPS_gen_Mfr')
|
||||
{$ret .= 'Validation for UPS_gen_Mfr failed';}
|
||||
if (! TRUE) #validate $c->param('UPS_gen_Model')
|
||||
{$ret .= 'Validation for UPS_gen_Model failed';}
|
||||
if ($ret eq "") {$ret = 'ok';}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
# Get singleton data for each panel
|
||||
|
||||
sub get_data_for_panel_STATUS {
|
||||
# Return a hash with the fields required which will be loaded into the shared data
|
||||
my $c = shift;
|
||||
my %ret = (
|
||||
#'Data1'=>'Data for STATUS', #Example
|
||||
# fields from Inputs in STATUS $fields['STATUS']
|
||||
'UPSStatus'=>$c->get_ups_status(),
|
||||
'ups_data' => $c->get_ups_status_as_hash()
|
||||
);
|
||||
return %ret;
|
||||
}
|
||||
|
||||
sub get_data_for_panel_CONFIG {
|
||||
# Return a hash with the fields required which will be loaded into the shared data
|
||||
my $c = shift;
|
||||
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||
my %ret = (
|
||||
'Data1'=>'Data for CONFIG', #Example
|
||||
# fields from Inputs in CONFIG $fields['CONFIG']
|
||||
'status'=>$cdb->get_prop('nut', 'status', 'disabled'),
|
||||
'Nutmode'=>$cdb->get_prop('nut', 'mode', 'standalone'),
|
||||
'SlaveUPS_Name'=>$cdb->get_prop('nut', 'SlaveUPS', 'ups@IPaddress'),
|
||||
'MasterUPS_Name'=>$cdb->get_prop('nut', 'MasterUPS', 'ups@localhost'),
|
||||
'UPS_Model'=>$cdb->get_prop('nut', 'Model', 'usbhid-ups'),
|
||||
'UPS_Device'=>$cdb->get_prop('nut', 'Device', 'auto'),
|
||||
'UPS_gen_Type'=>$cdb->get_prop('nut', 'Type', ''),
|
||||
'UPS_gen_Mfr'=>$cdb->get_prop('nut', 'mfr', ''),
|
||||
'UPS_gen_Model'=>$cdb->get_prop('nut', 'mdl', ''),
|
||||
);
|
||||
return %ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Get control data for table(s)
|
||||
|
||||
|
||||
|
||||
# Return hash with values from row in which link clicked on table
|
||||
|
||||
sub get_selected_STATUS {
|
||||
my $c = shift;
|
||||
my $selected = shift; #Parameter is name of selected row.
|
||||
my $is_new_record = shift; #Indicates new record required (defaults)
|
||||
my %ret = {};
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub get_selected_CONFIG {
|
||||
my $c = shift;
|
||||
my $selected = shift; #Parameter is name of selected row.
|
||||
my $is_new_record = shift; #Indicates new record required (defaults)
|
||||
my %ret = {};
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
#after sucessful modify or create or whatever and submit then perfom (if the params validate)
|
||||
|
||||
sub perform_STATUS {
|
||||
my $c = shift;
|
||||
my $prefix_data = shift; #Data hash as parameter
|
||||
my $ret = "";
|
||||
my $db = $cdb; #maybe one of the others
|
||||
my $dbkey = 'ChangeThis';
|
||||
# To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
|
||||
|
||||
if (! TRUE) #copy or perform with value: UPSStatus e.g. $db->set_prop($dbkey,'UPSStatus',$c->param('UPSStatus'),type=>'service'))
|
||||
{$ret .= 'Perform/save failed for UPSStatus';}
|
||||
if ($ret eq "") {$ret = 'ok';}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub perform_CONFIG {
|
||||
my $c = shift;
|
||||
my $prefix_data = shift; #Data hash as parameter
|
||||
my $ret = "";
|
||||
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||
my $db = $cdb; #maybe one of the others
|
||||
my $dbkey = 'nut';
|
||||
# To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
|
||||
|
||||
if (!$db->set_prop($dbkey,'status',$c->param('status'),type=>'service'))
|
||||
{$ret .= 'Perform/save failed for status';}
|
||||
if (!$db->set_prop($dbkey,'mode',$c->param('Nutmode'),type=>'service'))
|
||||
{$ret .= 'Perform/save failed for Nutmode';}
|
||||
if (! $db->set_prop($dbkey,'SlaveUPS',$c->param('SlaveUPS_Name'),type=>'service'))
|
||||
{$ret .= 'Perform/save failed for SlaveUPS_Name';}
|
||||
if (! $db->set_prop($dbkey,'MasterUPS',$c->param('MasterUPS_Name'),type=>'service'))
|
||||
{$ret .= 'Perform/save failed for MasterUPS_Name';}
|
||||
if (! $db->set_prop($dbkey,'SlavePass',$c->param('SlaveUPS_Pass'),type=>'service'))
|
||||
{$ret .= 'Perform/save failed for SlaveUPS_Pass';}
|
||||
if (! $db->set_prop($dbkey,'MasterPass',$c->param('MasterUPS_Pass'),type=>'service'))
|
||||
{$ret .= 'Perform/save failed for MasterUPS_Pass';}
|
||||
if (! $db->set_prop($dbkey,'Model',$c->param('UPS_Model'),type=>'service'))
|
||||
{$ret .= 'Perform/save failed for UPS_Model';}
|
||||
if (! $db->set_prop($dbkey,'Device',$c->param('UPS_Device'),type=>'service'))
|
||||
{$ret .= 'Perform/save failed for UPS_Device';}
|
||||
if (! $db->set_prop($dbkey,'Type',$c->param('UPS_gen_Type'),type=>'service'))
|
||||
{$ret .= 'Perform/save failed for UPS_gen_Type';}
|
||||
if (! $db->set_prop($dbkey,'mfr',$c->param('UPS_gen_Mfr'),type=>'service'))
|
||||
{$ret .= 'Perform/save failed for UPS_gen_Mfr';}
|
||||
if (! $db->set_prop($dbkey,'mdl',$c->param('UPS_gen_Model'),type=>'service'))
|
||||
{$ret .= 'Perform/save failed for UPS_gen_Model';}
|
||||
if ($ret eq "") {
|
||||
$ret = 'ok';
|
||||
#and set Master and access properties according to values
|
||||
if ($db->get_prop($dbkey,"mode",'standalone') eq 'netclient'){
|
||||
$db->set_prop($dbkey,'Master','no',type=>'service');
|
||||
} else {
|
||||
$db->set_prop($dbkey,'Master','yes',type=>'service');
|
||||
}
|
||||
if ($db->get_prop($dbkey,"mode",'standalone') eq 'netserver'){
|
||||
$db->set_prop($dbkey,'access','private',type=>'service');
|
||||
} else {
|
||||
$db->set_prop($dbkey,'access','localhost',type=>'service');
|
||||
}
|
||||
#And run signal-event to apply templates for config files and start task.
|
||||
my @result = qx{/usr/sbin/e-smith/signal-event smeserver-nutUPS-update};
|
||||
if ($? != 0) {
|
||||
warn "Error executing signal-event: $!";
|
||||
return "Signal-event Error occurred $!";
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
sub create_link{
|
||||
# WIP
|
||||
my ($c,$route, $panel, $index) = @_;
|
||||
my $link = "$route?trt=$panel&Selected=$index";
|
||||
return $link;
|
||||
}
|
||||
|
||||
sub get_model_options {
|
||||
|
||||
# Execute the RPM command and capture the output
|
||||
my @output = qx{rpm -ql nut | grep /usr/sbin};
|
||||
|
||||
# Check for errors
|
||||
if ($? != 0) {
|
||||
warn "Error executing command: $!";
|
||||
return ['Error occurred'];
|
||||
}
|
||||
|
||||
# Remove "/usr/sbin/" from the front of each line
|
||||
s{^/usr/sbin/}{} for @output;
|
||||
|
||||
# Trim whitespace from each element and return the array
|
||||
chomp(@output); # Remove newline characters from each line
|
||||
return @output; # Return the array of modified output lines
|
||||
}
|
||||
|
||||
sub get_ups_status {
|
||||
my $c = shift;
|
||||
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||
my $nutmode = $cdb->get_prop('nut', 'mode','standalone');
|
||||
if ($cdb->get_prop('nut', 'status', 'disabled') eq 'disabled'){
|
||||
return $c->l('nut_status_is_disabled')
|
||||
} elsif ($nutmode eq 'standalone'){
|
||||
return $c->get_status_from_device($cdb->get_prop('nut','MasterUPS','ups@localhost'));
|
||||
} elsif ($nutmode eq 'netserver'){
|
||||
return $c->get_status_from_device($cdb->get_prop('nut','MasterUPS','ups@localhost'));
|
||||
} else {
|
||||
return $c->get_status_from_device($cdb->get_prop('nut','SlaveUPS','apc@192.168.1.99'));
|
||||
}
|
||||
}
|
||||
|
||||
sub get_ups_status_as_hash {
|
||||
$c = shift;
|
||||
$string = $c->get_ups_status();
|
||||
my %hash;
|
||||
while ($string =~ /^(.+?):\s*(.+)$/mg) {
|
||||
$hash{$1} = $2;
|
||||
}
|
||||
return \%hash
|
||||
}
|
||||
|
||||
sub get_status_from_device {
|
||||
my ($c,$device) = @_;
|
||||
my $command = '/usr/bin/upsc';
|
||||
|
||||
# Check if the file exists and is executable
|
||||
return ["$command Not allowed"] unless (-e $command && -x $command) ;
|
||||
|
||||
$result = qx{$command $device};
|
||||
if ($? != 0) {
|
||||
warn "Error executing $command command: $!";
|
||||
return ["$command $device Error occurred $!"];
|
||||
}
|
||||
chomp($result);
|
||||
$result = $result || 'No results';
|
||||
$result = "Status from $device\n\n".$result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
1;
|
312
root/usr/share/smanager/lib/SrvMngr/Controller/Nutups.pm
Normal file
312
root/usr/share/smanager/lib/SrvMngr/Controller/Nutups.pm
Normal file
@ -0,0 +1,312 @@
|
||||
package SrvMngr::Controller::Nutups;
|
||||
#
|
||||
# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
# heading : System
|
||||
# description : NutUPS configuration
|
||||
# navigation : 4000 700
|
||||
#
|
||||
# name : nutups, method : get, url : /nutups, ctlact : Nutups#main
|
||||
# name : nutupsu, method : post, url : /nutupsu, ctlact : Nutups#do_update
|
||||
# name : nutupsd, method : get, url : /nutupsd, ctlact : Nutups#do_display
|
||||
#
|
||||
# routes : end
|
||||
#
|
||||
# Documentation: https://wiki.contribs.org/Nutups
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# Scheme of things:
|
||||
#
|
||||
# TBA!!
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Mojo::Base 'Mojolicious::Controller';
|
||||
|
||||
use constant FALSE => 0;
|
||||
use constant TRUE => 1;
|
||||
|
||||
use Locale::gettext;
|
||||
use SrvMngr::I18N;
|
||||
use SrvMngr qw(theme_list init_session);
|
||||
|
||||
use Data::Dumper;
|
||||
|
||||
use esmith::util;
|
||||
use esmith::util::network;
|
||||
use esmith::ConfigDB;
|
||||
use esmith::AccountsDB;
|
||||
use esmith::NetworksDB;
|
||||
use esmith::HostsDB;
|
||||
use esmith::DomainsDB;
|
||||
|
||||
|
||||
|
||||
require '/usr/share/smanager/lib/SrvMngr/Controller/Nutups-Custom.pm'; #The code that is to be added by the developer
|
||||
|
||||
sub main {
|
||||
#
|
||||
# Initial entry - route is "/<whatever>"
|
||||
#
|
||||
#set initial panel
|
||||
#for initial panel:
|
||||
#Specifiy panel to enter
|
||||
#load up _data hash with DB fields
|
||||
#load up stash with pointer(s) to control fields hash(= get-))
|
||||
#and a pointer to the prefix_data hash
|
||||
#render initial panel
|
||||
|
||||
my $c = shift;
|
||||
$c->app->log->info( $c->log_req );
|
||||
|
||||
#The most common ones
|
||||
my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||
my $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||
my $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
||||
my $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
||||
my $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
||||
|
||||
my %nut_data = ();
|
||||
my $title = $c->l('nut_NutUPS_configuration');
|
||||
my $modul = '';
|
||||
|
||||
$nut_data{'trt'} = 'STATUS';
|
||||
|
||||
#Load any DB entries into the <prefix>_data area so as they are preset in the form
|
||||
# which DB - this only really works if the initial panel is a PARAMS type panel and not a TABLE
|
||||
my $db = $cdb; #pickup local or global db or Default to config
|
||||
|
||||
|
||||
$c->do_display($nut_data{'trt'});
|
||||
|
||||
}
|
||||
|
||||
# Post request with params - submit from the form
|
||||
sub do_update {
|
||||
#
|
||||
# Return after submit pushed on panel (this is a post) - route is "/<whatever>u"
|
||||
# parameters in the params hash.
|
||||
#
|
||||
#load up all params into prefix_data hash:
|
||||
#By panel (series of if statements - only one executed):
|
||||
#call validate-PANEL() - return ret = ok or error message
|
||||
|
||||
#if validation not ok:
|
||||
#render back to current panel with error message in stash
|
||||
#otherwise:
|
||||
#By panel (series of if statements - only one executed):
|
||||
#do whatever is required: call perform-PANEL() - return "ok" or Error Message
|
||||
#call signal-event for any global actions specified (check it exists - error and continue?)
|
||||
#if action smeserver-<whatever>-update exists
|
||||
#signal_event smeserver-<whatever>-update
|
||||
#call signal-event for any specific actions for thids panel (check it exists first - error and continue)
|
||||
#set success in stash
|
||||
#if no "nextpanel" entry:
|
||||
#set firstpanel
|
||||
#else
|
||||
#set nextpanel
|
||||
#call render
|
||||
|
||||
my $c = shift;
|
||||
$c->app->log->info($c->log_req);
|
||||
my $modul = '';
|
||||
|
||||
#The most common ones - you might want to comment out any not used.
|
||||
my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||
my $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||
my $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
||||
my $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
||||
my $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
||||
|
||||
my %nut_data = ();
|
||||
my $title = $c->l('nut_NutUPS_configuration');
|
||||
|
||||
# Accessing all POST parameters
|
||||
my %params = $c->req->params->to_hash;
|
||||
|
||||
# Get number of POST parameters
|
||||
my $num_params = keys %params;
|
||||
|
||||
#Params are available in the hash "params" - copy to the prefix_data hash
|
||||
#while (my ($key, $value) = each %{$c->req->params->to_hash}) {
|
||||
# $nut_data{$key} = $value;
|
||||
#}
|
||||
|
||||
# the value of trt will tell you which panel has returned
|
||||
my $trt = $c->param('trt') || 'STATUS'; #hidden control on every form.
|
||||
my $ret = 'ok';
|
||||
|
||||
#Validate the parameters in a custom sub one for each panel (although only one of these will be executed)
|
||||
my $thispanel;
|
||||
|
||||
if ($trt eq 'STATUS'){
|
||||
#Validate form parameters for panel STATUS
|
||||
$ret = $c->validate_STATUS(\%nut_data);
|
||||
$thispanel = 'STATUS';
|
||||
}
|
||||
|
||||
if ($trt eq 'CONFIG'){
|
||||
#Validate form parameters for panel CONFIG
|
||||
$ret = $c->validate_CONFIG(\%nut_data);
|
||||
$thispanel = 'CONFIG';
|
||||
}
|
||||
|
||||
if ($ret ne "ok"){
|
||||
$c->warn($ret);
|
||||
$c->do_display($thispanel);
|
||||
} else {
|
||||
#Do whatever is needed, including writing values to the DB
|
||||
|
||||
|
||||
if ($trt eq 'STATUS'){
|
||||
#do whatever is required ...
|
||||
$ret = $c->perform_STATUS(\%nut_data);
|
||||
if ($ret ne "ok") {
|
||||
# return to the panel with error message
|
||||
$c->stash(error => $c->l($ret));
|
||||
$c->stash(
|
||||
title => $title,
|
||||
modul => $modul,
|
||||
nut_data => \%nut_data
|
||||
);
|
||||
$c->render(template => "nutups");
|
||||
} else {
|
||||
$c->stash( success => $c->l('nut_STATUS_panel_action_was_successful')); #A bit bland - edit it in the lex file
|
||||
}
|
||||
}
|
||||
|
||||
if ($trt eq 'CONFIG'){
|
||||
#do whatever is required ...
|
||||
$ret = $c->perform_CONFIG(\%nut_data);
|
||||
if ($ret ne "ok") {
|
||||
# return to the panel with error message
|
||||
$c->stash(error => $c->l($ret));
|
||||
$c->stash(
|
||||
title => $title,
|
||||
modul => $modul,
|
||||
nut_data => \%nut_data
|
||||
);
|
||||
$c->render(template => "nutups");
|
||||
} else {
|
||||
$c->stash( success => $c->l('nut_CONFIG_panel_action_was_successful')); #A bit bland - edit it in the lex file
|
||||
}
|
||||
}
|
||||
|
||||
# and call any signal-events needed
|
||||
#TBD
|
||||
# Setup shared data and call panel
|
||||
if ('none' eq 'none') {
|
||||
$nut_data{'trt'} = 'STATUS';
|
||||
} else {
|
||||
$nut_data{'trt'} = 'none';
|
||||
}
|
||||
$c->do_display($nut_data{'trt'});
|
||||
}
|
||||
}
|
||||
|
||||
sub do_display {
|
||||
#
|
||||
# Return after link clicked in table (this is a get) - route is "/<whatever>d"
|
||||
# Expects ?trt=PANEL&selected="TableRowName" plus any other required
|
||||
#
|
||||
# OR it maybe a post from the main panel to add a new record
|
||||
#
|
||||
#load up all supplied params into prefix_data hash
|
||||
#call get-selected-PANEL() - returns hash of all relevent parameters
|
||||
#load up returned hash into prefix_data
|
||||
#render - to called panel
|
||||
|
||||
my ($c,$trt) = @_;
|
||||
$c->app->log->info($c->log_req);
|
||||
|
||||
#The most common ones - you might want to comment out any not used.
|
||||
my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||
my $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||
my $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
||||
my $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
||||
my $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
||||
|
||||
my %nut_data = ();
|
||||
my $title = $c->l('nut_NutUPS_configuration');
|
||||
my $modul = "";
|
||||
|
||||
# Accessing all parameters
|
||||
#my %params = $c->req->params->to_hash;
|
||||
|
||||
# Get number of parameters
|
||||
#my $num_params = keys %params;
|
||||
|
||||
#Tag as Post or Get (ie. create new entry or edit existing one
|
||||
my $is_new_record = ($c->req->method() eq 'POST');
|
||||
|
||||
#Params are available in the hash "params" - copy to the prefix_data hash
|
||||
#while (my ($key, $value) = each %{$c->req->params->to_hash}) {
|
||||
# $nut_data{$key} = $value;
|
||||
#}
|
||||
|
||||
# the value of trt will tell you which panel has returned
|
||||
if (! $trt){
|
||||
$trt = $c->param('trt') || 'STATUS'; #Indicates where to go now
|
||||
}
|
||||
|
||||
# Now add in the params from the selected row from the table
|
||||
|
||||
my %selectedrow;
|
||||
|
||||
if ($trt eq 'STATUS'){
|
||||
#Validate Get selected row (if applicable) STATUS
|
||||
%selectedrow = $c->get_selected_STATUS($nut_data{'Selected'},$is_new_record);
|
||||
}
|
||||
|
||||
if ($trt eq 'CONFIG'){
|
||||
#Validate Get selected row (if applicable) CONFIG
|
||||
%selectedrow = $c->get_selected_CONFIG($nut_data{'Selected'},$is_new_record);
|
||||
}
|
||||
|
||||
|
||||
#Copy in the selected row params to the prefix_data hash to pass to the panel
|
||||
while (my ($key, $value) = each %selectedrow){
|
||||
$nut_data{$key} = $value;
|
||||
}
|
||||
# Where to go now
|
||||
$nut_data{'trt'} = $trt;
|
||||
|
||||
# Set up other shared data according to the panel to go to
|
||||
|
||||
if ($trt eq 'STATUS'){
|
||||
# pickup any other contents needed and load them into hash shared with panel
|
||||
my %returned_hash;
|
||||
# subroutine returns a hash directly
|
||||
%returned_hash = $c->get_data_for_panel_STATUS();
|
||||
# Copy each key-value pair from the returned hash to the prefix data hash
|
||||
while (my ($key, $value) = each %returned_hash) {
|
||||
$nut_data{$key} = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if ($trt eq 'CONFIG'){
|
||||
# pickup any other contents needed and load them into hash shared with panel
|
||||
my %returned_hash;
|
||||
# subroutine returns a hash directly
|
||||
%returned_hash = $c->get_data_for_panel_CONFIG();
|
||||
# Copy each key-value pair from the returned hash to the prefix data hash
|
||||
while (my ($key, $value) = each %returned_hash) {
|
||||
$nut_data{$key} = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# and table control fields
|
||||
|
||||
|
||||
# Data for panel
|
||||
$c->stash(
|
||||
title => $title,
|
||||
modul => $modul,
|
||||
nut_data => \%nut_data
|
||||
);
|
||||
$c->render(template => "nutups");
|
||||
}
|
||||
1;
|
@ -0,0 +1,30 @@
|
||||
#
|
||||
# Generated by SM2Gen version: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
|
||||
#
|
||||
'nut_UPS_Generic_Model' => 'UPS Generic Model',
|
||||
'nut_UPS_Model' => 'UPS Model',
|
||||
'nut_Manage_Nutups-config_settings:' => 'Manage Nutups-config settings',
|
||||
'nut_Descriptive_paragraph' => 'Descriptive paragraph',
|
||||
'nut_MasterUPS_UPSNAME@IP' => 'UPS name@localhost',
|
||||
'nut_SlaveUPS_UPSNAME@IP' => 'Slave->Master UPSNAME@IP',
|
||||
'nut_MasterUPS_Password' => 'Local server password',
|
||||
'nut_SlaveUPS_Password' => 'Slaves Password ->Server',
|
||||
'nut_Nut_status' => 'Nut status',
|
||||
'nut_Configure_NutUPS' => 'Configure NutUPS',
|
||||
'nut_CONFIG_panel_action_was_successful' => 'CONFIG panel action was successful',
|
||||
'nut_UPS_Generic_Type' => 'UPS Generic Type',
|
||||
'nut_Status_(from_upsc)' => 'Status (from running upsc)',
|
||||
'nut_Error_Status_Report' => 'Error Status Report',
|
||||
'nut_if_Net_Server' => 'Net Server details',
|
||||
'nut_if_genericups' => 'Generic UPS details',
|
||||
'nut_if_Net_Client' => 'Net Client details',
|
||||
'nut_STATUS_panel_action_was_successful' => 'STATUS panel action was successful',
|
||||
'nut_Nut_mode' => 'Nut mode',
|
||||
'nut_Status_Report' => 'Status Report',
|
||||
'nut_NutUPS_configuration' => 'NutUPS configuration',
|
||||
'nut_APPLY' => 'Apply',
|
||||
'nut_UPS_Device' => 'UPS Device',
|
||||
'nut_UPS_Generic_Manufacturer' => 'UPS Generic Manufacturer',
|
||||
'nut_Status_of_the_controlled_UPS' => 'Status of the controlled UPS',
|
||||
'nut_Save' => 'Save',
|
||||
'nut_status_is_disabled' => 'Nut disabled',
|
@ -0,0 +1,44 @@
|
||||
.ups-status-page {
|
||||
font-family: Arial, sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #333;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.ups-status-page h1 {
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
||||
.ups-status-page .grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.ups-status-page .card {
|
||||
background: #f9f9f9;
|
||||
border-radius: 5px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.ups-status-page h2 {
|
||||
color: #3498db;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.ups-status-page table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.ups-status-page td {
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.ups-status-page td:first-child {
|
||||
font-weight: bold;
|
||||
}
|
69
root/usr/share/smanager/themes/default/public/css/nutups.css
Normal file
69
root/usr/share/smanager/themes/default/public/css/nutups.css
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:09:58
|
||||
*/
|
||||
.Nutups-panel {}
|
||||
.name {}
|
||||
.rout {}
|
||||
.grou1 {}
|
||||
.link1 {}
|
||||
.endg1 {}
|
||||
.subh1 {}
|
||||
.para1 {}
|
||||
.text1 {}
|
||||
.name {}
|
||||
.rout {}
|
||||
.subh2 {}
|
||||
.sele1 {}
|
||||
.sele2 {}
|
||||
.grou2 {}
|
||||
.subh3 {}
|
||||
.text3 {}
|
||||
.pass4 {}
|
||||
.endg2 {}
|
||||
.grou3 {}
|
||||
.subh4 {}
|
||||
.text5 {}
|
||||
.pass6 {}
|
||||
.endg3 {}
|
||||
.text7 {}
|
||||
.text8 {}
|
||||
.subh5 {}
|
||||
.text9 {}
|
||||
.text10 {}
|
||||
.text11 {}
|
||||
.subm12 {}
|
||||
.inline-buttons {
|
||||
display: flex; /* Use flexbox to arrange items horizontally */
|
||||
gap: 10px; /* Optional: Add space between buttons */
|
||||
}
|
||||
|
||||
.inline-buttons .link {
|
||||
/* Additional styling can be added here if needed */
|
||||
}
|
||||
|
||||
|
||||
.inline-buttons .link {
|
||||
display: inline-block; /* Keep links as inline-block for button shape */
|
||||
padding: 7px 14px; /* Adjusted padding to approximate 70% of the original */
|
||||
margin: 0; /* Remove margin */
|
||||
background-color: #efefef; /* Light gray background color */
|
||||
color: black; /* Text color */
|
||||
text-decoration: none; /* Remove underline */
|
||||
border: 2px solid #bbb; /* Thin, light gray border */
|
||||
border-radius: 3px; /* Slightly rounded corners */
|
||||
font-size: 11.2px; /* Adjusted font size to approximate 70% of the original */
|
||||
text-align: center; /* Center the text */
|
||||
cursor: pointer; /* Pointer cursor on hover */ }
|
||||
|
||||
/* Hover and active effects for better interaction */
|
||||
.inline-buttons .link:hover {
|
||||
background-color: #d9d9d9; /* Darker shade on hover */
|
||||
}
|
||||
|
||||
.inline-buttons .link:active {
|
||||
background-color: #c0c0c0; /* Even darker shade on click */
|
||||
}
|
||||
|
||||
span .label {
|
||||
padding-top:13em;
|
||||
}
|
28
root/usr/share/smanager/themes/default/public/js/nutups.js
Normal file
28
root/usr/share/smanager/themes/default/public/js/nutups.js
Normal file
@ -0,0 +1,28 @@
|
||||
$(document).ready(function() {
|
||||
function toggleUPSClasses() {
|
||||
var selectedOption = $('#Nutmode_select').val();
|
||||
$('.masterups').toggle(selectedOption === 'netserver' || selectedOption === 'standalone'); // Show/Hide masterups based on Net Server or Standalone
|
||||
$('.slaveups').toggle(selectedOption === 'netclient'); // Show/Hide slaveups based on Net Client
|
||||
|
||||
// Enable/Disable inputs based on the selected option
|
||||
$('.masterups input').prop('disabled', !(selectedOption === 'netserver' || selectedOption === 'standalone'));
|
||||
$('.slaveups input').prop('disabled', selectedOption !== 'netclient');
|
||||
}
|
||||
|
||||
function toggleGenerics() {
|
||||
var upsModelValue = $('#UPS_Model_select').val().toLowerCase(); // Get the current value from UPS_Model
|
||||
var isGenericUps = upsModelValue === 'genericups'; // Check if it's 'genericups'
|
||||
|
||||
// Show/Hide generics section and enable/disable inputs
|
||||
$('.generics').toggle(isGenericUps);
|
||||
$('.generics input').prop('disabled', !isGenericUps); // Enable/Disable inputs based on the value
|
||||
}
|
||||
|
||||
// Event listener for the selections
|
||||
$('#Nutmode_select').change(toggleUPSClasses);
|
||||
$('#UPS_Model_select').change(toggleGenerics); // Listen for changes in the UPS_Model dropdown
|
||||
|
||||
// Set the initial state based on current selections
|
||||
toggleGenerics();
|
||||
toggleUPSClasses();
|
||||
});
|
@ -0,0 +1,60 @@
|
||||
%#
|
||||
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
|
||||
%#
|
||||
% layout 'default', title => "Sme server 2 - NutUPS configuration", share_dir => './';
|
||||
%# css specific to this panel:
|
||||
% content_for 'module' => begin
|
||||
%= stylesheet '/css/nutups.css'
|
||||
%= javascript '/js/nutups.js'
|
||||
<div id="module" class="module Nutups-panel">
|
||||
|
||||
% if (config->{debug} == 1) {
|
||||
<pre>
|
||||
%= dumper $c->current_route
|
||||
%= dumper $nut_data->{trt}
|
||||
</pre>
|
||||
% }
|
||||
|
||||
<h1><%=$title%></h1>
|
||||
|
||||
% if ( stash('modul')) {
|
||||
%= $c->render_to_string(inline => stash('modul') );
|
||||
% }
|
||||
|
||||
%if ($c->stash('first')) {
|
||||
<br><p>
|
||||
%=$c->render_to_string(inline =>$c->l($c->stash('first')))
|
||||
</p>
|
||||
|
||||
%} elsif ($c->stash('success')) {
|
||||
<div class='success '>
|
||||
<h2><%=$c->l('nut_Status_Report') %></h2><p>
|
||||
%= $c->l($c->stash('success'));
|
||||
</p>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
%} elsif ($c->stash('error')) {
|
||||
<div class='sme-error'>
|
||||
<h2><%=$c->l('nut_Error_Status_Report') %></h2><p>
|
||||
%= $c->l($c->stash('error'));
|
||||
</p>
|
||||
</div>
|
||||
<br />
|
||||
%}
|
||||
|
||||
%#Routing to partials according to trt parameter.
|
||||
%#This ought to be cascading if/then/elsif, but is easier to just stack the if/then's rather like a case statement'
|
||||
|
||||
% if ($nut_data->{trt} eq "STATUS") {
|
||||
%= include 'partials/_nut_STATUS'
|
||||
%}
|
||||
|
||||
% if ($nut_data->{trt} eq "CONFIG") {
|
||||
%= include 'partials/_nut_CONFIG'
|
||||
%}
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
%end
|
@ -0,0 +1,124 @@
|
||||
%#
|
||||
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
|
||||
%#
|
||||
<div id="Nutups-CONFIG" class="partial Nutups-CONFIG">
|
||||
<script>
|
||||
window.onload = function() {
|
||||
SelectInput();
|
||||
};
|
||||
</script>
|
||||
% if (config->{debug} == 1) {
|
||||
<pre>
|
||||
%= dumper $nut_data
|
||||
</pre>
|
||||
% }
|
||||
% my $btn = l('nut_APPLY');
|
||||
%= form_for "nutupsu" => (method => 'POST') => begin
|
||||
% param 'trt' => $nut_data->{trt} unless param 'trt';
|
||||
%= hidden_field 'trt' => $nut_data->{trt}
|
||||
%# Inputs etc in here.
|
||||
|
||||
<h2 class='subh2'><%=l('nut_Manage_Nutups-config_settings:')%></h2>
|
||||
|
||||
<p><span class=label>
|
||||
%=l('nut_Nut_status')
|
||||
</span><span class=data>
|
||||
%# my @status_options = [['Disabled' => 'disabled'], ['Enabled' => 'enabled']];
|
||||
%# param 'status' => $nut_data->{status} unless param 'status';
|
||||
|
||||
% my @status_options = selected_field([['Disabled' => 'disabled'], ['Enabled' => 'enabled']], $nut_data->{status});
|
||||
%= select_field 'status' => @status_options, class => 'input', id => 'status_select'
|
||||
<br></span> </p>
|
||||
|
||||
<p><span class=label>
|
||||
%=l('nut_Nut_mode')
|
||||
</span><span class=data>
|
||||
% my @Nutmode_options = [['Standalone' => 'standalone'], ['Net Server' => 'netserver'], ['Net Client ' => 'netclient']];
|
||||
% param 'Nutmode' => $nut_data->{Nutmode} unless param 'Nutmode';
|
||||
%= select_field 'Nutmode' => @Nutmode_options, class => 'input', id => 'Nutmode_select'
|
||||
<br></span> </p>
|
||||
|
||||
<div class=masterups>
|
||||
<h2 class='subh3'><%=l('nut_if_Net_Server')%></h2>
|
||||
|
||||
<p><span class=label>
|
||||
%=l('nut_MasterUPS_UPSNAME@IP')
|
||||
</span><span class=data>
|
||||
% param 'MasterUPS_Name' => $nut_data->{MasterUPS_Name} unless param 'MasterUPS_Name';
|
||||
%= text_field 'MasterUPS_Name', size => '50', class => 'textinput MasterUPS_Name' , pattern=>'.*' , placeholder=>'ups@localhost'
|
||||
<br></span></p>
|
||||
|
||||
<p><span class='label'>
|
||||
%=l('nut_MasterUPS_Password')
|
||||
</span><span class=data>
|
||||
% param 'MasterUPS_Password' => $nut_data->{MasterUPS_Password} unless param 'MasterUPS_Password';
|
||||
%=password_field 'MasterUPS_Password', class => 'pass6 sme-password'
|
||||
</span></p>
|
||||
|
||||
<p><span class=label>
|
||||
%=l('nut_UPS_Model')
|
||||
</span><span class=data>
|
||||
% my @UPS_Model_options = $c->get_model_options();
|
||||
% param 'UPS_Model' => $nut_data->{UPS_Model} unless param 'UPS_Model';
|
||||
%= select_field 'UPS_Model' => \@UPS_Model_options, class => 'input', id => 'UPS_Model_select'
|
||||
<br></span> </p>
|
||||
|
||||
<p><span class=label>
|
||||
%=l('nut_UPS_Device')
|
||||
</span><span class=data>
|
||||
% param 'UPS_Device' => $nut_data->{UPS_Device} unless param 'UPS_Device';
|
||||
%= text_field 'UPS_Device', size => '50', class => 'textinput UPS_Device' , pattern=>'.*' , placeholder=>'auto (for usb)'
|
||||
<br></span></p>
|
||||
</div>
|
||||
|
||||
<div class=slaveups>
|
||||
<h2 class='subh4'><%=l('nut_if_Net_Client')%></h2>
|
||||
<p><span class=label>
|
||||
%=l('nut_SlaveUPS_UPSNAME@IP')
|
||||
</span><span class=data>
|
||||
% param 'SlaveUPS_Name' => $nut_data->{SlaveUPS_Name} unless param 'SlaveUPS_Name';
|
||||
%= text_field 'SlaveUPS_Name', size => '50', class => 'textinput SlaveUPS_Name' , pattern=>'.*' , placeholder=>'upsname@IP'
|
||||
<br></span></p>
|
||||
|
||||
<p><span class='label'>
|
||||
%=l('nut_SlaveUPS_Password')
|
||||
</span><span class=data>
|
||||
% param 'SlaveUPS_Password' => $nut_data->{SlaveUPS_Password} unless param 'SlaveUPS_Password';
|
||||
%=password_field 'SlaveUPS_Password', class => 'pass4 sme-password'
|
||||
</span></p>
|
||||
</div>
|
||||
|
||||
<div class=generics>
|
||||
` <h2 class='subh5'><%=l('nut_if_genericups')%></h2>
|
||||
<p><span class=label>
|
||||
%=l('nut_UPS_Generic_Type')
|
||||
</span><span class=data>
|
||||
% param 'UPS_gen_Type' => $nut_data->{UPS_gen_Type} unless param 'UPS_gen_Type';
|
||||
%= text_field 'UPS_gen_Type', size => '50', class => 'textinput UPS_gen_Type' , pattern=>'.*' , placeholder=>'UPS_gen_Type'
|
||||
<br></span></p>
|
||||
|
||||
<p><span class=label>
|
||||
%=l('nut_UPS_Generic_Manufacturer')
|
||||
</span><span class=data>
|
||||
% param 'UPS_gen_Mfr' => $nut_data->{UPS_gen_Mfr} unless param 'UPS_gen_Mfr';
|
||||
%= text_field 'UPS_gen_Mfr', size => '50', class => 'textinput UPS_gen_Mfr' , pattern=>'.*' , placeholder=>'UPS_gen_Mfr'
|
||||
<br></span></p>
|
||||
|
||||
<p><span class=label>
|
||||
%=l('nut_UPS_Generic_Model')
|
||||
</span><span class=data>
|
||||
% param 'UPS_gen_Model' => $nut_data->{UPS_gen_Model} unless param 'UPS_gen_Model';
|
||||
%= text_field 'UPS_gen_Model', size => '50', class => 'textinput UPS_gen_Model' , pattern=>'.*' , placeholder=>'UPS_gen_Model'
|
||||
<br></span></p>
|
||||
` </div>
|
||||
|
||||
<span class='data'>
|
||||
%= submit_button l('nut_Save'), class => 'action subm12'
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
|
||||
%# Probably finally by a submit.
|
||||
%end
|
||||
</div>
|
@ -0,0 +1,52 @@
|
||||
%#
|
||||
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
|
||||
%#
|
||||
<div id="Nutups-STATUS" class="partial Nutups-STATUS">
|
||||
<script>
|
||||
window.onload = function() {
|
||||
SelectInput();
|
||||
};
|
||||
</script>
|
||||
% if (config->{debug} == 1) {
|
||||
<pre>
|
||||
%= dumper $nut_data
|
||||
</pre>
|
||||
% }
|
||||
% my $btn = l('nut_APPLY');
|
||||
%= form_for "nutupsu" => (method => 'POST') => begin
|
||||
% param 'trt' => $nut_data->{trt} unless param 'trt';
|
||||
%= hidden_field 'trt' => $nut_data->{trt}
|
||||
%# Inputs etc in here.
|
||||
|
||||
<div class=inline-buttons>
|
||||
|
||||
|
||||
<a href='nutupsd?trt=CONFIG' class='link link1'>
|
||||
%= l('nut_Configure_NutUPS')
|
||||
</a>
|
||||
%#= link_to l('nut_Configure_NutUPS'), 'nutupsd?trt=CONFIG' , class=>'link link1'
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<h2 class='subh1'><%=l('nut_Status_of_the_controlled_UPS')%></h2>
|
||||
|
||||
<p class='paragraph para1'>
|
||||
%=l('nut_Descriptive_paragraph')
|
||||
</p>
|
||||
|
||||
<!--
|
||||
<span class=label>
|
||||
%=l('nut_Status_(from_upsc)')
|
||||
</span><span class=data>
|
||||
% param 'UPSStatus' => $nut_data->{UPSStatus} unless param 'UPSStatus';
|
||||
%= text_area 'UPSStatus', cols=>55, rows=>35, Readonly=>'true'
|
||||
</span><br>
|
||||
-->
|
||||
|
||||
%= include 'partials/_nut_UPS_STATUS'
|
||||
|
||||
%# Probably finally by a submit.
|
||||
%end
|
||||
</div>
|
@ -0,0 +1,47 @@
|
||||
<h1>UPS Status</h1>
|
||||
%= stylesheet '/css/nut_ups-status-page.css'
|
||||
<div class="ups-status-page">
|
||||
<div class="grid">
|
||||
<div class="card">
|
||||
<h2>Device Information</h2>
|
||||
<table>
|
||||
<tr><td>Manufacturer:</td><td><%= $nut_data->{'ups_data'}->{'device.mfr'} %></td></tr>
|
||||
<tr><td>Model:</td><td><%= $nut_data->{'ups_data'}->{'device.model'} %></td></tr>
|
||||
<tr><td>Serial:</td><td><%= $nut_data->{'ups_data'}->{'device.serial'} %></td></tr>
|
||||
<tr><td>Type:</td><td><%= $nut_data->{'ups_data'}->{'device.type'} %></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>Battery Status</h2>
|
||||
<table>
|
||||
<tr><td>Charge:</td><td><%= $nut_data->{'ups_data'}->{'battery.charge'} %>%</td></tr>
|
||||
<tr><td>Runtime:</td><td><%= sprintf("%.2f", $nut_data->{'ups_data'}->{'battery.runtime'} / 60) %> minutes</td></tr>
|
||||
<tr><td>Voltage:</td><td><%= $nut_data->{'ups_data'}->{'battery.voltage'} %>V</td></tr>
|
||||
<tr><td>Type:</td><td><%= $nut_data->{'ups_data'}->{'battery.type'} %></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>Input Power</h2>
|
||||
<table>
|
||||
<tr><td>Voltage:</td><td><%= $nut_data->{'ups_data'}->{'input.voltage'} %>V</td></tr>
|
||||
<tr><td>Nominal Voltage:</td><td><%= $nut_data->{'ups_data'}->{'input.voltage.nominal'} %>V</td></tr>
|
||||
<tr><td>Sensitivity:</td><td><%= $nut_data->{'ups_data'}->{'input.sensitivity'} %></td></tr>
|
||||
<tr><td>Transfer High:</td><td><%= $nut_data->{'ups_data'}->{'input.transfer.high'} %>V</td></tr>
|
||||
<tr><td>Transfer Low:</td><td><%= $nut_data->{'ups_data'}->{'input.transfer.low'} %>V</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>UPS Status</h2>
|
||||
<table>
|
||||
<tr><td>Status:</td><td><%= $nut_data->{'ups_data'}->{'ups.status'} %></td></tr>
|
||||
<tr><td>Load:</td><td><%= $nut_data->{'ups_data'}->{'ups.load'} %>%</td></tr>
|
||||
<tr><td>Beeper:</td><td><%= $nut_data->{'ups_data'}->{'ups.beeper.status'} %></td></tr>
|
||||
<tr><td>Firmware:</td><td><%= $nut_data->{'ups_data'}->{'ups.firmware'} %></td></tr>
|
||||
<tr><td>Test Result:</td><td><%= $nut_data->{'ups_data'}->{'ups.test.result'} %></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,10 +1,10 @@
|
||||
# $Id: e-smith-nutUPS.spec,v 1.16 2022/12/26 03:29:15 jpp Exp $
|
||||
|
||||
Summary: SME server - nut UPS interaction module
|
||||
%define name e-smith-nutUPS
|
||||
%define name smeserver-nutUPS
|
||||
Name: %{name}
|
||||
%define version 2.6.0
|
||||
%define release 14
|
||||
%define version 11.0.0
|
||||
%define release 8
|
||||
Version: %{version}
|
||||
Release: %{release}%{?dist}
|
||||
License: GPL
|
||||
@ -12,18 +12,46 @@ Group: Networking/Daemons
|
||||
Source: %{name}-%{version}.tar.xz
|
||||
|
||||
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
|
||||
Requires: nut nut-client daemontools
|
||||
Requires: nut nut-client
|
||||
Obsoletes: neon <= 0.25.5
|
||||
Requires: e-smith-lib >= 1.15.1-16
|
||||
Requires: smeserver-lib >= 1.15.1-16
|
||||
BuildArchitectures: noarch
|
||||
BuildRequires: e-smith-devtools
|
||||
BuildRequires: smeserver-devtools
|
||||
AutoReqProv: no
|
||||
|
||||
Provides: e-smith-nutUPS
|
||||
%description
|
||||
A module which configures the Network UPS Tools suite for operation with
|
||||
the SME server software.
|
||||
|
||||
%changelog
|
||||
* Wed Mar 05 2025 Brian Read <brianr@koozali.org> 11.0.0-8.sme
|
||||
- typo in lex file [SME: 12949]
|
||||
|
||||
* Mon Mar 03 2025 Brian Read <brianr@koozali.org> 11.0.0-7.sme
|
||||
- Enhance UPS Status screen [SME: i12949]
|
||||
|
||||
* Mon Mar 03 2025 Brian Read <brianr@koozali.org> 11.0.0-6.sme
|
||||
- Add in SM2 NutUPS configuration and status panel [SME: 12949]
|
||||
|
||||
* Wed Jan 15 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-5.sme
|
||||
- remove Requires daemontools [SME: 12566]
|
||||
|
||||
* Thu Apr 04 2024 Brian Read <brianr@koozali.org> 11.0.0-4.sme
|
||||
- Update createlinks to create smeserver-package-update event[SME: 12579]
|
||||
|
||||
* Thu Apr 04 2024 Brian Read <brianr@koozali.org> 11.0.0-3.sme
|
||||
- Set license file to GPL2.0 [SME: 12577]
|
||||
|
||||
* Sat Mar 23 2024 Brian Read <brianr@koozali.org>11.0.0-2.sme
|
||||
- Change Requires: e-smith- to Requires:smeserver-
|
||||
|
||||
* Sat Mar 23 2024 Brian Read <brianr@koozali.org>11.0.0-1.sme
|
||||
- Update Release and Version to base version and 1st release for SME11 [SME: 12518]
|
||||
|
||||
* Mon Mar 11 2024 rename-e-smith-pkg.sh by Trevor Batley <trevor@batley.id.au> 2.6.0-15.sme
|
||||
- Rename to smeserver-nutUPS [SME: 12359]
|
||||
|
||||
* Wed Jul 12 2023 cvs2git.sh aka Brian Read <brianr@koozali.org> 2.6.0-14.sme
|
||||
- Roll up patches and move to git repo [SME: 12338]
|
||||
|
Loading…
x
Reference in New Issue
Block a user