diff --git a/LICENSE b/LICENSE
index 4b70b42..0c1e457 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,10 +1,3 @@
-Femtofox is comprised of two projects, with two different licenses:
-1. Femtofox - the hardware, which is licensed "CC BY-NC-ND - noncommercial". Summary: you may copy and share and modify the hardware files, but cannot sell them without license from Femtofox, and must give attribution to Femtofox.
-2. Foxbuntu - refers to the modifications to Ubuntu made as part of the Femtofox project, which is licensed GNU GPLv3. Summary: you may use, modify and distribute (including for commercial purposes) Foxbuntu, but must give attribution to Femtofox and distribute this license with your project. Any modified version must remain open source.
-
-See below for the full license texts.
-
- Hardware (Femtofox) license:
Summary:
Attribution — You must give appropriate credit , provide a link to the license, and indicate if changes were made . You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
NonCommercial — You may not use the material for commercial purposes .
@@ -415,681 +408,3 @@ the avoidance of doubt, this paragraph does not form part of the
public licenses.
Creative Commons may be contacted at creativecommons.org.
-
-
-
- Software (Foxbuntu) license:
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- 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
-them 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.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. 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.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey 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;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If 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 convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU 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 that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- 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.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-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.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- 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.
-
- 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
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- 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 3 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, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program 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, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/README.md b/README.md
index 5835d9f..4a61dd0 100644
--- a/README.md
+++ b/README.md
@@ -1,74 +1,82 @@
-
-
# Femtofox The tiny, low power Linux Meshtastic node
-### [Click here for the Femtofox store](https://www.etsy.com/listing/1861858340/femtofox-pro-v1-kit-compact-arm-linux)
-
**Femtofox is a Linux-based mesh development platform - a Raspberry Pi sized computer with onboard LoRa radio, capable of being run with only 0.3w, making it *ideal* for solar powered nodes.**
-The Luckfox Pico Mini is the postage stamp sized heart of the Femtofox - a compact and power efficient Linux board, running Foxbuntu, our own customized version of Ubuntu. Femtofox is an expansion of the Luckfox's capabilities, utilizing a custom PCB with a 30db LoRa radio (over 6x the transmit power of a RAK Wisblock or Heltec V3) to create a power efficient, tiny and highly capable Meshtastic Linux node.
+The Luckfox Pico Mini is the postage stamp sized heart of the Femtofox - a compact and power efficient Linux board, running a customized version of Ubuntu. Femtofox is an expansion of the Luckfox's capabilities, utilizing a custom PCB with a 30db LoRa radio (over 6x the transmit power of a RAK Wisblock or Heltec V3) to create a power efficient, tiny and highly capable Meshtastic Linux node.
-Find out more in the sections below, or in the [Wiki](https://github.com/femtofox/femtofox/wiki).
-
-- [Features](#features) and [Specifications](#Specification)
-- [Supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware)
-- [Installation guide](https://github.com/femtofox/femtofox/wiki/Getting-Started)
-- How to order
- - [Etsy (USA)](https://www.etsy.com/listing/1861858340/femtofox-pro-v1-kit-compact-arm-linux)
- - [Tindie (UK)](https://www.tindie.com/products/nomdetom/femtofox-pro-v1-kit-linux-meshtastic-node/)
- - [Etsy (UK)](https://www.etsy.com/uk/listing/1866094154/femtofox-pro-v1-kit-linux-meshtastic)
-- [DIY instructions](https://github.com/femtofox/Femtofox_Community_Hardware)
-- [USB configuration tool](https://github.com/femtofox/femtofox/wiki/USB-Configuration-Tool)
-- [Building your own Foxbuntu image](https://github.com/femtofox/femtofox/wiki/Building-Foxbuntu-%28WSL%29)
+- [Features](#features)
+- Specifications - coming soon
+- [Supported hardware](./supported_hardware.md)
+- [Installation guide](./foxbuntu_install.md)
+- How to order - coming soon
+- DIY instructions - coming soon
+- [Networking](#networking)
+- [USB configuration tool](./usb_config.md)
### Features
-* Tiny size (63x54mm for Femtofox, 65x30mm for the Smol Edition). Equivalent to a standard Raspberry Pi hat and Pi Zero respectively.
-* Power efficient (~0.27-0.4w average, depending on radio and mesh congestion)
+* Tiny size (63x54mm for the Kitchen Sink Edition, 65x30mm for the Smol Edition). Roughly equivalent to a standard Raspberry Pi hat and Pi Zero respectively.
+* Power efficiency (~0.27-0.4w average, depending on radio and mesh congestion)
* Full Linux CLI (Ubuntu) via our pre-built Foxbuntu image
* Meshtastic native client support via SPI
-* USB host support - attach USB peripherals
-* USB wifi support
-* RTC support for timekeeping
-
-### Specification
-
-| Feature | Specification |
-| ------------ | ------------------------------------------------------- |
-| Processor | Rockchip RV1103, Cortex A7 \@1.1GHz |
-| Memory | 64MB DDR2 |
-| OS | Foxbuntu (based on Ubuntu 22.04.5 LTS Jammy) |
-| Connectivity | USB 2.0 Host/Device |
-| Network | RJ45 Ethernet with filtering |
-| | WiFi ready |
-| GPIO | 17x GPIO pins (of which 8 are required for Lora module) |
-| IO | 2x I2C JST PH |
-| | 1x UART JST PH |
-| Debug | 1x CH340 USB to serial adapter (Pro only) |
-| Mesh | 30dB LoRa Radio 868-915MHz |
-| Storage | Micro-SD slot |
-| Power | 3.3-5V.dc via JST PH or USB-C |
-| Dimensions | 63 x 54 x 19mm |
+* USB host support - attach USB peripherals (see [supported hardware](supported_hardware.md))
+* USB wifi support (see [supported hardware](supported_hardware.md))
+* RTC support for timekeeping (see [supported hardware](supported_hardware.md))
**Accomplished:**
-- [x] Meshtastic native client controlling a LoRa radio (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware))
-- [x] WIFI over USB (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware))
+- [x] Meshtastic native client controlling a LoRa radio (see [supported hardware](supported_hardware.md))
+- [x] WIFI over USB (see [supported hardware](supported_hardware.md))
+- [x] Ethernet over USB (see [supported hardware](supported_hardware.md))
- [x] Ethernet over pins (see *Networking* below and wiring diagram at bottom of page)
- [x] UART communications with Meshtastic nodes (2 pin pairs) such as RAK Wisblock
-- [x] USB serial communications with Meshtastic nodes (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware))
+- [x] USB serial communications with Meshtastic nodes (see [supported hardware](supported_hardware.md))
- [x] USB mass storage
-- [x] Real time clock (RTC) support (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware))
+- [x] Real time clock (RTC) support (see [supported hardware](supported_hardware.md))
- [x] Activity LED disabled. User LED will blink for 5 seconds when boot is complete
- [x] Short pressing the "BOOT" button toggles wifi, 2-5 second press triggers reboot, 5+ second press shuts system down
- [x] Ability to reconfigure wifi via USB flash drive
- [x] Meshtasticd to run LoRa radio over SPI (accomplished, updated image and instructions coming soon)
- [x] Allow editing of config files by plugging in thumb drive
- [x] Ability to activate or deactivate WIFI via Meshtastic admin
-
+
+The preconfigured images will reboot every 24 hours. If the internal clock is accurate, this will be at 3am. Reboot timing is set in `crontab`. To keep accurate time, an RTC module can be installed (see [supported hardware](supported_hardware.md)) or internet connectivity can be utilized for NTP via [Chrony](https://chrony-project.org/).
+
+### [Supported hardware - click here](supported_hardware.md)
+
+### Networking
+There are four methods to get online:
+1. Ethernet over USB - most adapters should be supported, but I've only tested the RTL8152 chipset.
+2. USB wifi (see [supported hardware](supported_hardware.md)).
+3. Preconfigured Ubuntu images: ethernet via the castellated pins at the bottom of the board. See pinout at the bottom of this readme.
+4. RDNIS via usb - [see this guide](https://web.archive.org/web/20241006173648/https://wiki.luckfox.com/Luckfox-Pico/Luckfox-Pico-Network-Sharing-1/). Note that in the preconfigured images USB is set to host mode, so you'll have to switch back to peripheral with `sudo luckfox-config`. This is not really recommended, but can be used in a pinch.
+
+### [Installation guide](foxbuntu_install.md)
+
+### Pinout:
+|Pin #|Pin ID |Function |Luckfox |Pin #|Pin ID |Function |
+|-----|-------|--------------|--------|-----|-------|--------------|
+|1 |VBus |5V in/out | |22 |1V8 |1.8V out |
+|2 |GND | | |21 |GND | |
+|3 |3V3 |3.3V out | |20 |4C1 |1v8 IO, SARADC|
+|4/42 |1B2 |Debug UART2-TX| |19 |4C0 |1v8 IO, SARADC|
+|5/43 |1B3 |Debug UART2-RX| |18/4 |0A4 |3v3 IO |
+|6/48 |1C0 |CS0, IO | |17/55|1C7 |IRQ, IO |
+|7/49 |1C1 |CLK, IO | |16/54|1C6 |BUSY, IO |
+|8/50 |1C2 |MOSI, IO | |15/59|1D3 |i2c SCL |
+|9/51 |1C3 |MISO, IO | |14/58|1D2 |i2c SDA |
+|10/52|1C4 |UART4-TX | |13/57|1D1 |UART3-RX, NRST|
+|11/53|1C5 |UART4-RX | |12/56|1D0 |UART3-TX, RXEN|
+
+Pin ID explanation: **1C6** = GPIO bank **1**, group **C**, pin **6**.
+In Meshtasticd's config.yaml we use GPIO bank 1, and subtract 32 from the pin number.
+
+
+
+
> [!NOTE]
> The information on this page is given without warranty or guarantee. Links to vendors of products are for informational purposes only.
> Meshtastic® is a registered trademark of Meshtastic LLC. Meshtastic software components are released under various licenses, see GitHub for details. No warranty is provided - use at your own risk.
diff --git a/assets/femtofox-config.txt b/assets/femtofox-config.txt
index 6b337b4..401ad63 100644
--- a/assets/femtofox-config.txt
+++ b/assets/femtofox-config.txt
@@ -1,66 +1,46 @@
## femtofox-config.txt
-## Help: https://github.com/femtofox/femtofox/blob/main/usb_config.md
+## Help: https://github.com/noon92/femtofox/usbconfig.md
## To set a setting, uncomment a line by removing its preceeding `#`
## All settings are optional - remove any you don't want to set.
### Foxbuntu settings
+## Localization settings. CaSe SeNsItIvE
+## List of timezones: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
+#wifi_country="US"
+#timezone="UTC"
+
## Wifi settings / wpa_supplicant. CaSe SeNsItIvE
#wifi_ssid="wifi network name"
#wifi_psk="password"
-#wifi_country="US"
-## Localization settings. CaSe SeNsItIvE
-## List of timezones: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
-#timezone="UTC"
-
-## Activity LED setting. CaSe SeNsItIvE
-## Options are "enable" and "disable"
-#act_led="disable"
-
-### Software installation
-## Software package names are filenames (without .sh suffix) in /usr/local/bin/packages
-## Multiple packages can be installed by separating them with commas
-#software_install="packageA,packageB"
### Meshtastic settings
-## Multiple meshtastic_cli lines can be added. This is important, as the Meshtastic CLI requires that different settings categories (such as device and lora) be handled in separate commands.
-## See Meshtastic CLI docs (https://meshtastic.org/docs/software/python/cli/) for more information.
-#meshtastic_cli="--set lora.modem_preset LONG_FAST"
-#meshtastic_cli="--set device.role CLIENT"
-
## Radio module to use. Options are:
-## "ebyte-e22-900m30s"
-## "ebyte-e22-900m22s"
-## "ebyte-e80-900m22s" (experimental)
-## "heltec-ht-ra62"
-## "seeed-wio-sx1262"
-## "waveshare-sx126x-xxxm"
-## "ai-thinker-ra-01sh"
-## "sx1262_tcxo" (for Ebyte E22-900M30SM, Ebyte E22-900M22S, Heltec HT-RA62, Seeed Wio SX1262)
-## "sx1262_xtal" (for AiThinker RA01SH, and Waveshare Pi hat)
-## "lr1121_tcxo" (experimental, for Ebyte E80-900M2213S)
-## "none" (for simulated radio)
+## `ebyte-e22-900m30s`
+## `ebyte-e22-900m22s`
+## `ebyte-e80-900m22s` (experimental)
+## `heltec-ht-ra62`
+## `seeed-wio-sx1262`
+## `waveshare-sx126x-xxxm`
+## `ai-thinker-ra-01sh`
+## `sx1262_tcxo` (for Ebyte E22-900M30SM, Ebyte E22-900M22S, Heltec HT-RA62, Seeed Wio SX1262)
+## `sx1262_xtal` (for AiThinker RA01SH, and Waveshare Pi hat)
+## `lr1121_tcxo` (experimental, for Ebyte E80-900M2213S)
+## `none` (for simulated radio)
#meshtastic_lora_radio="radio_name"
## URL from Meshtastic QR code to configure channels
-#meshtastic_url="https://meshtastic.org/e/XX..."
+#meshtastic_url="https://meshtastic.org/e/..."
## Meshtastic security settings. CaSe SeNsItIvE
-#meshtastic_public_key="XX="
-#meshtastic_private_key="XX="
-
## The admin key list can contain up to three keys - if more are added they will be ignored.
## The USB configuration tool supports clearing the admin key list, after which you will need to re-add your admin key/s in a second operation.
## To clear the admin key list, enter `meshtastic_admin_key="clear"`
#meshtastic_admin_key="XX="
#meshtastic_legacy_admin="false"
-## Meshtastic i2c state.
-## Enabling i2c without devices connected will lead to slowdowns and error messages.
-## Options are "enable" and "disable"
-meshtastic_i2c="disable"
### If the following line is uncommented, USB config will be skipped if a log file is present on the USB drive, indicating the tool has already been run on this system
#dont_run_if_log_exists
diff --git a/assets/images/leds.png b/assets/images/leds.png
index 0decc30..a81a087 100644
Binary files a/assets/images/leds.png and b/assets/images/leds.png differ
diff --git a/environment-setup/Foxbuntu SDK.pdf b/environment-setup/Foxbuntu SDK.pdf
deleted file mode 100644
index bbdea6c..0000000
Binary files a/environment-setup/Foxbuntu SDK.pdf and /dev/null differ
diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot
index e7beee5..6168a8c 100644
--- a/environment-setup/femtofox.chroot
+++ b/environment-setup/femtofox.chroot
@@ -9,74 +9,51 @@ echo "tmpfs /run tmpfs rw,nodev,nosuid,size=32M 0 0" | tee -a /etc/fstab
#echo "deb [arch=all signed-by=/etc/apt/keyrings/meshtastic-deb.asc] https://meshtastic.github.io/deb stable main" | tee /etc/apt/sources.list.d/meshtastic-deb.list >/dev/null
echo "Removing netdevice rules..."
+
ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
echo "Setting up kernel modules..."
+
touch /lib/modules/5.10.160/modules.order
touch /lib/modules/5.10.160/modules.builtin
depmod -a 5.10.160
if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi
echo "Setting localtime to UTC..."
+
rm /etc/localtime
ln -sf /usr/share/zoneinfo/UTC /etc/localtime
echo "Installing packages..."
+
apt update
-DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" linux-firmware wireless-tools git python3.10-venv libgpiod-dev libyaml-cpp-dev libbluetooth-dev openssl libssl-dev libulfius-dev liborcania-dev evtest screen avahi-daemon protobuf-compiler telnet fonts-noto-color-emoji ninja-build chrony qrencode software-properties-common python-is-python3 python3.10-venv lsof spi-tools python3-luma.oled samba vim mtd-utils jq rsync
+DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" linux-firmware wireless-tools git python3.10-venv libgpiod-dev libyaml-cpp-dev libbluetooth-dev openssl libssl-dev libulfius-dev liborcania-dev evtest screen avahi-daemon protobuf-compiler telnet fonts-noto-color-emoji ninja-build chrony qrencode software-properties-common python-is-python3 python3.10-venv lsof spi-tools python3-luma.oled
if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi
DEBIAN_FRONTEND=noninteractive apt upgrade -y --option Dpkg::Options::="--force-confold"
-# requires software-properties-common, so must be done in a separate command unless added manually
-echo "Adding Meshtastic repository and installing meshtastic..."
-add-apt-repository -y ppa:meshtastic/beta
-DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" meshtasticd
-
# Tempfix for SEGFAULT
-#wget https://github.com/meshtastic/firmware/releases/download/v2.5.11.8e2a3e5/meshtasticd_2.5.11.8e2a3e5_armhf.deb
-#DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" ./meshtasticd_2.5.11.8e2a3e5_armhf.deb
-#rm ./meshtasticd_2.5.11.8e2a3e5_armhf.deb
+wget https://github.com/meshtastic/firmware/releases/download/v2.5.11.8e2a3e5/meshtasticd_2.5.11.8e2a3e5_armhf.deb
+DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" ./meshtasticd_2.5.11.8e2a3e5_armhf.deb
+rm ./meshtasticd_2.5.11.8e2a3e5_armhf.deb
echo "Installing dependencies for meshing-around and meshtastic cli..."
#pip config set global.extra-index-url https://www.piwheels.org/simple
-pip3 install requests pyephem pytap2 meshtastic pypubsub geopy maidenhead beautifulsoup4 dadjokes schedule wikipedia googlesearch-python pubsub datetime
-
+pip3 install requests pyephem pytap2 meshtastic pypubsub geopy maidenhead beautifulsoup4 dadjokes schedule wikipedia googlesearch-python
if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi
-echo "Downloading ttyd and enabling service..."
-wget -qO- https://api.github.com/repos/tsl0922/ttyd/releases/latest | grep "browser_download_url" | grep "armhf" | cut -d '"' -f 4 | xargs wget -O /opt/ttyd/ttyd
-chmod +x /opt/ttyd/ttyd
-systemctl enable ttyd
-
-echo "Cloning Control for Meshtastic by pdxlocations"
-git clone https://github.com/pdxlocations/control.git /opt/control
-pip install -r /opt/control/requirements.txt
-chown -R femto /opt/control
-git config --global --add safe.directory /opt/control # prevents git error when updating
-
echo "Setting MOTD..."
+
mv /etc/update-motd.d/10-help-text /etc/update-motd.d/10-help-text.bak
mv /etc/update-motd.d/60-unminimize /etc/update-motd.d/60-unminimize.bak
echo "Setting hostname to femtofox..."
+
echo "femtofox" | tee /etc/hostname > /dev/null
echo "Configuring autostart of systemd services..."
-systemctl enable button
-systemctl enable femto-runonce.service
-systemctl enable femto-usb-config-tool.service
-systemctl enable femto-boot-complete.service
-systemctl enable femto-wifi-mesh-control
-systemctl enable femto-watchclock-dog
-systemctl disable ttyd # enabled on first boot
-systemctl disable meshtasticd # enabled on first boot
-systemctl disable apt-daily.timer
-systemctl disable apt-daily-upgrade.timer
-systemctl mask apt-daily.service # try prevent daily updates
-systemctl mask apt-daily-upgrade.service # try prevent daily updates
-systemctl disable unattended-upgrades
-systemctl disable smbd nmbd # samba services, can be enabled via menu
+systemctl enable button
+systemctl enable wifi-mesh-control
systemctl disable NetworkManager
systemctl disable NetworkManager-dispatcher
systemctl disable NetworkManager-wait-online
@@ -95,6 +72,7 @@ systemctl disable veritysetup.target
systemctl disable systemd-pstore.service
echo "Adding femto and pico users/groups..."
+
groupmod -n femto pico
usermod -l femto pico
usermod -aG sudo,input femto
@@ -102,6 +80,7 @@ echo "femto ALL=(ALL:ALL) ALL" | tee /etc/sudoers.d/femto > /dev/null
chmod 440 /etc/sudoers.d/femto
# this seems messy, user:group should be set cleanly and not corrected after? OSC: somethings were owned my pico from factory
+
find / -group pico -exec chgrp femto {} \; 2>/dev/null
find / -user pico -exec chown femto {} \; 2>/dev/null
usermod -d /home/femto -m femto
@@ -111,20 +90,7 @@ sudo chage -d 0 femto
usermod -a -G tty femto
usermod -a -G dialout femto
-# Ensure libgcc_s.so and libc_nonshared.a exist
-mkdir -p /usr/lib/gcc/arm-linux-gnueabihf/11/
-ln -sf /usr/lib/arm-linux-gnueabihf/libgcc_s.so.1 /usr/lib/gcc/arm-linux-gnueabihf/11/libgcc_s.so
-ln -sf /usr/lib/arm-linux-gnueabihf/libgcc_s.so.1 /lib/libgcc_s.so.1
-ln -sf /usr/lib/gcc/arm-linux-gnueabihf/11/libgcc_s.so /usr/lib/libgcc.so
-
-# Add library paths
-echo "/usr/lib/gcc/arm-linux-gnueabihf/11" | tee -a /etc/ld.so.conf.d/gcc.conf
-ldconfig
-
-# Back up libc_nonshared.a because build.sh removes it
-cp /usr/lib/arm-linux-gnueabihf/libc_nonshared.a /usr/lib/arm-linux-gnueabihf/libc_nonshared.a.keep
-
echo "Cleaning up chroot..."
-rm -rf /tmp/* && rm -rf /var/tmp/* && find /var/log -type f -exec truncate -s 0 {} + && : > /root/.bash_history && history -c
+apt clean && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* && rm -rf /var/tmp/* && find /var/log -type f -exec truncate -s 0 {} + && : > /root/.bash_history && history -c
exit
diff --git a/environment-setup/foxbuntu-builder.sh b/environment-setup/foxbuntu-builder.sh
index 136b3c0..0843777 100644
--- a/environment-setup/foxbuntu-builder.sh
+++ b/environment-setup/foxbuntu-builder.sh
@@ -12,11 +12,15 @@ if [[ $(id -u) != 0 ]]; then
exit 1
fi
-[ -f /etc/os-release ] && . /etc/os-release
-
-if [ "$VERSION_ID" != "22.04" ] || [ "$NAME" != "Ubuntu" ]; then
- echo -e "This script is intended for Ubuntu 22.04, your operating system is not supported (but may work).\nPress Ctrl+C to cancel, or Enter to continue."
- read
+if [ -f /etc/os-release ]; then
+ . /etc/os-release
+ if [ "$VERSION_ID" != "22.04" ] || [ "$NAME" != "Ubuntu" ]; then
+ echo "This script is intended for Ubuntu 22.04, exiting..."
+ exit 1
+ fi
+else
+ echo "This script is intended for Ubuntu 22.04, exiting..."
+ exit 1
fi
sudoer=$(echo $SUDO_USER)
@@ -57,9 +61,8 @@ clone_repos() {
fi
}
- #clone_with_retries "https://github.com/LuckfoxTECH/luckfox-pico.git" || return 1
- clone_with_retries "https://github.com/Ruledo/luckfox-pico.git" || return 1
- clone_with_retries "https://github.com/femtofox/femtofox.git" || return 1
+ clone_with_retries "https://github.com/LuckfoxTECH/luckfox-pico.git" || return 1
+ clone_with_retries "https://github.com/noon92/femtofox.git" || return 1
return 0
}
diff --git a/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local b/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local
index 33b65da..56ca196 100755
--- a/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local
+++ b/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local
@@ -4,11 +4,11 @@
#/etc/init.d/S50usbdevice start
#run only on first boot
-#if [ -e "/etc/.firstboot" ]; then
-# /usr/local/bin/femto-runonce.sh
-#fi
+if [ -e "/etc/.firstboot" ]; then
+ /usr/local/bin/femto-runonce.sh
+fi
-#luckfox-config load
+luckfox-config load
# try enable RTC
echo 'ds1307 0x68' | sudo tee /sys/class/i2c-adapter/i2c-3/new_device > /dev/null 2>&1
@@ -23,21 +23,21 @@ echo 34 > /sys/class/gpio/export && echo out > /sys/class/gpio/gpio34/direction
#(sleep 5 && cpufreq-set -u 408000 && echo "Boot complete, setting CPU frequency to 408mhz.") &
# run USB automount and config tool
-#/usr/local/bin/femto-usb-config-tool.sh
+/usr/local/bin/femto-usb-config-tool.sh
# boot complete
-#(
-# echo "Disabling ACT LED..."
-# echo "none" > /sys/class/leds/work/trigger &
-# sleep 1
-#
-# # blink successful boot code
-# for i in $(seq 1 5); do
-# echo 1 > /sys/class/gpio/gpio34/value;
-# sleep 0.5;
-# echo 0 > /sys/class/gpio/gpio34/value;
-# sleep 0.5;
-# done
-#) &
+(
+ echo "Disabling ACT LED..."
+ echo "none" > /sys/class/leds/work/trigger &
+ sleep 1
+
+ # blink successful boot code
+ for i in $(seq 1 5); do
+ echo 1 > /sys/class/gpio/gpio34/value;
+ sleep 0.5;
+ echo 0 > /sys/class/gpio/gpio34/value;
+ sleep 0.5;
+ done
+) &
exit 0
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/.firstboot b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/.firstboot
new file mode 100644
index 0000000..e60fd6a
--- /dev/null
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/.firstboot
@@ -0,0 +1 @@
+# File to tell rc.local that this is the first boot. Will be deleted automatically.
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/apt/apt.conf.d/20auto-upgrades b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/apt/apt.conf.d/20auto-upgrades
deleted file mode 100644
index 42589c7..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/apt/apt.conf.d/20auto-upgrades
+++ /dev/null
@@ -1,2 +0,0 @@
-APT::Periodic::Update-Package-Lists "0";
-APT::Periodic::Unattended-Upgrade "0";
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/femto.conf b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/femto.conf
deleted file mode 100644
index 6309017..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/femto.conf
+++ /dev/null
@@ -1 +0,0 @@
-act_led=enable
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release
index 3f697f5..dfde80b 100644
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release
@@ -1,5 +1,5 @@
-major=1
-minor=0
+major=0
+minor=97
patch=0
hotfix=
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_config.yaml b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_config.yaml
deleted file mode 100644
index a561d91..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_config.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-# this sets the mac address source to eth0, replacing the previous code that derived a seed from the CPU s/n.
-# of course, eth0 also has its mac address derived from CPU s/n, but this way meshtastic uses the exact mac address, instead of a bastardized version converted to a 9 digit int with `| bc | tail -c -9`.
-General:
- MACAddressSource: eth0
-
-# this activates the webserver
-Webserver:
- Port: 443 # Port for Webserver & Webservices
- RootPath: /usr/share/meshtasticd/web # Root Dir of WebServer
- SSLKey: /etc/meshtasticd/ssl/private_key.pem # Path to SSL Key, generated if>
- SSLCert: /etc/meshtasticd/ssl/certificate.pem # Pa
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.yaml.bak b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.yaml
similarity index 100%
rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.yaml.bak
rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.yaml
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces
index bfde602..315112b 100644
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces
@@ -8,13 +8,4 @@ iface lo inet loopback
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
- metric 100
- post-up sleep 5 && dhclient wlan0
- pre-down ip route del default via $(ip route | awk '/default/ {print $3}') dev wlan0 metric 100
-
-allow-hotplug eth0
-iface eth0 inet dhcp
- metric 10
- post-up ip route replace default via $(ip route | awk '/default/ {print $3}') dev eth0 metric 10
- pre-down ip route del default via $(ip route | awk '/default/ {print $3}') dev eth0 metric 10
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/samba/smb.conf b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/samba/smb.conf
deleted file mode 100644
index 4fa791a..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/samba/smb.conf
+++ /dev/null
@@ -1,253 +0,0 @@
-#
-# Sample configuration file for the Samba suite for Debian GNU/Linux.
-#
-#
-# This is the main Samba configuration file. You should read the
-# smb.conf(5) manual page in order to understand the options listed
-# here. Samba has a huge number of configurable options most of which
-# are not shown in this example
-#
-# Some options that are often worth tuning have been included as
-# commented-out examples in this file.
-# - When such options are commented with ";", the proposed setting
-# differs from the default Samba behaviour
-# - When commented with "#", the proposed setting is the default
-# behaviour of Samba but the option is considered important
-# enough to be mentioned here
-#
-# NOTE: Whenever you modify this file you should run the command
-# "testparm" to check that you have not made any basic syntactic
-# errors.
-
-#======================= Global Settings =======================
-
-[global]
-
-## Browsing/Identification ###
-
-# Change this to the workgroup/NT-domain name your Samba server will part of
- workgroup = WORKGROUP
-
-# server string is the equivalent of the NT Description field
- server string = %h server (Samba, Ubuntu)
-
-#### Networking ####
-
-# The specific set of interfaces / networks to bind to
-# This can be either the interface name or an IP address/netmask;
-# interface names are normally preferred
-; interfaces = 127.0.0.0/8 eth0
-
-# Only bind to the named interfaces and/or networks; you must use the
-# 'interfaces' option above to use this.
-# It is recommended that you enable this feature if your Samba machine is
-# not protected by a firewall or is a firewall itself. However, this
-# option cannot handle dynamic or non-broadcast interfaces correctly.
-; bind interfaces only = yes
-
-
-
-#### Debugging/Accounting ####
-
-# This tells Samba to use a separate log file for each machine
-# that connects
- log file = /var/log/samba/log.%m
-
-# Cap the size of the individual log files (in KiB).
- max log size = 1000
-
-# We want Samba to only log to /var/log/samba/log.{smbd,nmbd}.
-# Append syslog@1 if you want important messages to be sent to syslog too.
- logging = file
-
-# For more verbose logging:
-; log level = 3
-
-# Do something sensible when Samba crashes: mail the admin a backtrace
- panic action = /usr/share/samba/panic-action %d
-
-
-####### Authentication #######
-
-# Server role. Defines in which mode Samba will operate. Possible
-# values are "standalone server", "member server", "classic primary
-# domain controller", "classic backup domain controller", "active
-# directory domain controller".
-#
-# Most people will want "standalone server" or "member server".
-# Running as "active directory domain controller" will require first
-# running "samba-tool domain provision" to wipe databases and create a
-# new domain.
- server role = standalone server
-
- obey pam restrictions = yes
-
-# This boolean parameter controls whether Samba attempts to sync the Unix
-# password with the SMB password when the encrypted SMB password in the
-# passdb is changed.
- unix password sync = yes
-
-# For Unix password sync to work on a Debian GNU/Linux system, the following
-# parameters must be set (thanks to Ian Kahan < for
-# sending the correct chat script for the passwd program in Debian Sarge).
- passwd program = /usr/bin/passwd %u
- passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
-
-# This boolean controls whether PAM will be used for password changes
-# when requested by an SMB client instead of the program listed in
-# 'passwd program'. The default is 'no'.
- pam password change = yes
-
-# This option controls how unsuccessful authentication attempts are mapped
-# to anonymous connections
- map to guest = bad user
-
-########## Domains ###########
-
-#
-# The following settings only takes effect if 'server role = classic
-# primary domain controller', 'server role = classic backup domain controller'
-# or 'domain logons' is set
-#
-
-# It specifies the location of the user's
-# profile directory from the client point of view) The following
-# required a [profiles] share to be setup on the samba server (see
-# below)
-; logon path = \\%N\profiles\%U
-# Another common choice is storing the profile in the user's home directory
-# (this is Samba's default)
-# logon path = \\%N\%U\profile
-
-# The following setting only takes effect if 'domain logons' is set
-# It specifies the location of a user's home directory (from the client
-# point of view)
-; logon drive = H:
-# logon home = \\%N\%U
-
-# The following setting only takes effect if 'domain logons' is set
-# It specifies the script to run during logon. The script must be stored
-# in the [netlogon] share
-# NOTE: Must be store in 'DOS' file format convention
-; logon script = logon.cmd
-
-# This allows Unix users to be created on the domain controller via the SAMR
-# RPC pipe. The example command creates a user account with a disabled Unix
-# password; please adapt to your needs
-; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u
-
-# This allows machine accounts to be created on the domain controller via the
-# SAMR RPC pipe.
-# The following assumes a "machines" group exists on the system
-; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u
-
-# This allows Unix groups to be created on the domain controller via the SAMR
-# RPC pipe.
-; add group script = /usr/sbin/addgroup --force-badname %g
-
-############ Misc ############
-
-# Using the following line enables you to customise your configuration
-# on a per machine basis. The %m gets replaced with the netbios name
-# of the machine that is connecting
-; include = /home/samba/etc/smb.conf.%m
-
-# Some defaults for winbind (make sure you're not using the ranges
-# for something else.)
-; idmap config * : backend = tdb
-; idmap config * : range = 3000-7999
-; idmap config YOURDOMAINHERE : backend = tdb
-; idmap config YOURDOMAINHERE : range = 100000-999999
-; template shell = /bin/bash
-
-# Setup usershare options to enable non-root users to share folders
-# with the net usershare command.
-
-# Maximum number of usershare. 0 means that usershare is disabled.
-# usershare max shares = 100
-
-# Allow users who've been granted usershare privileges to create
-# public shares, not just authenticated ones
- usershare allow guests = yes
-
-#======================= Share Definitions =======================
-
-# Un-comment the following (and tweak the other settings below to suit)
-# to enable the default home directory shares. This will share each
-# user's home directory as \\server\username
-;[homes]
-; comment = Home Directories
-; browseable = no
-
-# By default, the home directories are exported read-only. Change the
-# next parameter to 'no' if you want to be able to write to them.
-; read only = yes
-
-# File creation mask is set to 0700 for security reasons. If you want to
-# create files with group=rw permissions, set next parameter to 0775.
-; create mask = 0700
-
-# Directory creation mask is set to 0700 for security reasons. If you want to
-# create dirs. with group=rw permissions, set next parameter to 0775.
-; directory mask = 0700
-
-# By default, \\server\username shares can be connected to by anyone
-# with access to the samba server.
-# Un-comment the following parameter to make sure that only "username"
-# can connect to \\server\username
-# This might need tweaking when using external authentication schemes
-; valid users = %S
-
-# Un-comment the following and create the netlogon directory for Domain Logons
-# (you need to configure Samba to act as a domain controller too.)
-;[netlogon]
-; comment = Network Logon Service
-; path = /home/samba/netlogon
-; guest ok = yes
-; read only = yes
-
-# Un-comment the following and create the profiles directory to store
-# users profiles (see the "logon path" option above)
-# (you need to configure Samba to act as a domain controller too.)
-# The path below should be writable by all users so that their
-# profile directory may be created the first time they log on
-;[profiles]
-; comment = Users profiles
-; path = /home/samba/profiles
-; guest ok = no
-; browseable = no
-; create mask = 0600
-; directory mask = 0700
-
-[printers]
- comment = All Printers
- browseable = no
- path = /var/spool/samba
- printable = yes
- guest ok = no
- read only = yes
- create mask = 0700
-
-# Windows clients look for this share name as a source of downloadable
-# printer drivers
-[print$]
- comment = Printer Drivers
- path = /var/lib/samba/printers
- browseable = yes
- read only = yes
- guest ok = no
-# Uncomment to allow remote administration of Windows print drivers.
-# You may need to replace 'lpadmin' with the name of the group your
-# admin users are members of.
-# Please note that you also need to set appropriate Unix permissions
-# to the drivers directory for these users to have write rights in it
-; write list = root, @lpadmin
-
-[home]
-path = /home/femto
-browseable = yes
-writable = yes
-read only = no
-create mask = 0775
-directory mask = 0775
-valid users = femto
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-boot-complete.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-boot-complete.service
deleted file mode 100644
index 2e47bf2..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-boot-complete.service
+++ /dev/null
@@ -1,14 +0,0 @@
-[Unit]
-Description=Boot Complete
-DefaultDependencies=no
-After=multi-user.target femto-usb-config-tool.service
-
-[Service]
-ExecStart=/usr/local/bin/femto-boot-complete.sh
-Type=oneshot
-Restart=no
-StandardOutput=journal+console
-StandardError=journal+console
-
-[Install]
-WantedBy=default.target
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-runonce.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-runonce.service
deleted file mode 100644
index 574335d..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-runonce.service
+++ /dev/null
@@ -1,16 +0,0 @@
-[Unit]
-Description=Foxbuntu First Boot
-After=rc-local.service
-Before=serial-getty@ttyFIQ0.service
-DefaultDependencies=no
-
-[Service]
-ExecStart=/usr/local/bin/femto-runonce.sh
-Type=oneshot
-Restart=no
-StandardOutput=journal+console
-StandardError=journal+console
-
-[Install]
-WantedBy=default.target
-
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-usb-config-tool.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-usb-config-tool.service
deleted file mode 100644
index 8f1c5dc..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-usb-config-tool.service
+++ /dev/null
@@ -1,16 +0,0 @@
-[Unit]
-Description=Foxbuntu USB Configuration Tool
-After=rc-local.service
-Before=serial-getty@ttyFIQ0.service
-DefaultDependencies=no
-
-[Service]
-ExecStart=/usr/local/bin/femto-usb-config-tool.sh
-Type=oneshot
-Restart=no
-StandardOutput=journal+console
-StandardError=journal+console
-
-[Install]
-WantedBy=default.target
-
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service
deleted file mode 100644
index 4ed9800..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=Sync wifi updown with Meshtastic
-After=meshtasticd.service
-
-[Service]
-ExecStart=/usr/local/bin/femto-wifi-mesh-control.sh
-Restart=always
-RestartSec=5
-User=root
-
-[Install]
-WantedBy=multi-user.target
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf
index 2af10c1..9afc90b 100644
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf
@@ -1,7 +1,3 @@
[Service]
-Nice=-20
+ExecStartPost=/bin/sh -c 'renice -n -20 -p $(pgrep meshtasticd)'
-[Unit]
-After=rc-local.service
-Wants=rc-local.service
-After=network-online.target
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/serial-getty@.service.d/override.conf b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/serial-getty@.service.d/override.conf
deleted file mode 100644
index 7fb660f..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/serial-getty@.service.d/override.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-[Unit]
-After=femto-boot-complete.service multi-user.target
-Conflicts=getty.target
-Before=getty.target
-
-[Service]
-ExecStartPre=/bin/sleep 0.5
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/ttyd.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/ttyd.service
deleted file mode 100644
index 5f3e727..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/ttyd.service
+++ /dev/null
@@ -1,14 +0,0 @@
-[Unit]
-Description=ttyd Web Terminal
-After=syslog.target
-After=network.target
-
-[Service]
-ExecStart=/opt/ttyd/ttyd -W -6 --ssl --ssl-key /etc/ssl/private/ttyd.key --ssl-cert /etc/ssl/certs/ttyd.crt -i 0.0.0.0 login
-Type=simple
-Restart=always
-User=root
-Group=root
-
-[Install]
-WantedBy=multi-user.target
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header
index 276f003..8d10a9d 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header
@@ -12,11 +12,11 @@ if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
fi
[ -r /etc/lsb-release ] && . /etc/lsb-release
-foxbuntu_version=$(femto-utils.sh -v)
-spaces=$((21 - ${#foxbuntu_version}))
+foxbuntu_version=$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release)$(output=$(grep -o 'patch=[1-9][0-9]*' /etc/foxbuntu-release | cut -d= -f2) && [ -n "$output" ] && echo ".$output")$(grep -oP 'hotfix=\K[a-z]+' /etc/foxbuntu-release)
+spaces=$((11 - ${#foxbuntu_version}))
printf " For settings, run \`\033[0;31msudo femto-config\033[0m\`\n"
printf " Made for Femtofox https://www.femtofox.com\n"
-printf " $foxbuntu_version%*s%s(%s)\n\n" $spaces "" "$DISTRIB_DESCRIPTION" "$(uname -r)"
+printf " Foxbuntu v$foxbuntu_version%*s%s(%s)\n\n" $spaces "" "$DISTRIB_DESCRIPTION" "$(uname -r)"
printf "IP address: $(hostname -I | sed 's/ / /g') Uptime:$(uptime -p | awk '{$1=""; print $0}' | sed -e 's/ day\b/d/g' -e 's/ hour\b/h/g' -e 's/ hours\b/h/g' -e 's/ minute\b/m/g' -e 's/ minutes\b/m/g' | sed 's/,//g')\n"
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/button.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/button.service
similarity index 100%
rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/button.service
rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/button.service
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/settime.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/settime.service
new file mode 100644
index 0000000..59221fc
--- /dev/null
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/settime.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Run settime script at startup
+Before=meshtasticd.service
+After=network.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/local/bin/settime.sh
+
+[Install]
+WantedBy=default.target
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/wifi-mesh-control.service
similarity index 54%
rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service
rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/wifi-mesh-control.service
index 6ef2e59..d07e1c7 100644
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/wifi-mesh-control.service
@@ -1,12 +1,11 @@
[Unit]
-Description=Watchclock-dog
+Description=Meshtastic control of wifi
After=network.target
[Service]
-ExecStart=/usr/local/bin/femto-watchclock-dog.sh
+ExecStart=/usr/local/bin/wifi-mesh-control.sh
Restart=always
User=root
[Install]
WantedBy=multi-user.target
-
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/opt/ttyd/LICENSE b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/opt/ttyd/LICENSE
deleted file mode 100644
index 54ab6d8..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/opt/ttyd/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2016-2025 Shuanglei Tao
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc
deleted file mode 100644
index 0dc0ac3..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Run-time configuration file for dialog
-#
-# Automatically generated by "dialog --create-rc "
-#
-#
-# Types of values:
-#
-# Number -
-# String - "string"
-# Boolean -
-# Attribute - (foreground,background,highlight?,underline?,reverse?)
-
-# Up arrow color
-uarrow_color = (GREEN,WHITE,ON)
-
-# Down arrow color
-darrow_color = uarrow_color
-
-# Active form text color
-form_active_text_color = button_active_color
-
-# Form text color
-form_text_color = (WHITE,CYAN,ON)
-
-# Readonly form item color
-form_item_readonly_color = (BLUE,WHITE,ON)
-
-# Item help-text color
-itemhelp_color = (WHITE,BLUE,OFF)
-
-# Selected tag color (menu items)
-tag_selected_color = (WHITE,BLUE,ON)
-
-# Tag color (menu items)
-tag_color = (BLACK,WHITE,OFF)
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-boot-complete.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-boot-complete.sh
deleted file mode 100755
index b7d94fa..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-boot-complete.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-if grep -qE '^first_boot=true' /etc/femto.conf; then
- echo "First boot, skipping \`boot complete\` tasks."
- exit 0
-fi
-
-echo "Boot complete"
-
-femto-utils.sh -a &
-sleep 1
-
-# blink successful boot code
-for i in $(seq 1 5); do
- echo 1 > /sys/class/gpio/gpio34/value;
- sleep 0.5;
- echo 0 > /sys/class/gpio/gpio34/value;
- sleep 0.5;
-done
-exit 0
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config
index 64ac042..93201b3 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config
@@ -16,155 +16,38 @@ pause() {
read -n 1 -s -r
}
-loading() {
- dialog --no-collapse --infobox "$1" 5 45
-}
-
-## function to pull data from various femto scripts and convert it to the contents of a read only dialog --form
-# ingest_form_data() { # usage: `ingest_form_data "command.sh -argument" key_width value_width`
-# unset output_array #debug code, delete me
-# declare -a output_array
-# # Read the output from femto-meshtasticd-config.sh and store it in the array
-# while IFS=':' read -r key value; do
-# # Trim leading/trailing spaces from key and value
-# key=$(echo "$key" | xargs)
-# value=$(echo "$value" | xargs)
-# output_array+=("$key=$value") # Use indexed array to preserve order
-# done < <(eval $1)
-# form_contents=""
-# i=1
-# for pair in "${output_array[@]}"; do
-# key=$(cut -d'=' -f1 <<< "$pair")
-# value=$(cut -d'=' -f2- <<< "$pair")
-# form_contents+="\"$key\" $i 1 \"$value\" $i $2 $3 -1 "
-# ((i++))
-# done
-# echo "$form_contents" | sed 's/\x1b\[[0-9;]*m//g'
-# }
-## CODE TO USE THIS FUNCTION:
-# eval "$(echo -e "dialog --no-collapse --no-cancel --form \"Meshtastic node info\" 0 0 0 $(ingest_form_data "femto-meshtasticd-config.sh -i" 18 0) 2>/dev/null")"
-
-
-# function to pull data from various femto scripts and convert it a simple text string, with dialog colors
-ingest_data() { # usage: `ingest_data "command.sh -argument" key_width`
- local output_string=""
- # Read the output from femto-meshtasticd-config.sh and store output_string
- while IFS=':' read -r key value; do
- key=$(femto-utils.sh -R "$(echo "$key")")
- value=$(femto-utils.sh -R "$(echo "$value" | xargs)") # Trim leading/trailing spaces from value
- if [[ -z "$key" && -z "$value" ]]; then
- output_string+="---\n"
- else
- output_string+=$(printf "%s:%*s%s\n" "$key" $(($2 - 1 - ${#key})) "" "$value\n") # save the key and value to the output_string, adding padding between them as determined by `$2 - 1 - key-length` The 1 accounts for the :
- fi
- done < <(eval $1)
- echo -e "$output_string"
-}
-
-check_meshtasticd_running() {
- if ! echo $(femto-utils.sh -C "meshtasticd") | sed 's/\x1b\[[0-9;]*m//g' | grep -q ", running"; then
- dialog --no-collapse --title "Meshtasticd service" --yesno "Meshtasticd service is not running but is required.\n\nStart service?" 9 50
- if [ $? -eq 0 ]; then #unless cancel/no
- femto-meshtasticd-config.sh -s
- echo "Waiting for meshtasticd service to start..."
- sleep 3
- if ! echo $(femto-utils.sh -C "meshtasticd") | sed 's/\x1b\[[0-9;]*m//g' | grep -q ", running"; then
- dialog --no-collapse --colors --title "Meshtasticd service" --msgbox "Meshtasticd service ($(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")) failed to run, but is required." 7 50
- return 1
- fi
- return 0
- else
- return 1
- fi
- fi
-}
-
-service_manager() {
- choice="" # zero the choice before loading the submenu
- while true; do
- local service_name=$1
- local readable_name=$2
- local help=$3
- echo "Checking $readable_name service state..."
- local service_state="$(femto-utils.sh -R "$(femto-utils.sh -C "$service_name")")"
- choice=$(dialog --no-collapse --colors --help-button --cancel-label "Back" --title "$readable_name Service" --default-item "$choice" --menu "Avahi-Daemon service is $service_state" 16 60 5 \
- "View detailed service status" "x" \
- " " "" \
- "Start/restart service" "x" \
- $(if ! echo "$service_state" | grep -q 'not running'; then echo "Stop service x"; fi) \
- " " "" \
- $(if echo "$service_state" | grep -q 'disabled'; then echo "Enable service x"; fi) \
- $(if echo "$service_state" | grep -q 'enabled'; then echo "Disable service x"; fi) \
- " " "" \
- "Back to previous menu" "x" 3>&1 1>&2 2>&3)
- exit_status=$? # This line checks the exit status of the dialog command
- if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
- break
- elif [ $exit_status -eq 2 ]; then # Help ("extra") button
- dialog --no-collapse --colors --title "$readable_name service help" --msgbox "$3" 0 0
- else
- case $choice in
- "View detailed service status")
- echo "Getting $readable_name service status..."
- dialog --no-collapse --title "$readable_name service status" --msgbox "$(systemctl status $service_name)" 0 0
- ;;
- "Start/restart service")
- dialog --no-collapse --title "$title" --yesno "Start/restart $readable_name service?" 7 45
- if [ $? -eq 0 ]; then #unless cancel/no
- systemctl restart $service_name
- dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl restart $service_name\Zn\` command to system.\n\n$readable_name should be running." 10 60
- fi
- ;;
- "Stop service")
- dialog --no-collapse --colors --title "$title" --yesno "Stop $readable_name service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn.\n\n$readable_name will automatically restart on boot service if enabled." 11 50
- if [ $? -eq 0 ]; then #unless cancel/no
- systemctl stop $service_name
- dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl stop $service_name\Zn\` command to system.\n\n$readable_name should be stopped." 9 60
- fi
- ;;
- "Enable service")
- dialog --no-collapse --title "$title" --yesno "Enable $readable_name service?" 6 45
- if [ $? -eq 0 ]; then #unless cancel/no
- systemctl enable $service_name
- systemctl start $service_name
- dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl enable $service_name\Zn\` and \`\Zusystemctl start $service_name\Zn\` commands to system.\n\n$readable_name should be running." 10 60
- fi
- ;;
- "Disable service")
- dialog --no-collapse --colors --title "$title" --yesno "Disable $readable_name service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn and will not restart!" 9 50
- if [ $? -eq 0 ]; then #unless cancel/no
- systemctl disable $service_name
- systemctl stop $service_name
- dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl disable $service_name\Zn\` and \`\Zusystemctl stop $service_name\Zn\` commands to system.\n\n$readable_name should be disabled and stopped." 10 60
- fi
- ;;
- "Back to previous menu") break ;;
- esac
- fi
- done
+# Dialog uses a different method to display colors, and is limited to only these 8.
+replace_colors() {
+ input="$1"
+ input="${input//$(echo -e '\033[0;30m')/\\Z0}" # black
+ input="${input//$(echo -e '\033[0;31m')/\\Z1}" # red
+ input="${input//$(echo -e '\033[0;32m')/\\Z2}" # green
+ input="${input//$(echo -e '\033[0;33m')/\\Z3}" # yellow
+ input="${input//$(echo -e '\033[0;34m')/\\Z4}" # blue
+ input="${input//$(echo -e '\033[0;35m')/\\Z5}" # magenta
+ input="${input//$(echo -e '\033[0;36m')/\\Z6}" # cyan
+ input="${input//$(echo -e '\033[0;37m')/\\Z7}" # white
+ input="${input//$(echo -e '\033[7m')/\\Zr}" # invert
+ input="${input//$(echo -e '\033[4m')/\\Zu}" # underline
+ input="${input//$(echo -e '\033[0m')/\\Zn}" # reset
+ echo "$input"
}
wifi_config() {
- local title2="Wi-Fi (wlan0) Settings"
- local config=$(dialog --no-collapse --title "$title2" --form "↑ ↓ to navigate, [ESC] to cancel." 10 45 0 \
- "SSID:" 1 1 "$(grep -oP '^ *ssid="\K[^"]+' /etc/wpa_supplicant/wpa_supplicant.conf)" 1 15 24 32\
- "Password:" 2 1 "" 2 15 24 64\
- "Country Code:" 3 1 "$(grep -oP '^ *country=\K[^ ]+' /etc/wpa_supplicant/wpa_supplicant.conf)" 3 15 24 2\
- 3>&1 1>&2 2>&3)
- # Parse the output
- wifi_ssid=$(echo "$config" | sed -n '1p')
- wifi_psk=$(echo "$config" | sed -n '2p')
- wifi_country=$(echo "$config" | sed -n '3p')
-
- cmd="femto-network-config.sh -s \"$wifi_ssid\" -p \"$wifi_psk\"" # build the wifi setting command to send to the network config script
+ local wifi_ssid=""
+ local wifi_psk=""
+ local wifi_country=""
+ wifi_ssid=$(dialog --no-collapse --title "$title2" --inputbox "Enter Wi-Fi SSID:" 8 40 "$(grep -oP '^ *ssid="\K[^"]+' /etc/wpa_supplicant/wpa_supplicant.conf)" 3>&1 1>&2 2>&3) # display current SSID
+ wifi_psk=$(dialog --no-collapse --title "$title2" --inputbox "Enter Wi-Fi Password:" 8 40 3>&1 1>&2 2>&3)
+ wifi_country=$(dialog --no-collapse --title "$title2" --inputbox "Enter Country Code (US, DE...):" 8 40 "$(grep -oP '^ *country=\K[^ ]+' /etc/wpa_supplicant/wpa_supplicant.conf)" 3>&1 1>&2 2>&3) # display current country
+ cmd="femto-network-config.sh -s \"$wifi_ssid\" -p \"$wifi_psk\""
[ -n "$wifi_country" ] && cmd="$cmd -c \"$wifi_country\""
cmd="$cmd -r"
if [ -z "$wifi_ssid" ]; then
- dialog --no-collapse --title "$title2" --msgbox "\nSSID is required to configure Wi-Fi." 7 40
+ dialog --no-collapse --title "$title2" --msgbox "\nSSID is required to configure Wi-Fi." 8 40
return
fi
- echo "Configuring wifi..."
- eval $cmd &>/dev/null
+ eval $cmd
dialog --no-collapse --title "$title2" --msgbox "Wi-Fi Settings Saved:\nSSID: $wifi_ssid\nPassword: (hidden)\nCountry: $wifi_country\nMeshtastic Wi-Fi setting set to ON" 9 40
if [ "$1" = "-w" ]; then
exit 0
@@ -176,51 +59,54 @@ networking_settings() {
local title="Networking"
local title2="Wi-Fi (wlan0) Settings"
wpa_supplicant_conf="/etc/wpa_supplicant/wpa_supplicant.conf"
- choice="" # zero the choice before loading the submenu
while true; do
- networking_choice=$(dialog --no-collapse --cancel-label "Back" --backtitle "IPv4 address: $(femto-network-config.sh -i)" --default-item "$networking_choice" --title "$title" --item-help --menu "" 17 40 4 \
- 1 "Turn Wi-Fi on/off" "" \
- 2 "View Wi-Fi settings" "" \
- 3 "Change Wi-Fi settings" "" \
- 4 "View ethernet settings" "" \
- 5 "Restart networking" "" \
- 6 "Set hostname" "" \
- 7 "Test internet connection" "" \
- 8 "Manage Meshtastic wifi sync" "" \
- 9 "Manage Avahi-Daemon service" "" \
- " " "" "" \
- 10 "Back to main menu" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- case $networking_choice in
+ local option=""
+ option=$(dialog --no-collapse --cancel-label "Back" --menu "$title" 16 40 4 \
+ 1 "Turn Wi-Fi on/off" \
+ 2 "View Wi-Fi settings" \
+ 3 "Change Wi-Fi settings" \
+ 4 "View ethernet settings" \
+ 5 "Restart networking" \
+ 6 "Set hostname" \
+ 7 "Test internet connection" \
+ "" "" \
+ 8 "Back to Main Menu" 3>&1 1>&2 2>&3)
+
+ exit_status=$? # This line checks the exit status of the dialog command
+ if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
+ break
+ fi
+
+ case $option in
1) # Turn Wi-Fi on/off)
if ! ip link show wlan0 &>/dev/null; then
- dialog --no-collapse --colors --msgbox "\Z1Network adapter wlan0 does not exist.\Zn\n\nIs a Wi-Fi adapter connected?" 8 40
+ dialog --no-collapse --colors --msgbox "\Z1Network adapter wlan0 does not exist.\Zn\n\nIs a wifi adapter connected?" 8 40
else
while true; do
- choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$choice" --title "Enable/disable Wi-Fi" --item-help --menu "Tip: Wi-Fi can also be toggled by short-pressing the BOOT button on the Luckfox." 13 50 5 \
- 1 "Turn Wi-Fi on" "" \
- 2 "Turn Wi-Fi off" "" \
- " " "" "" \
- 3 "Return to previous menu" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
+ choice=$(dialog --no-collapse --cancel-label "Back" --title "Enable/disable Wi-Fi" --menu "Tip: Wi-Fi can also be toggled by short-pressing the BOOT button on the Luckfox." 11 50 5 \
+ 1 "Turn Wi-Fi on" \
+ 2 "Turn Wi-Fi off" 3>&1 1>&2 2>&3)
+ exit_status=$? # This line checks the exit status of the dialog command
+ if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
+ break
+ fi
case $choice in
1) femto-network-config.sh -x "up" && break ;;
2) femto-network-config.sh -x "down" && break ;;
- 3) break ;;
esac
done
fi
;;
2) # View Wi-Fi settings)
echo "Getting Wi-Fi configuration..."
- dialog --no-collapse --title "$title2" --colors --msgbox "$(ingest_data "femto-network-config.sh -w" 15)" 0 0
+ dialog --no-collapse --title "$title2" --colors --msgbox "$(replace_colors "$(femto-network-config.sh -w)")" 0 0
;;
3) # Change Wi-Fi settings)
wifi_config
;;
4) # View ethernet settings)
echo "Getting ethernet configuration..."
- dialog --no-collapse --title "Ethernet (eth0) settings" --colors --msgbox "$(ingest_data "femto-network-config.sh -e" 15)" 0 0
+ dialog --no-collapse --title "Ethernet (eth0) settings" --colors --msgbox "$(echo -e "$(replace_colors "$(femto-network-config.sh -e)")")" 0 0
;;
5) # Restart networking)
dialog --no-collapse --title "$title2" --yesno "Wi-Fi and Ethernet will be restarted.\nMeshtastic Wi-Fi setting will be set to ON.\n\nProceed?" 10 40
@@ -229,113 +115,212 @@ networking_settings() {
fi
;;
6) # set hostname)
- new_hostname=$(dialog --no-collapse --title "$title" --max-input 253 --inputbox "Enter new hostname:" 8 40 $(hostname) 3>&1 1>&2 2>&3)
+ new_hostname=$(dialog --no-collapse --title "$title" --inputbox "Enter new hostname:" 8 40 $(hostname) 3>&1 1>&2 2>&3)
if [ $? -eq 0 ]; then #unless cancel/no
femto-network-config.sh -n "$new_hostname"
dialog --no-collapse --title "$title" --msgbox "Femtofox is now reachable at\n$new_hostname.local" 8 40
fi
;;
7) # Test internet connection)
- loading "Testing internet connection..."
- dialog --no-collapse --title "Internet connectivity test" --colors --msgbox "$(femto-utils.sh -R "$(femto-network-config.sh -t)")" 9 40
+ dialog --no-collapse --infobox "Testing internet connection..." 5 45
+ dialog --no-collapse --title "Internet connectivity test" --colors --msgbox "$(replace_colors "$(femto-network-config.sh -t)")" 8 40
;;
- 8) # Manage Meshtastic wifi sync)
- service_manager "femto-wifi-mesh-control" "Meshtastic wifi sync" "The Meshtastic wifi sync service synchronizes system wifi settings with Meshtastic wifi settings. This allows you to use Meshtastic's remote node administration feature to enable/disable wifi.\n\nIn future, this will also allow you to reconfigure SSID and password.\n"
- ;;
- 9) # Manage avahi)
- service_manager "avahi-daemon" "Avahi Daemon" "The Avahi-Daemon service advertises the Meshtastic node on the local LAN (often called a Bonjour service), allowing the Android app to detect it. Without Avahi, you will need to manually enter the Femtofox's IP address in the app to connect.\n"
- ;;
- 10)
+ 8)
return
;;
esac
done
}
+ # pinout menu
+femto_pinouts() {
+ while true; do
+ local option=""
+ option=$(dialog --no-collapse --cancel-label "Back" --menu "Pinouts" 15 40 5 \
+ 1 "Femtofox Pro/CE" \
+ 2 "Femtofox Zero" \
+ 3 "Femtofox Tiny" \
+ 4 "Luckfox Pico Mini" \
+ "" "" \
+ 5 "Back to Help Menu" 3>&1 1>&2 2>&3)
+
+ exit_status=$? # This line checks the exit status of the dialog command
+
+ if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
+ break
+ fi
+
+ case $option in
+ 1) dialog --no-collapse --title "Femtofox" --msgbox "$(femto-pinout.sh -f)" 43 68 ;;
+ 2) dialog --no-collapse --title "Femtofox Zero" --msgbox "$(femto-pinout.sh -z)" 34 48 ;;
+ 3) dialog --no-collapse --title "Femtofox Tiny" --msgbox "$(femto-pinout.sh -t)" 38 70 ;;
+ 4) dialog --no-collapse --title "Luckfox Pico Mini" --msgbox "$(femto-pinout.sh -l)" 23 65 ;;
+ 5) return ;;
+ esac
+ done
+}
+
+# enable/disable system logging
+logging() {
+ enable_logging() {
+ chattr -i /var/log
+ msg="Enabling system logging by making /var/log writable."
+ logger $msg
+ echo $msg
+ return 0
+ }
+ disable_logging() {
+ msg="Disabling system logging by making /var/log immutable."
+ logger $msg
+ echo $msg
+ chattr +i /var/log
+ return 0
+ }
+ check_logging() {
+ lsattr -d /var/log | grep -q 'i' && echo -e "\033[0;31mdisabled\033[0m" || echo -e "\033[0;34menabled\033[0m"
+ }
+ if [ "$1" = "true" ]; then
+ disable_logging
+ elif [ "$1" = "false" ]; then
+ enable_logging
+ elif [ "$1" = "check" ]; then
+ check_logging
+ elif [ -z "$1" ]; then
+ while true; do
+ choice=$(dialog --no-collapse --colors --title "Logging" --menu "Before deploying a Femtofox, it is advisable to disable logging to reduce SD card wear.\nCurrent state: $(replace_colors "$(check_logging)")" 12 50 2 \
+ 1 "Enable (default)" \
+ 2 "Disable" 3>&1 1>&2 2>&3)
+ exit_status=$? # This line checks the exit status of the dialog command
+ if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
+ break
+ fi
+ case $choice in
+ 1) enable_logging ;;
+ 2) disable_logging ;;
+ esac
+ done
+ else
+ echo "$1 is not a valid argument for -L. Options are \"true\" and \"false\"."
+ fi
+}
+
+# at some point this will be moved to a different script, and have many functions instead of one giant dump
+system_info() {
+ local cpu_architecture="$(uname -m) ($(dpkg --print-architecture) $(python3 -c "import platform; print(platform.architecture()[0])"))"
+ local cpu_model="$(dmesg | grep "soc_id" | sed -n 's/.*soc_id: //p')"
+ local cpu_temp="$(echo "scale=1; $(cat /sys/class/thermal/thermal_zone0/temp) / 1000" | bc)°C"
+ local cpu_serial="$(awk '/Serial/ {print $3}' /proc/cpuinfo)"
+ local cpu_speed="$(lscpu | grep "CPU min MHz" | awk '{print int($4)}')-$(lscpu | grep "CPU max MHz" | awk '{print int($4)}')mhz"
+ local microsd_size="$(df --block-size=1 / | awk 'NR==2 {total=$2; avail=$4; total_human=sprintf("%.2f", total/1024/1024/1024); avail_human=sprintf("%.2f", avail/1024/1024/1024); printf "%.2f GB (%.2f%% free)", total_human, (avail/total)*100}')"
+ local memory="$(free -m | awk 'NR==2{printf "%d MB (%.2f%% free)\n", $2, 100 - (($3/$2)*100)}')"
+ local swap="$(free -m | awk 'NR==3 {if ($2 > 1000) {printf "%.2f GB (%.2f%% free)", $2/1024, ($4/$2)*100} else {printf "%d MB (%.2f%% free)", $2, ($4/$2)*100}}')"
+ local mounted_drives="$([ "$(for dir in /mnt/*/; do echo -n "/mnt${dir#"/mnt"} "; done)" ] && echo "Mounted drives: $(for dir in /mnt/*; do echo -n "/mnt${dir#"/mnt"} "; done | sed 's/\/$//')")"
+ local os_version="Foxbuntu v$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release)$(output=$(grep -o 'patch=[1-9][0-9]*' /etc/foxbuntu-release | cut -d= -f2) && [ -n "$output" ] && echo ".$output")$(grep -oP 'hotfix=\K[a-z]+' /etc/foxbuntu-release) ($(lsb_release -d | awk -F'\t' '{print $2}') $(lsb_release -c | awk -F'\t' '{print $2}'))"
+ local system_uptime="$(uptime -p | awk '{$1=""; print $0}' | sed -e 's/ day\b/d/g' -e 's/ hour\b/h/g' -e 's/ hours\b/h/g' -e 's/ minute\b/m/g' -e 's/ minutes\b/m/g' | sed 's/,//g')"
+ local logging_enabled="$(logging "check" | sed 's/\x1b\[[0-9;]*m//g')"
+ local boot_modules="$(modules=$(sed -n '6,$p' /etc/modules | sed ':a;N;$!ba;s/\n/, /g;s/, $//'); [ -z "$modules" ] && echo "none" || echo "$modules")"
+ local i2c_addresses="$(i2cdetect -y 3 | awk 'NR>1 {for(i=2;i<=17;i++) if ($i == "ff" || $i == "UU") { printf "0x%02x ", (i-2) + (NR-2)*16} }' | tr -d '\n' )"
+ local wifi_status="$(replace_colors "$(femto-network-config.sh -w | grep -v '^$' | grep -v '^Hostname')")" #remove hostname line, as it's identical to the one in ethernet settings
+ local eth_status="$(replace_colors "$(femto-network-config.sh -e)")"
+ local usb_devices="$(lsusb | grep -v 'root hub' | awk 'NR>0{printf "USB: "; for(i=7;i<=NF;i++) printf "%s ", $i; print ""} END {if (NR == 0) printf "USB: None detected"}')"
+ local kernel_modules_active="$(lsmod | awk 'NR>1 {print $1}' | tr '\n' ' ' && echo)"
+ local lora_radio="$(replace_colors "$(femto-meshtasticd-config.sh -k)")"
+ local meshtasticd_service_status="$(replace_colors "$(femto-meshtasticd-config.sh -S)")"
+ local meshtasticd_info="$(replace_colors "$(femto-meshtasticd-config.sh -i)")"
+ local usb_mode="$(cat /sys/devices/platform/ff3e0000.usb2-phy/otg_mode)"
+ local spi0_state="$([ "$(awk -F= '/^SPI0_M0_STATUS/ {print $2}' /etc/luckfox.cfg)" -eq 1 ] && echo "enabled" || echo "disabled")"
+ local spi0_speed="$((0x$(xxd -p /sys/firmware/devicetree/base/spi@ff500000/spidev@0/spi-max-frequency | tr -d '\n')))"
+ local i2c3_state="$([ "$(awk -F= '/^I2C3_M1_STATUS/ {print $2}' /etc/luckfox.cfg)" -eq 1 ] && echo "enabled" || echo "disabled")"
+ local i2c3_speed="$(awk -F= '/^I2C3_M1_SPEED/ {print $2}' /etc/luckfox.cfg)"
+ local uart3_state="$([ "$(awk -F= '/^UART3_M1_STATUS/ {print $2}' /etc/luckfox.cfg)" -eq 1 ] && echo "enabled" || echo "disabled")"
+ local uart4_state="$([ "$(awk -F= '/^UART4_M1_STATUS/ {print $2}' /etc/luckfox.cfg)" -eq 1 ] && echo "enabled" || echo "disabled")"
+
+ echo -e "\
+ Femtofox\n\
+Core: $(cat /sys/firmware/devicetree/base/model)\n\
+Operating System: $os_version\n\
+Kernel version: $(uname -r)\n\
+Uptime: $system_uptime\n\
+Logging: $logging_enabled\n\
+System time: $(date)\n\
+K modules active: $kernel_modules_active\n\
+K boot modules: $boot_modules\n\
+\n\
+ CPU:\n\
+Architecture: $cpu_architecture\n\
+Model: $cpu_model\n\
+Serial # $cpu_serial\n\
+Speed: $cpu_speed x $(nproc) cores\n\
+Temperature: $cpu_temp
+\n\
+ Storage:\n\
+microSD size: $microsd_size\n\
+Memory: $memory\n\
+Swap: $swap\n\
+$mounted_drives\n\
+\n\
+ Networking (wlan0 & eth0):\n\
+$wifi_status\n\
+---
+$eth_status\n\
+\n\
+ Interfaces:\n\
+USB mode: $usb_mode\n\
+SPI-0 state: $spi0_state\n\
+SPI-0 speed: $spi0_speed\n\
+i2c-3 state: $i2c3_state\n\
+i2c-3 speed: $i2c3_speed\n\
+UART-3 state: $uart3_state\n\
+UART-4 state: $uart4_state\n\
+\n\
+ Attached devices:\n\
+LoRa radio: $lora_radio\n\
+$usb_devices\n\
+i2c devices: $i2c_addresses\n\
+\n\
+ Meshtasticd:\n\
+Service status: $meshtasticd_service_status\n\
+$meshtasticd_info\
+"
+}
+
# utilities
utilities() {
- local title="Utilities & Tools"
+ local title="Utilities"
while true; do
- utilities_choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$utilities_choice" --item-help --menu "$title" 21 50 4 \
- 1 "View system info" "" \
- 2 "Set system time" "" \
- 3 "Kernel module manager" "" \
- 4 "Re-run first-boot script" "" \
- 5 "Run USB configuration tool" "" \
- 6 "Run OEM luckfox-config" "" \
- 7 "Process viewer/manager" "" \
- 8 "Disable/enable logging" "" \
- 9 "Disable/enable activity LED" "" \
- 10 "Reboot" "" \
- 11 "Shutdown" "" \
- " " "" "" \
- 12 "Back to main menu" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
+ local option=""
+ option=$(dialog --no-collapse --cancel-label "Back" --menu "$title" 19 40 4 \
+ 1 "System info" \
+ 2 "Set system time" \
+ 3 "Kernel modules" \
+ 4 "Re-run first-boot script" \
+ 5 "Run USB configuration tool" \
+ 6 "Run OEM luckfox-config" \
+ 7 "Process viewer/manager" \
+ 8 "Disable/enable logging" \
+ 9 "Reboot" \
+ 10 "Shutdown" \
+ "" "" \
+ 11 "Back to Main Menu" 3>&1 1>&2 2>&3)
- case $utilities_choice in
- 1) #sysinfo)
- sysinfo_choice="" # zero the choice before loading the submenu
- while true; do
- echo $sysinfo_choice
- sysinfo_choice=$(dialog --no-collapse --help-button --backtitle "$(femto-utils.sh -v)" --cancel-label "Back" --default-item "$sysinfo_choice" --item-help --menu "System info" 17 40 5 \
- 1 "Operating system" "" \
- 2 "CPU" "" \
- 3 "Storage & memory" "" \
- 4 "Peripherals & devices" ""\
- 5 "Networking" "" \
- 6 "Meshtastic node info" "" \
- 7 "Complete system info" "" \
- " " "" "" \
- 8 "Back to previous menu" "" 3>&1 1>&2 2>&3)
- exit_status=$? # This line checks the exit status of the dialog command
- if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
- break
- elif [ $exit_status -eq 2 ]; then # Help ("extra") button
- dialog --no-collapse --colors --title "System info help" --msgbox "To get system info in terminal (where it can be copied), enter \`\Zusudo femto-utils.sh -i\Zn\`.\n\nWhen getting Peripherals & Devices Info (or Complete System Info) without an i2c device connected, it is normal to see error messages on serial console.\n" 0 0
- else
- case $sysinfo_choice in
- 1) # Operating system)
- loading "Loading operating system info..."
- dialog --no-collapse --colors --title "Operating system info" --msgbox "$(ingest_data "femto-utils.sh -o" 15)" 0 0
- ;;
- 2) # CPU)
- loading "Loading CPU info..."
- dialog --no-collapse --colors --title "CPU info" --msgbox "$(ingest_data "femto-utils.sh -c" 15)" 0 0
- ;;
- 3) # Storage & memory)
- loading "Loading storage & memory info..."
- dialog --no-collapse --colors --title "Storage & memory info" --msgbox "$(ingest_data "femto-utils.sh -S" 15)" 0 0
- ;;
- 4) # Peripherals & devices)
- loading "Loading peripherals & devices info..."
- dialog --no-collapse --colors --title "Peripherals & devices info" --msgbox "$(ingest_data "femto-utils.sh -p" 15)" 0 0
- ;;
- 5) # Networking)
- loading "Loading networking info..."
- dialog --no-collapse --colors --title "Networking info" --msgbox "$(ingest_data "femto-utils.sh -n" 15)" 0 0
- ;;
- 6) # Meshtastic node info)
- check_meshtasticd_running && (
- loading "Loading Meshtastic node info..."
- dialog --no-collapse --colors --title "Meshtastic node info" --msgbox "$(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0
- )
- ;;
- 7) # Complete system info)
- loading "Loading complete system info..."
- dialog --no-collapse --colors --title "Complete system info" --msgbox "$(ingest_data "femto-utils.sh -i" 15)" 0 0
- ;;
- 8) break ;;
- esac
- fi
- done
+ exit_status=$? # This line checks the exit status of the dialog command
+ if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
+ break
+ fi
+
+ case $option in
+ 1)
+ dialog --no-collapse --infobox "Loading system info..." 5 45
+ dialog --no-collapse --colors --title "System info" --msgbox "$(system_info)" 0 0
;;
- 2) femto-set-time.sh ;; # set timezone
+ 2) femto-set-time.sh ;; # set timezone)
3) # Kernel modules)
+ dialog --no-collapse --title "$title" --msgbox "Kernel modules are loadable pieces of code that extend a Linux kernel's functionality without requiring a reboot. Common examples include device drivers, file systems, or system calls.\n\nThis tool will allow you to add pre-compiled modules to the Foxbuntu kernel.\n\nModules currently autostarting at boot: $(modules=$(sed -n '6,$p' /etc/modules | sed ':a;N;$!ba;s/\n/, /g;s/, $//'); [ -z "$modules" ] && echo "none" || echo "$modules")\n\nCurrently active modules: $(lsmod | awk 'NR>1 {print $1}' | tr '\n' ' ')" 18 65
femto-kernel-modules.sh
;;
- 4) femto-runonce.sh ;; # Re-run first-boot script
+ 4) femto-runonce.sh ;; # Re-run first-boot script)
5) # USB config)
- dialog --no-collapse --title "$title" --yesno "The USB configuration tool allows you to set critical Femtofox settings with a text file on a USB flash drive.\n\nFor more information, visit\ngithub.com/femtofox/femtofox/blob/main/usb_config.md\n\nThis tool is run automatically at boot.\n\nRun now?" 14 60
+ dialog --no-collapse --title "$title" --yesno "The USB configuration tool allows you to set critical Femtofox settings with a text file on a USB flash drive.\n\nFor more information, visit\ngithub.com/noon92/femtofox/blob/main/usb_config.md\n\nThis tool is run automatically at boot.\n\nRun now?" 14 60
if [ $? -eq 0 ]; then #unless cancel/no
femto-usb-config-tool.sh
pause
@@ -343,124 +328,52 @@ utilities() {
;;
6) luckfox-config ;;
7) htop ;;
- 8) # logging)
- choice="" # zero the choice before loading the submenu
- while true; do
- echo "Checking current logging status..."
- choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable logging to reduce SD card wear.\nCurrent state: $(femto-utils.sh -R "$(femto-utils.sh -l "check")")" 14 50 2 \
- 1 "Enable (default)" "" \
- 2 "Disable" "" \
- " " "" "" \
- 3 "Return to previous menu" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- case $choice in
- 1) femto-utils.sh -l "enable" ;;
- 2) femto-utils.sh -l "disable" ;;
- 3) break ;;
- esac
- done
- ;;
- 9) # activity LED)
- choice="" # zero the choice before loading the submenu
- while true; do
- echo "Checking current activity LED status..."
- choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable the Activity LED to save power.\nCurrent state: $(femto-utils.sh -R "$(femto-utils.sh -a "check")")" 14 50 2 \
- 1 "Enable (default)" "" \
- 2 "Disable" "" \
- " " "" "" \
- 3 "Return to previous menu" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- case $choice in
- 1) femto-utils.sh -a "enable" ;;
- 2) femto-utils.sh -a "disable" ;;
- 3) break ;;
- esac
- done
- ;;
- 10) # reboot)
+ 8) logging ;;
+ 9) # reboot)
dialog --no-collapse --title "$title" --yesno "Reboot now?\n\nTip: Reboot can also be triggered by long-pressing the BOOT button on the luckfox." 10 45
if [ $? -eq 0 ]; then #unless cancel/no
- loading "Rebooting..."
- femto-utils.sh -r
+ dialog --no-collapse --infobox "Rebooting..." 5 45
+ reboot
fi
;;
- 11) # shutdown)
- dialog --no-collapse --colors --title "$title" --yesno "Shut down now?\n\nTo power system back on, disconnect/reconnect power.\n\nThe system shutdown command prevents damage to the filesystem from power interrupts, but does not stop power consumption.\n\nTip: You can also shut down the Femtofox by pressing the BOOT button for 5 seconds or by running \`\Zusudo halt\Zn\`." 14 60
+ 10) # shutdown)
+ dialog --no-collapse --title "$title" --yesno "Shut down now?\n\nTo power system back on, disconnect/reconnect power.\n\nThe system shutdown command prevents damage to the filesystem from power interrupts, but does not stop power consumption.\n\nTip: You can also shut down the Femtofox by pressing the BOOT button for 5 seconds or by running \`sudo halt\`." 14 60
if [ $? -eq 0 ]; then #unless cancel/no
- loading "Shutting down...\n\nPower consumption will not stop."
- femto-utils.sh -s
+ dialog --no-collapse --infobox "Shutting down...\n\nPower consumption will not stop." 5 45
+ logger "User requested system halt"
+ halt
fi
;;
- 12) return ;;
+ 11) return ;;
esac
done
}
-legacy_admin() {
- choice="" # zero the choice before loading the submenu
- while true; do
- loading "Getting current legacy admin state..."
- choice=$(dialog --no-collapse --colors --title "Legacy Admin" --default-item "$choice" --help-button --item-help --menu "If the node you Femtofox needs to administer or be administered by is running 2.4.x or earlier, you should set this to Enabled.\n\nCurrent state: $(femto-utils.sh -R "$(femto-meshtasticd-config.sh -p)")" 16 65 5 \
- 1 "Enable" "" \
- 2 "Disable (default)" "" \
- " " "" "" \
- 3 "Return to previous menu" "" 3>&1 1>&2 2>&3)
- exit_status=$? # This line checks the exit status of the dialog command
- if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
- break
- elif [ $exit_status -eq 2 ]; then # Help ("extra") button
- dialog --no-collapse --colors --title "System info help" --msgbox "For Meshtastic versions 2.4.x and earlier, remote admin is achieved by creating a secondary channel named admin with a shared PSK. In this setup, messages exchanged on this channel are encrypted only with the channel's PSK, allowing any node in the channel to administer others.\n\nFor more information:\nhttps://meshtastic.org/docs/configuration/remote-admin/\n" 0 0
- else
- case $choice in
- 1) # enable legacy admin)
- dialog --no-collapse --title "Legacy Admin" --yesno "Enable legacy admin channel?\n" 0 0
- if [ $? -eq 0 ]; then #unless cancel/no
- loading "Sending command..."
- dialog --no-collapse --colors --title "Legacy admin" --msgbox "$(femto-meshtasticd-config.sh -o "true" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0
- fi
- ;;
- 2) # disable legacy admin)
- dialog --no-collapse --title "Legacy Admin" --yesno "Disable legacy admin channel?\n" 0 0
- if [ $? -eq 0 ]; then #unless cancel/no
- loading "Sending command..."
- dialog --no-collapse --colors --title "Legacy admin" --msgbox "$(femto-meshtasticd-config.sh -o "false" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0
- fi
- ;;
- 3) break ;;
- esac
- fi
- done
-}
-
-meshtastic_config_url() {
- newurl=$(dialog --no-collapse --colors --title "Meshtastic URL" --inputbox "The Meshtastic configuration URL allows for automatic configuration of all Meshtastic LoRa settings and channels.\n\nEntering a URL may \Z1\ZuOVERWRITE\Zn your LoRa settings and channels!\n\nNew Meshtastic LoRa configuration URL (SHIFT+INS to paste):" 14 63 3>&1 1>&2 2>&3)
- if [ -n "$newurl" ]; then #if a URL was entered
- femto-meshtasticd-config.sh -q "$newurl"
- fi
-}
-
+#set lora radio
set_lora_radio() {
- choice="" # zero the choice before loading the submenu
while true; do
echo "Checking LoRa radio..."
+ local option=""
#Display filename, if exists: $(files=$(ls /etc/meshtasticd/config.d/* 2>/dev/null) && [ -n "$files" ] && echo "\n\nConfiguration files in use:\n$files" | paste -sd, -))
- choice=$(dialog --no-collapse --colors --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | grep -v '^femto_' | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 22 50 10 \
- "Radio name:" "Configuration:" "" \
- "" "" "" \
- "Ebyte e22-900m30s" "(SX1262_TCXO)" "Included in Femtofox Pro" \
- "Ebyte e22-900m22s" "(SX1262_TCXO)" "" \
- "Ebyte e80-900m22s" "(SX1262_XTAL)" "" \
- "Heltec ht-ra62" "(SX1262_TCXO)" "" \
- "Seeed wio-sx1262" "(SX1262_TCXO)" "" \
- "Waveshare sx126x-xxxm" "(SX1262_XTAL)" "Not recommended due issues with sending longer messages" \
- "AI Thinker ra-01sh" "(SX1262_XTAL)" "" \
- "LoRa Meshstick 1262" "(meshstick-1262)" "USB based LoRa radio from Mark Birss. https://github.com/markbirss/MESHSTICK" \
- "Simulated radio" "(none)" "" \
- " " "" "" \
- "Cancel" "" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
+ option=$(dialog --no-collapse --colors --cancel-label "Back" --title "Meshtastic LoRa radio" --menu "Currently configured LoRa radio:\n$(replace_colors "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 18 50 10 \
+ "Ebyte e22-900m30s" "(SX1262_TCXO)" \
+ "Ebyte e22-900m22s" "(SX1262_TCXO)"\
+ "Ebyte e80-900m22s" "(SX1262_XTAL)"\
+ "Heltec ht-ra62" "(SX1262_TCXO)"\
+ "Seeed wio-sx1262" "(SX1262_TCXO)"\
+ "Waveshare sx126x-xxxm" "(SX1262_XTAL)"\
+ "AI Thinker ra-01sh" "(SX1262_XTAL)"\
+ "None" "(simulated radio)"\
+ "" "" \
+ "Skip" "" 3>&1 1>&2 2>&3)
+
+ exit_status=$? # This line checks the exit status of the dialog command
+ if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
+ break
+ fi
+
local radio=""
- case $choice in
+ case $option in
"Ebyte e22-900m30s")
radio="sx1262_tcxo"
;;
@@ -480,180 +393,156 @@ set_lora_radio() {
radio="sx1262_xtal"
;;
"AI Thinker ra-01sh")
- radio="femto_sx1262_xtal"
+ radio="sx1262_xtal"
;;
- "LoRa Meshstick 1262")
- radio="lora-meshstick-1262"
- ;;
- "Simulated radio")
+ "None")
radio="none"
;;
- "Cancel")
+ "Skip")
return
;;
esac
if [ -n "$radio" ]; then #if a radio was selected
femto-meshtasticd-config.sh -l "$radio" -s # set the radio, then restart meshtasticd
- dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "Radio \Zu$choice\Zn selected.\nMeshtasticd service restarted.\Zn")" 7 45
- break
+ return
fi
done
}
# Function to handle Meshtasticd settings
-meshtastic_settings() {
+meshtasticd_settings() {
local title="Meshtastic Settings"
while true; do
- echo "Checking Meshtasticd service state..."
- meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 20 50 4 \
- 1 "View node info" "" \
- 2 "Set LoRa radio model" "" \
- 3 "View configuration URL & QR code" "" \
- 4 "Set configuration URL" "" \
- 5 "Full Meshtastic settings" "" \
- 6 "Mesh connectivity test" "" \
- 7 "Manage Meshtasticd service" "" \
- 8 "Enable/disable i2c support" "" \
- 9 "Upgrade/install Meshtasticd" "" \
- 10 "Uninstall Meshtasticd" "" \
- " " "" "" \
- 11 "Back to main menu" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- case $meshtastic_choice in
- 1) # view node info)
- check_meshtasticd_running && (
- loading "Getting node info..."
- dialog --no-collapse --colors --title "Meshtastic node info" --msgbox "$(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0
- )
+ echo "Checking Meshtasticd service state..."
+ local option=""
+ option=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --menu "Meshtasticd service is $(replace_colors "$(femto-meshtasticd-config.sh -S)")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Using simulated radio\Zn')" 23 50 4 \
+ 1 "View node info" \
+ 2 "View configuration URL & QR code" \
+ 3 "Set new configuration URL" \
+ 4 "Set LoRa radio" \
+ 5 "View admin keys" \
+ 6 "Set admin key" \
+ 7 "Clear admin keys" \
+ 8 "Legacy admin channel" \
+ 9 "Detailed Meshtasticd service status" \
+ 10 "Mesh connectivity test" \
+ 11 "Start/restart Meshtasticd service" \
+ 12 "Stop Meshtasticd service" \
+ 13 "Upgrade/install Meshtasticd" \
+ 14 "Uninstall Meshtasticd" \
+ "" "" \
+ 15 "Back to Main Menu" 3>&1 1>&2 2>&3)
+
+ exit_status=$? # This line checks the exit status of the dialog command
+ if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
+ break
+ fi
+
+ case $option in
+ 1) #View node info)
+ dialog --no-collapse --infobox "Getting Node info..." 5 45
+ dialog --no-collapse --colors --title "Node info" --msgbox "$(replace_colors "$(femto-meshtasticd-config.sh -i)")" 0 0
+ ;;
+ 2) #Get current configuration URL & QR code)
+ dialog --no-collapse --infobox "Getting Meshtastic QR code and URL..." 5 45
+ femto-meshtasticd-config.sh -g
+ pause
;;
- 2) # Set LoRa radio model)
+ 3)
+ newurl=$(dialog --no-collapse --title "Meshtastic URL" --inputbox "New Meshtasticd URL (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3)
+ if [ -n "$newurl" ]; then #if a URL was entered
+ dialog --no-collapse --title "$title" --yesno "New Meshtasticd URL:\n$newurl\n\nConfirm?" 15 60
+ if [ $? -eq 0 ]; then #unless cancel/no
+ femto-meshtasticd-config.sh -q "$newurl"
+ pause
+ fi
+ fi
+ ;;
+ 4)
set_lora_radio
;;
- 3) # get current configuration URL & QR code)
- check_meshtasticd_running && (
- loading "Getting Meshtastic QR code and URL..."
- femto-meshtasticd-config.sh -g
+ 5)
+ dialog --no-collapse --infobox "Getting admin keys..." 5 45
+ dialog --no-collapse --title "Admin keys" --msgbox "Up to 3 admin keys are permitted, more will be ignored.\n\nKeys:$(femto-meshtasticd-config.sh -v | tail -n 1 | sed 's/|n/\\n/g')" 0 0
+ ;;
+ 6) #set admin key)
+ key=$(dialog --no-collapse --title "Meshtastic Admin Key" --inputbox "Meshtastic admin key - up to 3, more will be ignored.\n\n(SHIFT+INS to paste):" 11 40 3>&1 1>&2 2>&3)
+ if [ -n "$key" ]; then #if a URL was entered
+ femto-meshtasticd-config.sh -a "$key"
pause
- )
+ fi
;;
- 4) # Configure automatically with URL)
- check_meshtasticd_running && (
- meshtastic_config_url
- )
+ 7)
+ dialog --no-collapse --title "$title" --yesno "Meshtasticd can have up to 3 admin keys.\nClear admin key list?" 0 0
+ if [ $? -eq 0 ]; then #unless cancel/no
+ femto-meshtasticd-config.sh -c
+ pause
+ fi
;;
- 5) # Meshtastic settings)
- check_meshtasticd_running && (
- dialog --no-collapse --infobox "Loading Meshtastic settings menu...\n\nStopping conflicting services, will restart after exit...\n\nThis can take up to a minute." 9 50
- femto-utils.sh -A stop
- python /opt/control/main.py --host
- echo "Restarting conflicting services..."
- femto-utils.sh -A start
- )
- ;;
- 6) #test mesh connectivity)
- check_meshtasticd_running && (
- dialog --no-collapse --title "Meshtastic Connectivity Test" --yesno "Will send \"test\" to channel 0 and wait for acknowledgement. Will try up to 3 times.\n\nPerform test?" 10 45
- if [ $? -eq 0 ]; then #unless cancel/no
- dialog --no-collapse --infobox "Performing mesh connectivity test.\n\nThis may take a while..." 6 45
- dialog --no-collapse --colors --title "Meshtasticd connectivity test" --msgbox "$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -w)")" 0 0
+ 8) #legacy admin)
+ dialog --no-collapse --infobox "Getting current legacy admin state..." 5 45
+ state=$(sudo femto-meshtasticd-config.sh -p)
+ if echo "$state" | grep -q "True"; then
+ state="Enabled"
+ elif echo "$state" | grep -q "False"; then
+ state="Disabled"
+ elif echo "$state" | grep -q "Error"; then
+ state="Error"
+ fi
+ while true; do
+ choice=$(dialog --no-collapse --title "Meshtasticd Legacy Admin" --menu "Current state: $state" 10 40 5 \
+ 1 "Enable" \
+ 2 "Disable" 3>&1 1>&2 2>&3)
+ exit_status=$? # This line checks the exit status of the dialog command
+ if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
+ break
fi
- )
- ;;
- 7) #manage meshtasticd service)
- choice="" # zero the choice before loading the submenu
- while true; do
- echo "Checking Meshtasticd service state..."
- local service_state="$(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")"
- choice=$(dialog --no-collapse --colors --cancel-label "Back" --title "Meshtasticd Service" --default-item "$choice" --menu "Meshtasticd service is $service_state$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Using simulated radio\Zn')" 16 52 5 \
- "View detailed service status" "x" \
- " " "" \
- "Start/restart service" "x" \
- $(if ! echo "$service_state" | grep -q 'not running'; then echo "Stop service x"; fi) \
- " " "" \
- $(if echo "$service_state" | grep -q 'disabled'; then echo "Enable service x"; fi) \
- $(if echo "$service_state" | grep -q 'enabled'; then echo "Disable service x"; fi) \
- " " "" \
- "Back to previous menu" "x" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
case $choice in
- "View detailed service status")
- echo "Getting Meshtasticd service status..."
- dialog --no-collapse --title "Meshtasticd service status" --msgbox "$(systemctl status meshtasticd)" 0 0
- ;;
- "Start/restart service")
- dialog --no-collapse --title "$title" --yesno "Start/restart Meshtasticd service?" 6 45
- if [ $? -eq 0 ]; then #unless cancel/no
- femto-meshtasticd-config.sh -s
- dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl restart meshtasticd\Zn\` command to system.\n\nMeshtasticd should be running." 9 50
- fi
- ;;
- "Stop service")
- dialog --no-collapse --colors --title "$title" --yesno "Stop Meshtasticd service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn.\n\nMeshtasticd will automatically restart on boot service if enabled." 11 50
- if [ $? -eq 0 ]; then #unless cancel/no
- femto-meshtasticd-config.sh -t
- dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl stop meshtasticd\Zn\` command to system.\n\nMeshtasticd should be stopped." 9 50
- fi
- ;;
- "Enable service")
- dialog --no-collapse --title "$title" --yesno "Enable Meshtasticd service?" 6 45
- if [ $? -eq 0 ]; then #unless cancel/no
- femto-meshtasticd-config.sh -M "enable"
- dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl enable meshtasticd\Zn\` and \`\Zusystemctl start meshtasticd\Zn\` commands to system.\n\nMeshtasticd should be running." 10 50
- fi
- ;;
- "Disable service")
- dialog --no-collapse --colors --title "$title" --yesno "Disable Meshtasticd service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn and will not restart!" 9 50
- if [ $? -eq 0 ]; then #unless cancel/no
- femto-meshtasticd-config.sh -M "disable"
- dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl disable meshtasticd\Zn\` and \`\Zusystemctl stop meshtasticd\Zn\` commands to system.\n\nMeshtasticd should be disabled and stopped." 10 50
- fi
- ;;
- "Back to previous menu") break ;;
+ 1) femto-meshtasticd-config.sh -o "true" && break ;;
+ 2) femto-meshtasticd-config.sh -o "false" && break ;;
esac
done
;;
- 8) #i2c)
- choice="" # zero the choice before loading the submenu
- while true; do
- i2c_state=$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -I check)")
- choice=$(dialog --no-collapse --colors --cancel-label "Back" --title "Meshtastic i2c Support" --default-item "$choice" --menu "i2c is used for sensors and displays.\nCurrently \Zu$i2c_state." 12 42 5 \
- $(if echo "$i2c_state" | grep -q 'disabled'; then echo "Enable i2c x"; fi) \
- $(if echo "$i2c_state" | grep -q 'enabled'; then echo "Disable i2c x"; fi) \
- " " "" \
- "Back" "x" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- case $choice in
- "Enable i2c")
- dialog --no-collapse --colors --title "Meshtastic i2c Support" --yesno "Enable i2c?\n\nEnabling i2c without devices connected will lead to slowdowns and error messages." 9 47
- if [ $? -eq 0 ]; then #unless cancel/no
- femto-meshtasticd-config.sh -I enable
- fi
- ;;
- "Disable i2c")
- dialog --no-collapse --colors --title "Meshtastic i2c Support" --yesno "Disable i2c?\n\nDisabling i2c will only apply to Meshtastic, not to Foxbuntu." 9 50
- if [ $? -eq 0 ]; then #unless cancel/no
- femto-meshtasticd-config.sh -I disable
- fi
- ;;
- "Back") break ;;
- esac
- done
+ 9) #check meshtasticd service status)
+ dialog --no-collapse --infobox "Getting Meshtasticd service status..." 5 45
+ dialog --no-collapse --title "Meshtasticd service status" --msgbox "$(systemctl status meshtasticd)" 0 0
;;
- 9) #Upgrade meshtasticd)
+ 10) #test mesh connectivity)
+ dialog --no-collapse --title "Meshtastic connectivity test" --yesno "Will send \"test\" to channel 0 and wait for acknowledgement. Will try up to 3 times.\n\nPerform test?" 10 45
+ if [ $? -eq 0 ]; then #unless cancel/no
+ dialog --no-collapse --infobox "Performing mesh connectivity test.\n\nThis may take a while..." 6 45
+ dialog --no-collapse --colors --title "Meshtasticd service status" --msgbox "$(replace_colors "$(femto-meshtasticd-config.sh -r)")" 0 0
+ fi
+ ;;
+ 11) #start/restart meshtasticd)
+ dialog --no-collapse --title "$title" --yesno "Start/restart Meshtasticd service?" 5 45
+ if [ $? -eq 0 ]; then #unless cancel/no
+ femto-meshtasticd-config.sh -s
+ dialog --no-collapse --msgbox "Meshtasticd service started/restarted." 5 45
+ fi
+ ;;
+ 12) #stop meshtasticd)
+ dialog --no-collapse --title "$title" --yesno "Stop Meshtasticd service?" 5 45
+ if [ $? -eq 0 ]; then #unless cancel/no
+ femto-meshtasticd-config.sh -t
+ dialog --no-collapse --msgbox "Meshtasticd service stopped." 5 45
+ fi
+ ;;
+ 13) #Upgrade meshtasticd)
dialog --no-collapse --title "$title" --yesno "Upgrade Meshtasticd?\nRequires internet connection." 0 0
if [ $? -eq 0 ]; then #unless cancel/no
- femto-meshtasticd-config.sh -z
+ femto-meshtasticd-config.sh -u
pause
fi
;;
- 10) #uninstall meshtasticd)
- dialog --no-collapse --colors --title "$title" --yesno "Uninstall Meshtasticd?\n\nFoxbuntu was designed with Meshtasticd integration in mind, and may behave unexpectedly if Meshtasticd is removed.\n\nThis will take the node \Zu\Z1OFFLINE\Zn and will not restart!" 0 0
+ 14) #uninstall meshtasticd)
+ dialog --no-collapse --title "$title" --yesno "Uninstall Meshtasticd?\n\nFoxbuntu was designed with Meshtasticd integration in mind, and may behave unexpectedly if Meshtasticd is removed." 0 0
if [ $? -eq 0 ]; then
femto-meshtasticd-config.sh -x
- dialog --no-collapse --colors --msgbox "Meshtasticd uninstalled. To purge all remnants, run \`\Zusudo apt purge\Zn\`." 8 40
+ dialog --no-collapse --msgbox "Meshtasticd uninstalled. To purge all remnants, run \`sudo apt purge\`.\nAfter reinstallation but before first launch, run the \"first boot script\" from the misc menu." 8 40
fi
;;
- 11)
+ 15)
return
;;
esac
@@ -664,43 +553,32 @@ meshtastic_settings() {
help_menu() {
while true; do
local title="Help / About"
- help_choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$help_choice" --item-help --menu "$title" 0 0 7 \
- 1 "About Femtofox" "" \
- 2 "Display pinout" "" \
- 3 "Femtofox licensing info - short" "" \
- 4 "Femtofox licensing info - long" "" \
- 5 "Meshtastic licensing info" "" \
- 6 "About Luckfox" "" \
- 7 "About Ubuntu" "" \
- " " "" "" \
- 8 "Back to main menu" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- case $help_choice in
+ local option=""
+ option=$(dialog --no-collapse --cancel-label "Back" --menu "$title" 0 0 7 \
+ 1 "About Femtofox" \
+ 2 "Display pinout" \
+ 3 "Femtofox licensing info - short" \
+ 4 "Femtofox licensing info - long" \
+ 5 "Meshtastic licensing info" \
+ 6 "About Luckfox" \
+ 7 "About Ubuntu" \
+ "" "" \
+ 8 "Back to Main Menu" 3>&1 1>&2 2>&3)
+
+ exit_status=$? # This line checks the exit status of the dialog command
+ if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
+ break
+ fi
+
+ case $option in
1) #About Femtofox)
- dialog --no-collapse --title "About Femtofox" --default-item "$choice" --backtitle "$(femto-utils.sh -v)" --msgbox "$(femto-license.sh -a)" 18 65
+ dialog --no-collapse --title "About Femtofox" --backtitle "Foxbuntu $(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'patch=\K[0-9]+' /etc/foxbuntu-release)$(grep -oP 'hotfix=\K[a-z]+' /etc/foxbuntu-release)" --msgbox "$(femto-license.sh -a)" 18 65
;;
2) #Display pinout)
- choice="" # zero the choice before loading the submenu
- while true; do
- choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$choice" --item-help --menu "Pinouts" 15 40 5 \
- 1 "Femtofox Pro/CE" "" \
- 2 "Femtofox Zero" "" \
- 3 "Femtofox Tiny" "" \
- 4 "Luckfox Pico Mini" "" \
- " " "" "" \
- 5 "Back to Help Menu" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- case $choice in
- 1) dialog --no-collapse --title "Femtofox" --msgbox "$(femto-pinout.sh -f)" 42 68 ;;
- 2) dialog --no-collapse --title "Femtofox Zero" --msgbox "$(femto-pinout.sh -z)" 34 48 ;;
- 3) dialog --no-collapse --title "Femtofox Tiny" --msgbox "$(femto-pinout.sh -t)" 38 70 ;;
- 4) dialog --no-collapse --title "Luckfox Pico Mini" --msgbox "$(femto-pinout.sh -l)" 23 65 ;;
- 5) break ;;
- esac
- done
+ femto_pinouts
;;
3) #Femtofox licensing info - short)
- dialog --no-collapse --title "Femtofox license" --msgbox "$(femto-license.sh -f)" 31 65
+ dialog --no-collapse --title "Femtofox license" --msgbox "$(femto-license.sh -f)" 28 60
;;
4) #Femtofox licensing info - long)
clear
@@ -727,55 +605,60 @@ help_menu() {
help="If script is run without arguments, femto-config menu will load.\n\
Options are:\n\
-h This message\n\
--l Set LoRa radio model menu\n\
--L Meshtastic legacy admin menu\n\
--w Set Wi-Fi config menu\
--c Check if Meshtasticd is running and warn the user if not\
-"
-while getopts ":hluLwc" opt; do
+-l Set LoRa radio cpu_model menu\n\
+-w Set Wi-Fi config menu\n\
+-L \"true\" Set system logging true/false/check
+-i Get system info"
+while getopts ":hlwL:i" opt; do
case ${opt} in
h) # Option -h (help)
echo -e $help
- ;;
+ ;;
l) # Option -l (set lora radio)
set_lora_radio
;;
- u) # Option -u (set meshtastic URL)
- meshtastic_config_url
- ;;
- L) # Option -L (Meshtastic legacy admin menu)
- legacy_admin
- ;;
w) # Option -w (Wi-Fi config)
wifi_config
;;
- c) # Option -c (Check if Meshtasticd is running and warn the user if not)
- check_meshtasticd_running
- exit $?
+ L) # Option -L (Logging)
+ logging $OPTARG
;;
+ i) system_info ;;
\?) # Unknown option)
echo -e "Unknown argument $1.\n$help"
;;
+ :) # Missing argument for option)
+ echo "Option -$OPTARG requires a setting."
+ echo -e "$help"
+ exit 1
+ ;;
esac
done
-[ -n "$1" ] && exit # if there were arguments, exit before loading the menu
-
+if [ -n "$1" ]; then
+ exit
+fi
# Main menu
while true; do
- main_menu_choice=$(dialog --no-collapse --cancel-label "Exit" --backtitle "$(femto-utils.sh -v)" --default-item "$main_menu_choice" --item-help --menu "Femtofox Config" 16 40 5 \
- 1 "Settings wizard" "" \
- 2 "Networking" "" \
- 3 "Meshtastic" "" \
- 4 "Software manager" "" \
- 5 "Utilities & tools" "" \
- 6 "Help" "" \
- " " "" "" \
- 7 "Exit" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- case $main_menu_choice in
+ choice=$(dialog --no-collapse --title "$(date)" --cancel-label "Exit" --menu "Femtofox Config" 15 40 5 \
+ 1 "Settings wizard" \
+ 2 "Networking" \
+ 3 "Meshtasticd" \
+ 4 "Software manager" \
+ 5 "Utilities" \
+ 6 "Help" \
+ "" "" \
+ 7 "Exit" 3>&1 1>&2 2>&3)
+
+ exit_status=$? # This line checks the exit status of the dialog command
+
+ if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
+ break
+ fi
+
+ case $choice in
1) femto-install-wizard.sh ;;
2) networking_settings ;;
- 3) meshtastic_settings ;;
+ 3) meshtasticd_settings ;;
4) femto-software.sh ;;
5) utilities ;;
6) help_menu ;;
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh
index 2d92d35..567a4c5 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh
@@ -9,8 +9,10 @@ if [[ $EUID -ne 0 ]]; then
exit 1
fi
-loading() {
- dialog --no-collapse --infobox "$1" 5 45
+# pause
+pause() {
+ echo "Press any key to continue..."
+ read -n 1 -s -r
}
title="Install Wizard"
@@ -19,82 +21,63 @@ wizard() {
femto-set-time.sh
- new_hostname=$(dialog --title "Hostname" --cancel-label "Skip" --inputbox "Enter hostname:" 8 40 $(hostname) 3>&1 1>&2 2>&3)
+ new_hostname=$(dialog --title "$title" --cancel-label "Skip" --inputbox "Enter hostname:" 8 40 $(hostname) 3>&1 1>&2 2>&3)
if [ $? -eq 0 ]; then #unless cancel/no
femto-network-config.sh -n "$new_hostname"
- dialog --title "Hostname" --msgbox "\nFemtofox is now reachable at\n$new_hostname.local" 8 40
+ dialog --title "$title" --msgbox "\nFemtofox is now reachable at\n$new_hostname.local" 8 40
fi
- dialog --title "$title" --yesno "Configure Wi-Fi settings?" 6 40
+ dialog --title "$title" --cancel-label "Skip" --yesno "\nConfigure Wi-Fi settings?" 8 40
if [ $? -eq 0 ]; then #unless cancel/no
femto-config -w
fi
- dialog --title "$title" --yesno "Configure Meshtastic?" 6 40
+ dialog --title "$title" --cancel-label "Skip" --yesno "\nConfigure Meshtastic?" 8 40
if [ $? -eq 0 ]; then #unless cancel/no
- if femto-config -c; then
- while true; do
- meshtastic_menu_choice=$(dialog --no-collapse --colors --cancel-label "Continue" --default-item "$meshtastic_menu_choice" --title "Meshtastic Configuration" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")" 16 40 5 \
- 1 "Set LoRa radio model" "" \
- 2 "Set configuration URL" "" \
- 3 "Set private key" "" \
- 4 "Set public key" "" \
- " " "" "" \
- 5 "Full Meshtastic settings menu" "" \
- " " "" "" \
- 6 "Continue" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- case $meshtastic_menu_choice in
- 1) # Set LoRa radio model)
- femto-config -l
- ;;
- 2) # Configure automatically with URL)
- femto-config -c && (
- femto-config -u
- )
- ;;
- 3) # view/change private key)
- femto-config -c && (
- key=$(dialog --no-collapse --colors --title "Meshtastic Private Key" --cancel-label "Cancel" --inputbox "The private key of the device, used to create a shared key with a remote device for secure communication.\n\n\Z1This key should be kept confidential.\nSetting an invalid key will lead to unexpected behaviors.\Zn\n\nPrivate key (default: random)" 15 60 3>&1 1>&2 2>&3)
- if [ $? -eq 0 ] && [[ -n "$key" ]]; then #unless cancel/no
- loading "Sending command..."
- dialog --no-collapse --colors --title "Meshtastic Private Key" --msgbox "$(femto-meshtasticd-config.sh -R "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0
- fi
- )
- ;;
- 4) # view/change public key)
- femto-config -c && (
- key=$(dialog --no-collapse --colors --title "Meshtastic Public Key" --cancel-label "Cancel" --inputbox "The public key of the device, shared with other nodes on the mesh to allow them to compute a shared secret key for secure communication.\n\n\ZuGenerated automatically\Zn to match private key.\n\n\Z1Don't change this if you don't know what you're doing.\Zn\n\nPublic key (default: generated from private key)" 16 60 3>&1 1>&2 2>&3)
- if [ $? -eq 0 ] && [[ -n "$key" ]]; then #unless cancel/no
- loading "Sending command..."
- dialog --no-collapse --colors --title "Meshtastic Public Key" --msgbox "$(femto-meshtasticd-config.sh -U "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0
- fi
- )
- ;;
- 5) # Full Meshtastic settings menu)
- femto-config -c && (
- dialog --no-collapse --infobox "Loading Meshtastic settings menu...\n\nStopping conflicting services, will restart after exit...\n\nThis can take up to a minute." 9 50
- femto-utils.sh -A stop
- python /opt/control/main.py --host
- femto-utils.sh -A start
- )
- ;;
- 6) # return to previous menu)
- break
- ;;
- esac
- done
+ newurl=$(dialog --title "Meshtastic URL" --cancel-label "Skip" --inputbox "New Meshtasticd URL (SHIFT+INS to paste):" 8 50 3>&1 1>&2 2>&3)
+ if [ -n "$newurl" ]; then #if a URL was entered
+ femto-meshtasticd-config.sh -q "$newurl"
+ pause
fi
+
+ femto-config -l
+
+ key=$(dialog --title "$title" --cancel-label "Skip" --inputbox "Enter Meshtastic admin key (optional). If 3 admin keys are already in Meshtastic, more will be ignored.\n(SHIFT+INS to paste):" 11 50 3>&1 1>&2 2>&3)
+ if [ -n "$key" ]; then #if a URL was entered
+ femto-meshtasticd-config.sh -a "$key"
+ pause
+ fi
+
+ while true; do
+ choice=$(dialog --title "$title" --cancel-label "Skip" --menu "Enable/disable Meshtastic Legacy admin channel?" 12 40 5 \
+ 1 "Enable" \
+ 2 "Disable (default)" \
+ "" "" \
+ 3 "Skip" 3>&1 1>&2 2>&3)
+
+ exit_status=$? # This line checks the exit status of the dialog command
+
+ if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
+ break
+ fi
+
+ case $choice in
+ 1) femto-meshtasticd-config.sh -o "true" && break ;;
+ 2) femto-meshtasticd-config.sh -o "false" && break ;;
+ 3) break ;;
+ *) dialog --msgbox "Invalid choice, please try again." 8 40 ;;
+ esac
+ done
fi
- dialog --title "$title" --msgbox "Setup wizard complete!" 6 40
+ dialog --title "$title" --msgbox "\nSetup wizard complete!" 8 40
}
dialog --title "$title" --yesno "\
The install wizard will allow you to configure all the settings necessary to run your Femtofox.\n\
\n\
-The wizard takes several minutes to complete and will overwrite some current settings.\n\n\
-Proceed?" 12 60
+Running this wizard will overwrite some current settings.\n\
+Proceed?" 0 0
if [ $? -eq 0 ]; then #unless cancel/no
wizard
fi
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh
index af4f24b..4069523 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh
@@ -1,26 +1,13 @@
#!/bin/bash
-if [[ $EUID -ne 0 ]]; then
- echo "This script must be run as root."
- echo "Try \`sudo femto-config\`."
- exit 1
-fi
-
help=$(cat <> /etc/modules
fi
- echo -e "\033[4m$1\033[0m has been enabled and will be started at boot.\n\nSome modules are unloaded automatically when not in use."
+ echo "$1 has been enabled and will be started at boot."
else
- echo -e "Failed to enable \033[4m$1\033[0m."
exit 1
fi
elif [ $2 = "disable" ]; then
- rmmod $1 > /dev/null 2>&1 # Unload the module
- sed -i "/^$1$/d" /etc/modules
- echo -e "\033[4m$1\033[0m has been disabled and removed from boot.\n\nIt may be automatically loaded if compatible hardware is detected."
+ rmmod $1 # Disable the module
+ if [ $? -eq 0 ]; then
+ sed -i "/^$1$/d" /etc/modules
+ echo "$1 has been disabled and removed from boot."
+ else
+ exit 1
+ fi
else
echo "Invalid argument \"$2\".\n$help"
fi
}
-module_blacklist() {
- if [ $1 = "list" ]; then
- echo -e "$(ls "$module_dir"/*.blacklisted 2>/dev/null | sed -E 's|.*/([^.]*)\..*|\1|' | awk '{for(i=1;i<=NF;i++) {printf "\033[4m%s\033[0m", $i; if(i /dev/null 2>&1
- module_switch $1 disable > /dev/null 2>&1 # unload and disable the module
- echo -e "$1 is blacklisted. A reboot is sometimes required for blacklisting to fully take effect."
- elif [ $2 = "un-blacklist" ]; then
- mv "$module_dir/$1.ko.blacklisted" "$module_dir/$1.ko" > /dev/null 2>&1
- echo -e "$1 is un-blacklisted. A reboot is sometimes required for un-blacklisting to fully take effect."
- else
- echo "Invalid argument \"$1 $2\".\n$help"
- fi
-}
-
# Parse options
-while getopts ":hbax:z:y" opt; do
+while getopts ":hx" opt; do
case ${opt} in
h) # Option -l (set lora radio)
echo "$help"
exit 0
;;
- b) # kernel modules set to start at boot)
- echo -e "$(modules=$(sed -n '6,$p' /etc/modules | awk '{printf "\033[4m%s\033[0m ", $0}'); [ -z "$modules" ] && echo "\033[4mnone\033[0m" || echo "$modules")"
- ;;
- a) # kernel modules currently active)
- echo -e "$(modules=$(lsmod | awk 'NR>1 {printf "\033[4m%s\033[0m ", $1}'); [ -z "$modules" ] && echo "none" || echo "$modules")"
- ;;
x) # Option -x (Set kernel module status (enable/disable))
echo "$(module_switch $2 $3)"
;;
- z) # Option -z (Set kernel module blacklist status (blacklist/un-blacklist))
- echo "$(module_blacklist $2 $3)"
- ;;
- y) # Option -y (Get list of blacklisted kernel modules)
- echo "$(module_blacklist "list")"
- ;;
esac
done
if [ -n "$1" ]; then # if there are arguments, don't proceed to menu
exit
fi
-dialog --no-collapse --colors --title "$title" --yesno "\
-Kernel modules are loadable pieces of code that extend a Linux kernel's functionality without requiring a reboot. Common examples include device drivers, file systems, or system calls.\n\
-\n\
-This tool will allow you to manage kernel modules and add pre-compiled modules to Foxbuntu.\n\
-\n\
-Boot modules: $(femto-utils.sh -R "$(femto-kernel-modules.sh -b)")\n\
-Blacklisted modules: $(femto-utils.sh -R "$(femto-kernel-modules.sh -y)")\n\
-Active modules: $(femto-utils.sh -R "$(femto-kernel-modules.sh -a)")\n\
-\n\
-Continue?
-" 0 0
-[ ! $? -eq 0 ] && exit 1
+dialog --infobox "Loading kernel module menu..." 5 45
-load_modules() {
- dialog --infobox "Loading kernel module menu...\n\nExpected load time: 35 seconds." 6 45
- modules=("Module name" "L/D Description" "" "")
+modules=()
- # Create a list of modules (filename minus the .ko)
- for module in $(ls $module_dir/*.ko*); do
- module_name=$(basename "$module" | sed 's/\([^.]*\).*/\1/')
- modules+=("$module_name" "$(lsmod | grep -q "^$module_name " && echo ✅ || echo ❌)$(femto-kernel-modules.sh -b | sed 's/\x1b\[[0-9;]*m//g' | grep -qw "$module_name" && echo ✅ || echo ❌) $(basename "$module" | grep -q "blacklisted" && echo "BLACKLISTED" || modinfo "$module_name" | grep -i 'description' | cut -d: -f2 | sed 's/^[ \t]*//' )")
- done
- modules_changed="false"
-}
-
-load_modules
-modules_changed="false"
+# Create a list of modules (filename minus the .ko)
+for module in $(ls "/lib/modules/5.10.160"/*.ko); do
+ module_name=$(basename "$module" .ko)
+ modules+=("$module_name" "$(modinfo $module_name | grep -i 'description' | cut -d: -f2 | sed 's/^[ \t]*//')")
+done
while true; do
- [ $modules_changed = "true" ] && load_modules
# Create the menu options
- selected_module=$(dialog --no-collapse --cancel-label "Return" --ok-label "Open" --title "$title" --no-shadow --default-item "$selected_module" --help-button --menu "" 42 103 8 "${modules[@]}" 3>&1 1>&2 2>&3)
- exit_status=$?
- if [ $exit_status -eq 1 ]; then # "Return" button
+ option=$(dialog --cancel-label "Back" --title "Kernel Modules" --menu "" 42 103 8 "${modules[@]}" 3>&1 1>&2 2>&3)
+
+ exit_status=$? # Check the exit status of the dialog command
+
+ if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
break
- elif [ $exit_status -eq 2 ]; then # "Help" button
- dialog --no-collapse --colors --title "Kernel Module Manager Help" --msgbox "In the kernel module manager menu,\nL=Module is loaded\nB=Module is set to start at boot.\n\nIf module is blacklisted, \`BLACKLISTED\` will show in the description." 0 0
+ fi
+
+ # Get the module name from the selection
+ selected_module=$option
+
+ # Get the full modinfo for the module and process it for dialog
+ modinfo_output=$(modinfo $selected_module | sed ':a;N;$!ba;s/\n/\\n/g') # add \n to module info
+
+ # Check if the module is currently enabled
+ if lsmod | grep -q "^$selected_module "; then
+ dialog --colors --title "Disable Module" --yesno "The module '$selected_module' is currently \Z2\Zuenabled\Zn.\n\nDo you want to disable it?\n\nFull module info:\n$modinfo_output\n\nNote: Unused dependencies will be removed automatically." 25 0
+ if [ $? -eq 0 ]; then
+ dialog --msgbox "$(module_switch $selected_module disable)" 7 60
+ fi
else
- [ "$selected_module" = "" ] || [ "$selected_module" = "Module name" ] && continue # do nothing if no valid module name is selected
- modules_changed="false"
- # Get the full modinfo for the module and process it for dialog
- while true; do
- modinfo_output=$(modinfo $selected_module 2>/dev/null | sed ':a;N;$!ba;s/\n/\\n/g') # add \n to module info
-
- if [ ! -e "$module_dir/$selected_module.ko" ]; then
- module_info="\Z1\ZuMODULE BLACKLISTED!\Zn\n\n$selected_module has been blacklisted and will not load on boot.\
- $(lsmod | grep -q "^$selected_module " && echo "\n\n$selected_module is currently \Z4\Zuloaded\Zn!\n\
-Some modules require reboot for blacklist to take effect if they're in use when blacklisted.")"
- else
- module_info="Module is currently $(lsmod | grep -q "^$selected_module " && echo "\Z4loaded\Zn" || echo "\Z1unloaded\Zn") and is set $(femto-utils.sh -R "$(femto-kernel-modules.sh -b | sed 's/\x1b\[[0-9;]*m//g' | grep -qw "$selected_module" && echo "\Z4to load at boot\Zn" || echo "\Z1not to load at boot\Zn. It may load automatically if needed")").\n\
-\n\
-Full module info:\n$modinfo_output\n\nNote: Dependencies are loaded/unloaded automatically."
- fi
-
- dialog --colors --yes-label "Return" --no-label "Disable" --extra-button --extra-label "Enable" --help-button --help-label "Blacklist" --title "$selected_module" --yesno "$module_info" 0 0
-
- exit_status=$? # This line checks the exit status of the dialog command
- if [ $exit_status -eq 0 ]; then # "Back" button
- break
- elif [ $exit_status -eq 3 ]; then # "Enable" button
- dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module enable)")" 0 0
- modules_changed="true"
- elif [ $exit_status -eq 1 ]; then # "Disable" button
- dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module disable)")" 0 0
- modules_changed="true"
- elif [ $exit_status -eq 2 ]; then # "Blacklist" button
- dialog --no-collapse --colors --title "$selected_module" --yes-label "Return" --no-label "Un-blacklist" --extra-button --extra-label "Blacklist" --yesno "$selected_module is currently $([ -e "$module_dir/$selected_module.ko" ] && echo "\Z4\Zunot blacklisted\Zn" || echo "\Z1\Zublacklisted\Zn").\n\nBlacklisting prevents a kernel module from loading.\n\nWould you like to blacklist $selected_module?" 0 0
- exit_status=$?
- if [ $exit_status -eq 0 ]; then
- continue
- elif [ $exit_status -eq 3 ]; then # blacklist
- dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_blacklist $selected_module blacklist)")" 8 50
- modules_changed="true"
- else # blacklist
- dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_blacklist $selected_module un-blacklist)")" 8 50
- modules_changed="true"
- fi
- fi
- done
+ dialog --colors --title "Enable Module" --yesno "The module '$selected_module' is currently \Z1disabled\Zn.\n\nDo you want to enable it?\n\nFull module info:\n$modinfo_output\n\nNote: Dependencies will be loaded automatically." 25 0
+ if [ $? -eq 0 ]; then
+ dialog --msgbox "$(module_switch $selected_module enable)" 7 60
+ fi
fi
done
-
-exit 0
+exit 0
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh
index 0490eb6..f73c1ba 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh
@@ -11,30 +11,26 @@ Options are:
EOF
)
-pause() {
- echo -e "\nPress any key to continue..."
- read -n 1 -s -r
-}
+anykey="echo -e \"\nPress any key to continue...\n\" && read -n 1 -s -r"
femtofox_short_license="\
-Femtofox is comprised of two projects, with two different licenses:\n\
-1. Femtofox - the hardware, which is licensed \"CC BY-NC-ND - noncommercial\". Summary: you may copy and share and modify the hardware files, but cannot sell them without license from Femtofox, and must give attribution to Femtofox.\n\
-2. Foxbuntu - refers to the modifications to Ubuntu made as part of the Femtofox project, which is licensed GNU GPLv3. Summary: you may use, modify and distribute (including for commercial purposes) Foxbuntu, but must give attribution to Femtofox and distribute this license with your project. Any modified version must remain open source.\n\
-\n\
+Femtofox and Foxbuntu are published under CC BY-NC-ND - noncommercial.\n\
For more information, visit us at www.femtofox.com.\n\
\n\
-View the long licenses for more information.\n\
+Summary:\n\
+You can share Femtofox and Foxbuntu or make modifications, but can't sell it except by arrangement (license) with us.\n\
+In this context, Foxbuntu refers to the modifications to Ubuntu made as part of the Femtofox project.\n\
+\n\
+Boilerplate:\n\
+Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made.\n\
+You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.\n\
+NonCommercial — You may not use the material for commercial purposes.\n\
+NoDerivatives — If you remix, transform, or build upon the material, you may not distribute the modified material (for commercial purposes).\n\
+\n\
Contact us to license Femtofox."
meshtastic_license="\
-The Meshtastic firmware is licensed GPL3.\n\
-\n\
-Meshtastic is a registered trademark of Meshtastic LLC. Meshtastic software components are released under various licenses, see GitHub for details. No warranty is provided - use at your own risk.\n\
-\n\
-Some of the verbiage in the help-texts in the menus is sourced from the Meshtastic website, also licensed GPL3.\n\
-\n\
-For more information about Meshtastic, visit https://www.meshtastic.org\
-"
+Meshtastic is a registered trademark of Meshtastic LLC. Meshtastic software components are released under various licenses, see GitHub for details. No warranty is provided - use at your own risk."
luckfox_license="Luckfox and Luckfox Pico Mini are property of Luckfox Technology. Femtofox does not represent Luckfox Technology in any way, shape or form. Visit their website at https://www.luckfox.com/."
@@ -95,7 +91,7 @@ https://www.femtofox.com\n\
u) # Option -u (Ubuntu licenses)
echo "$ubuntu_license"
;;
- \?) # Invalid option)
+ \?) # Invalid option
echo "Invalid option: -$OPTARG"
echo -e "$help"
exit 1
@@ -106,13 +102,13 @@ done
# if no arguments, show all licenses
if [ $# -eq 0 ]; then
echo "$femtofox_short_license"
- pause
+ eval $anykey
echo "$(cat /usr/share/doc/femtofox/long_license)"
- pause
+ eval $anykey
echo "$meshtastic_license"
- pause
+ eval $anykey
echo "$luckfox_license"
- pause
+ eval $anykey
eval "$ubuntu_license"
- pause
+ eval $anykey
fi
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh
index 59b1819..6d8328e 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh
@@ -8,27 +8,20 @@ help=$(cat <&1 | tee /dev/fd/2) # display the output on screen live. Use eval so quotes will be handled correctly in $command
- logger "$output"
- if echo "$output" | grep -qiE "Abort|invalid|Error|error|unrecognized|refused|Errno|failed|Failed"; then
+ local output=$(meshtastic --host $command) #>&2 lets meshtastic's output display on screen
+ echo $output
+ logger $output
+ if echo "$output" | grep -qiE "Abort|invalid|Error|refused|Errno"; then
if [ "$retries" -lt $attempts ]; then
local msg="${ref:+$ref}Meshtastic command failed, retrying ($(($retries + 1))/$attempts)..."
echo "$msg"
logger "$msg"
- femto-meshtasticd-config.sh -s
sleep 2 # Add a small delay before retrying
fi
else
@@ -70,7 +62,6 @@ meshtastic_update() {
fi
done
if [ -z "$success" ]; then
- echo -e "$output"
msg="${ref:+$ref}Meshtastic command FAILED."
echo "$msg"
logger "$msg"
@@ -78,146 +69,38 @@ meshtastic_update() {
fi
}
-get_meshtastic_settings() {
- for retries in $(seq 1 3); do
- if meshtastic_info=$(meshtastic --host --info); then # if successful
- success="true"
- break
- else # if failed
- if [ "$retries" -lt 3 ]; then # if under 3 retries
- echo "Meshtastic command failed, retrying ($(($retries + 1))/3)..."
- femto-meshtasticd-config.sh -s
- sleep 2 # Add a small delay before retrying
- fi
- fi
- done
- if [ -z "$success" ]; then # if failed all retries
- echo "Meshtastic command FAILED."
- exit 1 # always exit script if failed
- fi
-
- if [[ "$1" == *"all"* ]] || [[ "$1" == *"nodeinfo"* ]]; then
- # myInfo
- eval "myInfo_owner='$(echo "$meshtastic_info" | grep "^Owner: " | sed 's/^Owner: //')'"
- [[ "$1" != *"quiet"* ]] && echo "myInfo_owner:$myInfo_owner"
- while IFS="=" read -r varname value; do
- eval "myInfo_$varname='$value'" # Create a variable with the formatted name
- [[ "$1" != *"quiet"* ]] && echo "myInfo_$varname:$value"
- done < <(
- echo "$(echo "$meshtastic_info" | grep '^My info: ' | sed 's/^My info: //')" |
- jq -r 'to_entries[] | "\(.key)=\(.value)"'
- )
-
- # metadata
- while IFS="=" read -r varname value; do
- eval "metadata_$varname='$value'" # Create a variable with the formatted name
- [[ "$1" != *"quiet"* ]] && echo "metadata_$varname:$value"
- done < <(
- echo "$(echo "$meshtastic_info" | grep '^Metadata: ' | sed 's/^Metadata: //')" |
- jq -r 'to_entries[] | "\(.key)=\(.value)"'
- )
- metadata_nodedbCount=$(echo "$meshtastic_info" | grep -oP '"![a-zA-Z0-9]+":\s*\{' | wc -l)
- [[ "$1" != *"quiet"* ]] && echo "metadata_nodedbCount:$metadata_nodedbCount"
-
- # nodeinfo
- while IFS='=' read -r var value; do
- eval "nodeinfo_$var=\"$value\""
- [[ "$1" != *"quiet"* ]] && echo "nodeinfo_$var:$value"
- done < <(echo "$(echo "$meshtastic_info" | sed -n '/Nodes in mesh:/,$p' | sed '1s/^Nodes in mesh: *//' | sed '/^[[:space:]]*$/q' | jq -r 'to_entries | .[0] | "\(.key)=\(.value)"' | sed 's/^[^=]*=//;s/^[ \t]*}//')" | jq -r '
- def recurse:
- if type == "object" then
- to_entries | .[] | "\(.key)=\(.value | recurse)"
- elif type == "array" then
- . | tostring
- else
- .
- end;
- recurse' | sed '/=/ {s/\(.*\)=\(.*\)=/\1_\2=/; }'
- )
- fi
-
- if [[ "$1" == *"all"* ]] || [[ "$1" == *"settings"* ]]; then
- # settings
- while IFS="=" read -r varname value; do
- eval "$varname='$value'"
- [[ "$1" != *"quiet"* ]] && echo "$varname:$value"
- done < <(
- echo "$(echo "$meshtastic_info" | sed -n '/Preferences: {/,$p' | sed '1s/.*/{/; /^[[:space:]]*$/q')" |
- jq -r 'to_entries[] | select(.value | type == "object") | .key as $block | .value | to_entries[] | "\($block)_\(.key)=\(.value)"'
- )
-
- # module settings
- while IFS="=" read -r varname value; do
- eval "$varname='$value'"
- [[ "$1" != *"quiet"* ]] && echo "$varname:$value"
- done < <(
- echo "$(echo "$meshtastic_info" | sed -n '/Module preferences: {/,$p' | sed '1s/.*/{/; /^[[:space:]]*$/q')" |
- jq -r 'to_entries[] | select(.value | type == "object") | .key as $block | .value | to_entries[] | "\($block)_\(.key)=\(.value)"'
- )
- fi
-
- if [[ "$1" == *"all"* ]] || [[ "$1" == *"channels"* ]]; then
- # channels
- while read index line; do
- channel_type=$(echo "$line" | awk '{print $3}')
- psk_type=$(echo "$line" | grep -o 'psk=[^ ]*' | cut -d= -f2)
- eval "channel${index}_type='$channel_type'"
- [[ "$1" != *"quiet"* ]] && echo "channel${index}_type:$channel_type"
- eval "channel${index}_psk_type='$psk_type'"
- [[ "$1" != *"quiet"* ]] && echo "channel${index}_psk_type:$psk_type"
-
- # get the json portion of the channel listing
- while IFS=":" read -r key value; do
- eval "$key='$value'"
- [[ "$1" != *"quiet"* ]] && echo "$key:$value"
- done < <(
- echo "$(echo "$line" | sed 's/.*\({.*\)/\1/')" | jq -r 'to_entries | .[] | "channel'${index}'_\(.key):\(.value)"'
- )
- done < <(
- echo "$meshtastic_info" | awk '/Channels:/ {f=1; next} f && NF {print} f && !NF {exit}' | nl -v 0
- )
-
- eval "url_primary_channel='$(echo "$meshtastic_info" | sed -n 's/^Primary channel URL: //p')'"
- [[ "$1" != *"quiet"* ]] && echo "url_primary_channel:$url_primary_channel"
- if echo "$meshtastic_info" | grep -q "^Complete URL (includes all channels): "; then
- url_all_channels=$(echo "$meshtastic_info" | sed -n 's/^Complete URL (includes all channels): //p')
- [[ "$1" != *"quiet"* ]] && echo "url_all_channels:$url_all_channels"
- fi
- fi
-}
-
# Parse options
-while getopts ":hiC:gkl:q:uU:rR:aA:cpo:sM:StI:wuzxm" opt; do
+while getopts ":higkl:q:va:cpo:sStruxm" opt; do
case ${opt} in
h) # Option -h (help)
echo -e "$help"
;;
i) # Option -i (Get important node info)
- get_meshtastic_settings quiet,nodeinfo,settings
+ output=$(meshtastic --host --info)
+ preset_or_settings="Use preset? $(echo "$output" | grep -oP '"usePreset":\s*\K\w+')\n"
+ if echo "$output" | grep -qP '"usePreset":\s*true'; then
+ preset_or_settings+="Preset: $(echo "$output" | grep -oP '"modemPreset":\s*"\K[^"]+')"
+ else
+ preset_or_settings+="\
+Bandwidth: $(echo "$output" | grep -oP '"bandwidth":\s*\K\w+')\n\
+Spread factor: $(echo "$output" | grep -oP '"spreadFactor":\s*\K\w+')\n\
+Coding rate: $(echo "$output" | grep -oP '"codingRate":\s*\K\w+')"
+ fi
echo -e "\
-Service:$(femto-meshtasticd-config.sh -S)
-Version:$metadata_firmwareVersion
-Node name:$myInfo_owner
-NodeID:$nodeinfo_user_id
-Nodenum:$myInfo_myNodeNum
-TX enabled:$lora_txEnabled
-Use preset:$lora_usePreset
-Preset:$lora_modemPreset
-Bandwidth:$lora_bandwidth
-Spread factor:$lora_spreadFactor
-Coding rate:$lora_codingRate
-Role:$device_role
-Freq offset:$lora_frequencyOffset
-Region:$lora_region
-Hop limit:$lora_hopLimit
-Freq slot:$lora_channelNum
-Override freq:$lora_overrideFrequency
-Public key:$security_publicKey
-Nodes in db:$metadata_nodedbCount"
-
- ;;
- C) # Option -C (Complete node config)
- get_meshtastic_settings $OPTARG
+Version: $(echo "$output" | grep -oP '"firmwareVersion":\s*"\K[^"]+' | head -n 1)\n\
+Node name: $(echo "$output" | grep -oP 'Owner:\s*\K.*' | head -n 1)\n\
+NodeID: !$(printf "%08x\n" $(echo "$output" | grep -oP '"myNodeNum":\s*\K\d+' | head -n 1)) (nodenum: $(echo "$output" | grep -oP '"myNodeNum":\s*\K\d+' | head -n 1))\n\
+TX enabled? $(txEnabled=$(echo "$output" | grep -oP '"txEnabled":\s*\K\w+'); [[ "$txEnabled" == "true" ]] && echo "\033[0;34menabled\033[0m" || echo "\033[0;31mdisabled\033[0m")\n\
+Role: $(echo "$output" | grep -oP '"role":\s*"\K[^"]+' | head -n 1)\n\
+$preset_or_settings\n\
+Frequency offset: $(echo "$output" | grep -oP '"bandwidth":\s*\K\w+')
+Region: $(echo "$output" | grep -oP '"region":\s*"\K[^"]+')\n\
+Hop limit: $(echo "$output" | grep -oP '"hopLimit":\s*\K\w+')\n\
+$(channelNum=$(echo "$output" | grep -oP '"channelNum":\s*\K\d+' | head -n 1); [[ -n "$channelNum" && "$channelNum" -gt 0 ]] && echo -e "Frequency slot: $channelNum\n")\
+$(overrideFrequency=$(echo "$output" | grep -oP '"overrideFrequency":\s*\K[0-9.]+'); [[ -n "$overrideFrequency" && $(echo "$overrideFrequency > 0" | bc) -eq 1 ]] && echo "Override freq: $overrideFrequency\n")\
+Public key: $(echo "$output" | grep -oP '"publicKey":\s*"\K[^"]+' | head -n 1)\n\
+Nodes in nodedb: $(echo "$output" | grep -oP '"![a-zA-Z0-9]+":\s*\{' | wc -l)\
+"
;;
g) # Option -g (get config URL)
url=$(meshtastic --host --qr-all | grep -oP '(?<=Complete URL \(includes all channels\): )https://[^ ]+') #add look for errors
@@ -227,7 +110,7 @@ Nodes in db:$metadata_nodedbCount"
echo $url
;;
k) # Option -k (get current lora radio model)
- ls /etc/meshtasticd/config.d 2>/dev/null | grep '^femtofox_' | xargs -r -n 1 basename | sed 's/^femtofox_//;s/\.yaml$//' | grep . || echo -e "\033[0;31mnone (simulated radio)\033[0m"
+ ls /etc/meshtasticd/config.d 2>/dev/null | xargs -r -n 1 basename | sed 's/^femtofox_//;s/\.yaml$//' | grep . || echo -e "\033[0;31mnone (simulated radio)\033[0m"
;;
l) # Option -l (choose lora radio model)
prepare="rm -f /etc/meshtasticd/config.d/femtofox* && echo \"Radio type $OPTARG selected.\""
@@ -243,57 +126,34 @@ Nodes in db:$metadata_nodedbCount"
eval $prepare
cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_XTAL.yaml /etc/meshtasticd/config.d
systemctl restart meshtasticd
- elif [ "$OPTARG" = "lora-meshstick-1262" ]; then
- eval $prepare
- cp /etc/meshtasticd/available.d/lora-meshstick-1262.yaml /etc/meshtasticd/config.d/femtofox_lora-meshstick-1262.yaml # ugly code for the special case of the meshstick, which is not femto. Allows it to be detected by femto scripts and removed if radio changes
- systemctl restart meshtasticd
elif [ "$OPTARG" = "none" ]; then
eval $prepare
systemctl restart meshtasticd
else
- echo "$OPTARG is not a valid option. Options are \`lr1121_tcxo\`, \`sx1262_tcxo\`, \`sx1262_xtal\`, \`lora-meshstick-1262\`, \`none\` (simradio)"
+ echo "$OPTARG is not a valid option. Options are \`lr1121_tcxo\`, \`sx1262_tcxo\`, \`sx1262_xtal\`, \`none\` (simradio)"
fi
;;
q) # Option -q (set config URL)
- meshtastic_update "--seturl $OPTARG" 3 "Set URL"
+ meshtastic_update "--seturl $OPTARG" 10 "Set URL"
;;
- u) # Option -u (get public key)
- meshtastic_update " --get security.public_key" 3 "Get public key" | sed -n 's/.*base64:\([A-Za-z0-9+/=]*\).*/\1/p'
- ;;
- U) # Option -U (set public key)
- meshtastic_update " --set security.public_key base64:$OPTARG" 3 "Set public key"
- ;;
- r) # Option -r (get private key)
- meshtastic_update " --get security.private_key" 3 "Get private key" | sed -n 's/.*base64:\([A-Za-z0-9+/=]*\).*/\1/p'
- ;;
- R) # Option -R (set private key)
- meshtastic_update " --set security.private_key base64:$OPTARG" 3 "Set private key"
- ;;
- a) # Option -a (view admin keys)
+ v) # Option -v (view admin keys)
echo "Getting admin keys..."
keys=$(meshtastic --host --get security.admin_key | grep -oP '(?<=base64:)[^,"]+' | sed "s/'//g" | sed "s/]//g" | nl -w1 -s'. ' | sed 's/^/|n/' | tr '\n' ' ') #add look for errors
- echo "${keys:- none}"
+ echo "${keys:-none}"
;;
- A) # Option -A (add admin key)
- meshtastic_update "--set security.admin_key base64:$OPTARG" 3 "Set admin key"
+ a) # Option -a (add admin key)
+ meshtastic_update "--set security.admin_key base64:$OPTARG" 10 "Set admin key"
;;
c) # Option -c (clear admin key list)
- meshtastic_update "--set security.admin_key 0" 3 "Clear admin keys"
+ meshtastic_update "--set security.admin_key 0" 10 "Set admin key"
;;
p) # Option -p (view current legacy admin state)
- state=$(meshtastic_update "--get security.admin_channel_enabled" 3 "Get legacy admin state" 2>/dev/null)
- if echo "$state" | grep -q "True"; then
- echo -e "\033[0;34menabled\033[0m"
- elif echo "$state" | grep -q "False"; then
- echo -e "\033[0;31mdisabled\033[0m"
- elif echo "$state" | grep -q "Error"; then
- echo -e "\033[0;31merror\033[0m"
- fi
+ meshtastic_update "--get security.admin_channel_enabled" 3 "Get legacy admin state"
;;
o) # Option -o (set legacy admin true/false)
- meshtastic_update "--set security.admin_channel_enabled $OPTARG" 3 "Set legacy admin state"
+ meshtastic_update "--set security.admin_channel_enabled $OPTARG" 10 "Set legacy admin state"
;;
- w) # Option -w (mesh connectivity test)
+ r) # Option -r (mesh connectivity test)
for ((i=0; i<=2; i++)); do
if meshtastic --host --ch-index 0 --sendtext "test" --ack 2>/dev/null | grep -q "ACK"; then
echo -e "Received acknowledgement...\n\n\033[0;34mMesh connectivity confirmed!\033[0m"
@@ -308,46 +168,20 @@ Nodes in db:$metadata_nodedbCount"
systemctl restart meshtasticd
echo "Meshtasticd service started/restarted."
;;
- M) # Option -M (Meshtasticd Service disable/enable)
- if [ "$OPTARG" = "enable" ]; then
- systemctl enable meshtasticd
- systemctl restart meshtasticd
- elif [ "$OPTARG" = "disable" ]; then
- systemctl disable meshtasticd
- systemctl stop meshtasticd
- else
- echo "-M argument requires either \"enable\" or \"disable\""
- echo -e "$help"
- fi
- ;;
S) # Option -S (Get Meshtasticd Service state)
- femto-utils.sh -C "meshtasticd" # this functionality has been moved
+ if echo "$(systemctl status meshtasticd)" | grep -q "active (running)"; then
+ echo -e "\033[4m\033[0;34mrunning\033[0m"
+ elif echo "$(systemctl status meshtasticd)" | grep -q "inactive (dead)"; then
+ echo -e "\033[4m\033[0;31mnot running\033[0m"
+ else
+ echo "unknown"
+ fi
;;
t) # Option -t (stop Meshtasticd service)
systemctl stop meshtasticd
echo "Meshtasticd service stopped."
;;
- I) # Option -I (Manage i2c state. Options: "enable" "disable" "check")
- yaml_file="/etc/meshtasticd/config.d/femto_config.yaml"
- if [ "$OPTARG" = "enable" ]; then
- echo -e "\nI2C:\n I2CDevice: /dev/i2c-3" >> $yaml_file
- femto-meshtasticd-config.sh -s
- elif [ "$OPTARG" = "disable" ]; then
- sed -i '/I2C:/,/I2CDevice: \/dev\/i2c-3/d' $yaml_file
- femto-meshtasticd-config.sh -s
- elif [ "$OPTARG" = "check" ]; then
- if grep -q "I2C:" $yaml_file && grep -q "I2CDevice: /dev/i2c-3" $yaml_file; then
- echo -e "\033[0;34menabled\033[0m"
- else
- echo -e "\033[0;31mdisabled\033[0m"
- fi
- else
- echo "Invalid argument \`-I $OPTARG\`. Options are \`enable\` \`disable\` \`check\`."
- echo -e "$help"
- exit 1
- fi
- ;;
- z) # Option -z (upgrade meshtasticd)
+ u) # Option -u (upgrade meshtasticd)
apt update
apt install --only-upgrade meshtasticd
;;
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh
deleted file mode 100755
index d8acc49..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh
+++ /dev/null
@@ -1,501 +0,0 @@
-#!/bin/bash
-
-if [[ $EUID -ne 0 ]]; then
- echo "This script must be run as root. Try \`sudo femto-meshtasticd-config\`."
- exit 1
-fi
-
-export NCURSES_NO_UTF8_ACS=1
-export TERM=xterm-256color
-export LANG=C.UTF-8
-
-title="Meshtastic LoRa Settings"
-args=$@
-
-send_settings() {
- if [ -n "$command" ]; then
- set -o pipefail
- echo "meshtastic --host $command"
- output=$(eval "femto-meshtasticd-config.sh -m '$command' 5 'Save Meshtastic settings'" | tee /dev/tty)
- exit_status=$?
- set +o pipefail
- if [ $exit_status -eq 1 ]; then
- dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "\Z1Command FAILED!\Zn\n\nLog:\n$output")" 0 0
- elif [ $exit_status -eq 0 ]; then
- dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "\Z4Command Successful!\Zn\n\nLog:\n$output")" 0 0
- fi
- fi
-
- [ "$1" = "wizard" ] && [ -z "$args" ] && dialog --no-collapse --title "$title" --colors --msgbox "Meshtastic LoRa Settings Wizard complete!" 6 50 # if in wizard mode AND there are no script arguments, display the message
-}
-
-config_url() {
- femto-config -c && (
- newurl=$(dialog --no-collapse --colors --title "Meshtastic URL" --inputbox "The Meshtastic configuration URL allows for automatic configuration of all Meshtastic LoRa settings and channels.\nEntering a URL may \Z1\ZuOVERWRITE\Zn your LoRa settings and channels!\n\nNew Meshtastic LoRa configuration URL (SHIFT+INS to paste):" 13 63 3>&1 1>&2 2>&3)
- if [ -n "$newurl" ]; then #if a URL was entered
- command+="--seturl $newurl "
- fi
- # if we're in wizard mode AND there are no script arguments, then display a message
- send_settings $1
- )
-}
-
-lora_settings_actions() {
- if [ "$1" = "set_lora_radio_model" ] || [ "$1" = "wizard" ]; then
- choice="" # zero the choice before loading the submenu
- while true; do
- echo "Checking LoRa radio..."
- #Display filename, if exists: $(files=$(ls /etc/meshtasticd/config.d/* 2>/dev/null) && [ -n "$files" ] && echo "\n\nConfiguration files in use:\n$files" | paste -sd, -))
- choice=$(dialog --no-collapse --colors --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | grep -v '^femto_' | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 22 50 10 \
- "Radio name:" "Configuration:" "" \
- "" "" "" \
- "Ebyte e22-900m30s" "(SX1262_TCXO)" "Included in Femtofox Pro" \
- "Ebyte e22-900m22s" "(SX1262_TCXO)" "" \
- "Ebyte e80-900m22s" "(SX1262_XTAL)" "" \
- "Heltec ht-ra62" "(SX1262_TCXO)" "" \
- "Seeed wio-sx1262" "(SX1262_TCXO)" "" \
- "Waveshare sx126x-xxxm" "(SX1262_XTAL)" "Not recommended due issues with sending longer messages" \
- "AI Thinker ra-01sh" "(SX1262_XTAL)" "" \
- "LoRa Meshstick 1262" "(meshstick-1262)" "USB based LoRa radio from Mark Birss. https://github.com/markbirss/MESHSTICK" \
- "Simulated radio" "(none)" "" \
- " " "" "" \
- "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- local radio=""
- case $choice in
- "Ebyte e22-900m30s")
- radio="sx1262_tcxo"
- ;;
- "Ebyte e22-900m22s")
- radio="sx1262_tcxo"
- ;;
- "Ebyte e80-900m22s")
- radio="sx1262_xtal"
- ;;
- "Heltec ht-ra62")
- radio="sx1262_tcxo"
- ;;
- "Seeed wio-sx1262")
- radio="sx1262_tcxo"
- ;;
- "Waveshare sx126x-xxxm")
- radio="sx1262_xtal"
- ;;
- "AI Thinker ra-01sh")
- radio="femto_sx1262_xtal"
- ;;
- "LoRa Meshstick 1262")
- radio="lora-meshstick-1262"
- ;;
- "Simulated radio")
- radio="none"
- ;;
- "Skip")
- return
- ;;
- esac
- if [ -n "$radio" ]; then #if a radio was selected
- femto-meshtasticd-config.sh -l "$radio" -s # set the radio, then restart meshtasticd
- dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "Radio \Zu$choice\Zn selected.\nMeshtasticd service restarted.\Zn")" 7 45
- break
- fi
- done
- [ "$1" = "set_lora_radio_model" ] && return
- fi
-
- if femto-config -c; then
-
- if [ "$1" = "wizard" ]; then
- choice="" # zero the choice before loading the submenu
- while true; do
- choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "Meshtastic configuration method" 8 50 0 \
- "Automatic configuration with URL" "" "" \
- "Manual configuration" "" "" \
- " " "" "" \
- "Cancel" "" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && return # Exit the loop if the user selects "Cancel" or closes the dialog
- [ "$choice" == "" ] && continue #restart loop if no choice made
- [ "$choice" == "Manual configuration" ] && break
- [ "$choice" == "Automatic configuration with URL" ] && config_url "$1"
- return
- done
- fi
-
- dialog --no-collapse --infobox "Getting current settings from Meshtasticd.\n\nThis can take a minute..." 6 50
- while IFS=':' read -r key value; do
- eval "${key}=\"${value}\"" # Create a variable with the key name and assign it the value
- done < <(sudo femto-meshtasticd-config.sh -C settings)
-
- if [ "$1" = "region" ] || [ "$1" = "wizard" ]; then
- options=("UNSET" "US" "EU_433" "EU_868" "CN" "JP" "ANZ" "KR" "TW" "RU" "IN" "NZ_865" "TH" "LORA_24" "UA_433" "UA_868" "MY_433" "MY_919" "SG_923")
- menu_items=()
- # Create menu options from the array
- for i in "${!options[@]}"; do
- if [ $i -eq 0 ]; then
- menu_items+=("${options[$i]}" "(default)" "") # First item with "(default)"
- else
- menu_items+=("${options[$i]}" "" "") # Other items without "(default)"
- fi
- done
- menu_items+=("" "" "" "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "")
- while true; do
- choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$lora_region" --item-help --menu "Sets the region for your node. As long as this is not set, the node will display a message and not transmit any packets.\n\nRegion? (current: ${lora_region})" 0 0 0 \
- "${menu_items[@]}" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- [ "$choice" == "" ] && continue # Restart loop if no choice made
- command+="--set lora.region $choice "
- break
- done
- fi
-
- if [ "$1" = "use_modem_preset" ] || [ "$1" = "wizard" ]; then
- choice="" # zero the choice before loading the submenu
- while true; do
- choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${lora_usePreset^}" --item-help --menu "Presets are pre-defined modem settings (Bandwidth, Spread Factor, and Coding Rate) which influence both message speed and range. The vast majority of users use a preset.\n\nUse modem preset? (current: ${lora_usePreset:-unknown})" 0 0 0 \
- "True" "(default)" "" \
- "False" "" "" \
- " " "" "" \
- "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- [ "$choice" == "" ] && continue #restart loop if no choice made
- using_preset=$choice
- command+="--set lora.use_preset $(echo "$choice" | tr '[:upper:]' '[:lower:]') "
- break
- done
- fi
-
- if [ "$1" = "wizard" ] && [ "$using_preset" = "False" ]; then
- dialog --no-collapse --title "$title" --colors --msgbox "Not using preset, so skipping Preset setting." 6 50
- else
- if [ "$1" = "preset" ] || [ "$1" = "wizard" ]; then
- options=("LONG_FAST" "LONG_SLOW" "VERY_LONG_SLOW" "MEDIUM_SLOW" "MEDIUM_FAST" "SHORT_SLOW" "SHORT_FAST" "SHORT_TURBO")
- menu_items=()
- # Create menu options from the array
- for i in "${!options[@]}"; do
- if [ $i -eq 0 ]; then
- menu_items+=("${options[$i]}" "(default)" "") # First item with "(default)"
- else
- menu_items+=("${options[$i]}" "" "") # Other items without "(default)"
- fi
- done
- menu_items+=("" "" "" "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "")
- while true; do
- choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${lora_modemPreset^}" --item-help --menu "The default preset will provide a strong mixture of speed and range, for most users.\n\nPreset? (current: ${lora_modemPreset:-unknown})" 0 0 0 \
- "${menu_items[@]}" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- [ "$choice" == "" ] && continue # Restart loop if no choice made
- command+="--set lora.modem_preset $choice "
- break
- done
- fi
- fi
-
- if [ "$1" = "wizard" ] && [ "$using_preset" = "True" ]; then
- dialog --no-collapse --title "$title" --colors --msgbox "Using preset, so skipping Bandwidth, Spread Factor and Coding Rate settings." 7 50
- else
- if [ "$1" = "bandwidth" ] || [ "$1" = "wizard" ]; then
- while true; do
- choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item $lora_bandwidth --menu "Width of the frequency \"band\" used around the calculated center frequency. Only used if modem preset is disabled.\n\nBandwidth? (current: ${lora_bandwidth:-unknown})" 0 0 0 \
- 0 "(default, automatic)" "" \
- 31 "" "" \
- 62 "" "" \
- 125 "" "" \
- 250 "" "" \
- 500 "" "" \
- " " "" "" \
- "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- [ "$choice" == "" ] && continue # Restart loop if no choice made
- command+="--set lora.bandwidth $choice "
- break
- done
- fi
-
- if [ "$1" = "spread_factor" ] || [ "$1" = "wizard" ]; then
- while true; do
- choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item $lora_spreadFactor --menu "Indicates the number of chirps per symbol. Only used if modem preset is disabled.\n\nSpread factor? (current: ${lora_spreadFactor:-unknown})" 0 0 0 \
- 0 "(default, automatic)" "" \
- 7 "" "" \
- 8 "" "" \
- 9 "" "" \
- 10 "" "" \
- 11 "" "" \
- 12 "" "" \
- " " "" "" \
- "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- [ "$choice" == "" ] && continue # Restart loop if no choice made
- command+="--set lora.spread_factor $choice "
- break
- done
- fi
-
- if [ "$1" = "coding_rate" ] || [ "$1" = "wizard" ]; then
- while true; do
- choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item $lora_codingRate --menu "The proportion of each LoRa transmission that contains actual data - the rest is used for error correction.\n\nCoding rate (only used if modem preset is disabled)? (current: ${lora_codingRate:-unknown})" 0 0 0 \
- 0 "(default, automatic)" "" \
- 5 "" "" \
- 6 "" "" \
- 7 "" "" \
- 8 "" "" \
- " " "" "" \
- "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- [ "$choice" == "" ] && continue # Restart loop if no choice made
- command+="--set lora.coding_rate $choice "
- break
- done
- fi
- fi
-
- if [ "$1" = "frequency_offset" ] || [ "$1" = "wizard" ]; then
- while true; do
- input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "This parameter is for advanced users with advanced test equipment.\n\nFrequency offset (default: 0)" 0 0 ${lora_frequencyOffset:-unknown} 3>&1 1>&2 2>&3)
- [[ -z $input || ($input =~ ^([0-9]{1,6})(\.[0-9]+)?$ && $(echo "$input <= 1000000" | bc -l) -eq 1) ]] && break # exit loop if user input a number between 0 and 1000000. Decimals allowed
- dialog --no-collapse --title "$title" --msgbox "Must be between 0-1000000. Decimals allowed." 6 50
- done
- if [ $? -ne 1 ] && [ -n "$input" ]; then
- command+="--set lora.frequency_offset $input "
- fi
- fi
-
- if [ "$1" = "hop_limit" ] || [ "$1" = "wizard" ]; then
- while true; do
- input=$(dialog --no-collapse --colors --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "The maximum number of intermediate nodes between Femtofox and a node it is sending to. Does not impact received messages.\n\n\Z1WARNING:\Zn Excessive hop limit increases congestion!\n\nHop limit. Must be 0-7 (default: 3)" 0 0 ${lora_hopLimit:-unknown} 3>&1 1>&2 2>&3)
- [[ -z $input || ($input =~ ^[0-7]$) ]] && break # exit loop if user input an integer between 0 and 7
- dialog --no-collapse --title "$title" --msgbox "Must be an integer between 0 and 7." 6 50
- done
- if [ $? -ne 1 ] && [ -n "$input" ]; then
- command+="--set lora.hop_limit $input "
- fi
- fi
-
- if [ "$1" = "tx_enabled" ] || [ "$1" = "wizard" ]; then
- choice="" # zero the choice before loading the submenu
- while true; do
- choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${lora_txEnabled^}" --item-help --menu "Enables/disables the radio chip. Useful for hot-swapping antennas.\n\nEnable TX? (current: ${lora_txEnabled:-unknown})" 0 0 0 \
- "True" "(default)" "" \
- "False" "" "" \
- " " "" "" \
- "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- [ "$choice" == "" ] && continue #restart loop if no choice made
- command+="--set lora.tx_enabled $(echo "$choice" | tr '[:upper:]' '[:lower:]') "
- break
- done
- fi
-
- if [ "$1" = "tx_power" ] || [ "$1" = "wizard" ]; then
- while true; do
- input=$(dialog --no-collapse --colors --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "\
-\Z1\ZuWARNING!\Zn\n\
-Setting a 33db radio above 8db will \Zupermanently\Zn damage it.\n\
-ERP above 27db violates EU law.\n\
-ERP above 36db violates US (unlicensed) law.\n\
-\n\
-If 0, will use the maximum continuous power legal in your region.
-\n\
-\n\
-TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 ${lora_txPower:-unknown} 3>&1 1>&2 2>&3)
- [[ -z $input || $input =~ ^([12]?[0-9]|30)$ ]] && break # exit loop if user input an integer between 0 and 30
- dialog --no-collapse --title "$title" --msgbox "Must be an integer between 0 and 30." 6 50
- done
- if [ $? -ne 1 ] && [ -n "$input" ]; then
- command+="--set lora.tx_power $input "
- fi
- fi
-
- if [ "$1" = "frequency_slot" ] || [ "$1" = "wizard" ]; then
- while true; do
- input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "Determines the exact frequency the radio transmits and receives. If unset or set to 0, determined automatically by the primary channel name.\n\nFrequency slot (0 for automatic)" 0 0 ${lora_channelNum:-unknown} 3>&1 1>&2 2>&3)
- [[ -z $input || ($input =~ ^[0-9]+$) ]] && break # exit loop if user input an integer 0 or higher
- dialog --no-collapse --title "$title" --msgbox "Must be an integer 0 or higher." 6 50
- done
- if [ $? -ne 1 ] && [ -n "$input" ]; then
- command+="--set lora.channel_num $input "
- fi
- fi
-
- if [ "$1" = "override_duty_cycle" ] || [ "$1" = "wizard" ]; then
- while true; do
- choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${lora_overrideDutyCycle:-False}" | sed 's/^./\U&/')" --item-help --menu "May have legal ramifications.\n\nOverride duty cycle? (current: ${lora_overrideDutyCycle:-unknown})" 0 0 0 \
- "True" "" "" \
- "False" "(default)" "" \
- " " "" "" \
- "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- [ "$choice" == "" ] && continue #restart loop if no choice made
- command+="--set lora.override_duty_cycle $(echo "$choice" | tr '[:upper:]' '[:lower:]') "
- break
- done
- fi
-
- if [ "$1" = "sx126x_rx_boosted_gain" ] || [ "$1" = "wizard" ]; then
- while true; do
- choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${lora_sx126xRxBoostedGain:-True}" | sed 's/^./\U&/')" --item-help --menu "This is an option specific to the SX126x chip series which allows the chip to consume a small amount of additional power to increase RX (receive) sensitivity.\n\nEnable SX126X RX boosted gain? (current: ${lora_sx126xRxBoostedGain:-unknown})" 0 0 0 \
- "True" "(default)" "" \
- "False" "" "" \
- " " "" "" \
- "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- [ "$choice" == "" ] && continue #restart loop if no choice made
- command+="--set lora.sx126x_rx_boosted_gain $(echo "$choice" | tr '[:upper:]' '[:lower:]') "
- break
- done
- fi
-
- if [ "$1" = "override_frequency" ] || [ "$1" = "wizard" ]; then
- while true; do
- input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "Overrides frequency slot. May have legal ramifications.\n\nOverride frequency in MHz (0 for none)." 0 0 ${lora_overrideFrequency:-unknown} 3>&1 1>&2 2>&3)
- [[ -z $input || ($input =~ ^[0-9]+(\.[0-9]+)?$) ]] && break # exit loop if user input a number 0 or higher (decimals allowed)
- dialog --no-collapse --title "$title" --msgbox "Must be a number 0 or higher. Decimals allowed." 6 53
- done
-
- if [ $? -ne 1 ] && [ -n "$input" ]; then
- command+="--set lora.override_frequency $input "
- fi
- fi
-
- if [ "$1" = "ignore_mqtt" ] || [ "$1" = "wizard" ]; then
- while true; do
- choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${lora_ignoreMqtt:-unknown}" | sed 's/^./\U&/')" --item-help --menu "Ignores any messages it receives via LoRa that came via MQTT somewhere along the path towards the device.\n\nIgnore MQTT? (current: ${lora_ignoreMqtt:-unknown})" 0 0 0 \
- "True" "" "" \
- "False" "(default)" "" \
- " " "" "" \
- "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- [ "$choice" == "" ] && continue #restart loop if no choice made
- command+="--set lora.ignore_mqtt $(echo "$choice" | tr '[:upper:]' '[:lower:]') "
- break
- done
- fi
-
- if [ "$1" = "ok_to_mqtt" ] || [ "$1" = "wizard" ]; then
- while true; do
- choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${lora_configOkToMqtt:-unknown}" | sed 's/^./\U&/')" --item-help --menu "Indicates that the user approves their packets to be uplinked to MQTT brokers.\n\nOK to MQTT? (current: ${lora_configOkToMqtt:-unknown})" 0 0 0 \
- "True" "" "" \
- "False" "(default)" "" \
- " " "" "" \
- "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- [ "$choice" == "" ] && continue #restart loop if no choice made
- command+="--set lora.config_ok_to_mqtt $(echo "$choice" | tr '[:upper:]' '[:lower:]') "
- break
- done
- fi
-
- send_settings $1
- fi
-}
-
-
-# Parse options
-help="If script is run without arguments, menu will load.\n\
-Options are:\n\
--h This message\n\
--w Wizard mode (skips main menu)\
-"
-while getopts ":hw" opt; do
- case ${opt} in
- h) # Option -h (help)
- echo -e $help
- ;;
- w) # Option -w (Wizard mode)
- lora_settings_actions "wizard"
- ;;
- \?) # Unknown option)
- echo -e "Unknown argument $1.\n$help"
- ;;
- esac
-done
-[ -n "$1" ] && exit # if there were arguments, exit before loading the menu
-
-command="" # initialize command
-LoRa_menu_choice="" # zero the choice before loading the submenu
-while true; do
- command="" # initialize command
- LoRa_menu_choice=$(dialog --no-collapse --title "Meshtastic LoRa Settings" --default-item "$LoRa_menu_choice" --cancel-label "Back" --item-help --menu "Select a LoRa setting or run the wizard" 30 50 20 \
- 1 "Wizard (set all)" "" \
- 2 "Set LoRa radio model" "" \
- 3 "Configure automatically with URL" "" \
- 4 "Region" "" \
- 5 "Use modem preset" "" \
- 6 "Preset" "" \
- 7 "Bandwidth" "" \
- 8 "Spread factor" "" \
- 9 "Coding rate" "" \
- 10 "Frequency offset" "" \
- 11 "Hop limit" "" \
- 12 "Enable/disable TX" "" \
- 13 "TX power" "" \
- 14 "Frequency slot" "" \
- 15 "Override duty cycle" "" \
- 16 "SX126X RX boosted gain " "" \
- 17 "Override frequency" "" \
- 18 "Ignore MQTT" "" \
- 19 "OK to MQTT" "" \
- " " "" "" \
- 20 "Back to Meshtastic Menu" "" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
- case $LoRa_menu_choice in
- 1) # Wizard (set all)
- lora_settings_actions "wizard"
- ;;
- 2) # Set LoRa radio model)
- lora_settings_actions "set_lora_radio_model"
- ;;
- 3) # Configure automatically with URL)
- config_url
- ;;
- 4) # Region)
- lora_settings_actions "region"
- ;;
- 5) # Use modem preset)
- lora_settings_actions "use_modem_preset"
- ;;
- 6) # Preset)
- lora_settings_actions "preset"
- ;;
- 7) # Bandwidth)
- lora_settings_actions "bandwidth"
- ;;
- 8) # Spread factor)
- lora_settings_actions "spread_factor"
- ;;
- 9) # Coding rate)
- lora_settings_actions "coding_rate"
- ;;
- 10) # Frequency offset)
- lora_settings_actions "frequency_offset"
- ;;
- 11) # Hop limit)
- lora_settings_actions "hop_limit"
- ;;
- 12) # Enable/disable TX)
- lora_settings_actions "tx_enabled"
- ;;
- 13) # TX power)
- lora_settings_actions "tx_power"
- ;;
- 14) # Frequency slot)
- lora_settings_actions "frequency_slot"
- ;;
- 15) # Override duty cycle)
- lora_settings_actions "override_duty_cycle"
- ;;
- 16) # SX126X RX boosted gain)
- lora_settings_actions "sx126x_rx_boosted_gain"
- ;;
- 17) # Override frequency)
- lora_settings_actions "override_frequency"
- ;;
- 18) # Ignore MQTT)
- lora_settings_actions "ignore_mqtt"
- ;;
- 19) # OK to MQTT)
- lora_settings_actions "ok_to_mqtt"
- ;;
- 20) break ;;
- esac
-done
-
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh
index 5a11622..aae75e8 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh
@@ -15,7 +15,6 @@ Options are:
-c "COUNTRY" Set Wi-Fi 2-letter country code (such as US, DE)
-r Restart Wi-Fi
-e Get ethernet settings
--i Get IPv4 addresses
-w Get Wi-Fi settings
-n "HOSTNAME" Change hostname
-t Test internet connection
@@ -38,7 +37,7 @@ if [ $# -eq 0 ]; then
fi
# Parse options
-while getopts ":hx:Ts:p:c:eiwn:tr" opt; do
+while getopts ":hx:Ts:p:c:ewn:tr" opt; do
case ${opt} in
h) # Option -h (help)
echo -e "$help"
@@ -55,10 +54,10 @@ while getopts ":hx:Ts:p:c:eiwn:tr" opt; do
T) # Option -T (toggle wifi state)
if [ "$(cat /etc/wifi_state.txt)" == "up" ]; then
logger "Toggling wifi off"
- femto-network-config.sh -x "down"
+ femto-network-config.sh -x "up"
else
logger "Toggling wifi on"
- femto-network-config.sh -x "up"
+ femto-network-config.sh -x "down"
fi
;;
s) # Option -s (ssid)
@@ -78,52 +77,42 @@ while getopts ":hx:Ts:p:c:eiwn:tr" opt; do
;;
e) # Option -e (ethernet settings)
status=$(ip link show eth0 | grep -o 'state [A-Za-z]*' | awk '{print $2}')
-echo -e "\
-Eth status:$([ "$status" == "UP" ] && echo -e "\033[4m\033[0;34mconnected\033[0m" || echo -e "\033[0;31mdisconnected\033[0m")"
+echo -e "Ethernet status: $([ "$status" == "UP" ] && echo -e "\033[4m\033[0;34mconnected\033[0m" || echo -e "\033[0;31mdisconnected\033[0m")"
if [ "$status" == "UP" ]; then
- echo -e "\
-IPv4 Address:$(ifconfig eth0 | grep 'inet ' | awk '{print $2}')
-IPv6 Address:$(ifconfig eth0 | grep 'inet6 ' | awk '{print $2}')"
+ echo "IPv4 Address: $(ifconfig eth0 | grep 'inet ' | awk '{print $2}')\n\
+IPv6 Address: $(ifconfig eth0 | grep 'inet6 ' | awk '{print $2}')"
fi
-echo -e "\
-MAC Address:$(ifconfig eth0 | grep 'ether ' | awk '{print $2}')\n\
-Hostname:$(hostname).local"
+echo -e "MAC Address: $(ifconfig eth0 | grep 'ether ' | awk '{print $2}')\n\
+Hostname: $(hostname).local"
;;
w) # Option -w (wifi settings)
- wifi_settings="\
-SSID:$(grep -m 1 '^\s*ssid=' "$wpa_supplicant_conf" | cut -d '"' -f 2)\n\
-Password:(hidden)\n\
-Country:$(grep -m 1 "^country=" "$wpa_supplicant_conf" | cut -d '=' -f 2)"
+ wifi_settings="SSID: $(grep -m 1 '^\s*ssid=' "$wpa_supplicant_conf" | cut -d '"' -f 2)\n\
+Password: (hidden)\n\
+Country: $(grep -m 1 "^country=" "$wpa_supplicant_conf" | cut -d '=' -f 2)"
if ip link show wlan0 2>/dev/null | grep -q "wlan0"; then
- mac_address_line="\
-MAC address:$(ifconfig wlan0 | grep ether | awk '{print $2}')"
+ mac_address_line="MAC address: $(ifconfig wlan0 | grep ether | awk '{print $2}')\n"
if [ "$(cat /etc/wifi_state.txt)" = "up" ]; then
- echo -e "\
-Wi-Fi status:\033[4m\033[0;34menabled\033[0m\n\
-Connected to:$(iwconfig 2>/dev/null | grep -i 'ESSID' | awk -F 'ESSID:"' '{print $2}' | awk -F '"' '{print $1}' | sed 's/^$/none/')\n\
-Sig. strength:$(iwconfig 2>/dev/null | grep -i 'Signal level' | awk -F 'Signal level=' '{print $2}' | awk '{print $1}')\n\
-Current IP:$(ip addr show wlan0 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1)\n
-Hostname:$(hostname).local\n\
+ echo -e "Wi-Fi status: \033[4m\033[0;34menabled\033[0m\n\
+Connected to: $(iwconfig 2>/dev/null | grep -i 'ESSID' | awk -F 'ESSID:"' '{print $2}' | awk -F '"' '{print $1}' | sed 's/^$/none/')\n\
+Signal Strength: $(iwconfig 2>/dev/null | grep -i 'Signal level' | awk -F 'Signal level=' '{print $2}' | awk '{print $1}')\n\
+Current IP: $(hostname -I | awk '{print $1}')\n
+Hostname: $(hostname).local\n\
$mac_address_line"
else
if ip link show wlan0 &>/dev/null; then # if wlan0 exists
- echo -e "\
-Wi-Fi status:\033[0;31mdisabled\033[0m\n\
+ echo -e "Wi-Fi status: \033[0;31mdisabled\033[0m\n\
\n\
$wifi_settings"
fi
fi
else
- echo -e "\
-Wi-Fi status:\033[0;31mwlan0 not detected\033[0m\n\
+ echo -e "Wi-Fi status: \033[0;31mwlan0 not detected\033[0m\n\
\n\
+Wi-Fi settings:\n\
$wifi_settings"
fi
;;
- i) # Option -i (Get all IPv4 addresses)
- hostname -I | awk '{for(i=1; i<=NF; i++) {if(i>1) printf ", "; printf $i} print ""}'
- ;;
t) # Option -t (test internet connection)
# Define ping targets and initialize counter
targets=("1.1.1.1" "8.8.8.8")
@@ -140,26 +129,23 @@ $wifi_settings"
if [ "$successful" -eq 0 ]; then
echo -e "\033[0;31mNo internet connection detected.\033[0m"
else
- echo -e "Internet connection is \033[4m\033[0;34mup\033[0m.\n\nPinged $(echo "${targets[*]}" | sed 's/ /, /g').\nReceived $successful/$total responses."
+ echo -e "Internet connection is \033[4m\033[0;32mup\033[0m.\n\nPinged $(echo "${targets[*]}" | sed 's/ /, /g').\nReceived $successful/$total responses."
fi
;;
r) # Option -r (restart Wi-Fi)
updated_wifi="true"
;;
n) # Option -n (set hostname)
- old_hostname=$(hostname)
sed -i "s/$(hostname)/$OPTARG/g" /etc/hosts
hostnamectl set-hostname "$OPTARG"
systemctl restart avahi-daemon
- echo "Regenerating web terminal ssl keys..."
- [ "$OPTARG" != "$old_hostname" ] && /usr/local/bin/packages/ttyd.sh -k
;;
- \?) # Invalid option)
+ \?) # Invalid option
echo "Invalid option: -$OPTARG"
echo -e "$help"
exit 1
;;
- :) # Missing argument for option)
+ :) # Missing argument for option
echo "Option -$OPTARG requires a setting."
echo -e "$help"
exit 1
@@ -169,7 +155,7 @@ done
if [ "$updated_wifi" = true ]; then
ip link set wlan0 up
- #systemctl restart wpa_supplicant
+ systemctl restart wpa_supplicant
wpa_cli -i wlan0 reconfigure # <-------- add watch for FAIL response, error out
- #timeout 30s dhclient -v
+ timeout 30s dhclient -v
fi
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-pinout.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-pinout.sh
index c54db4b..05fcadb 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-pinout.sh
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-pinout.sh
@@ -19,10 +19,10 @@ fi
femtofox="\
┌──────────┬────┬─────┬────┬───────────────┬───┬───────────────┐\n\
-│⚪:♥KILL ●│● │USB-C│ ●│● PWR-IN │✚ ▬│ 3.3-5V ⚪│\n\
+│⚪:⛊KILL ●│● │USB-C│ ●│● PWR-IN │✚ ▬│ 3.3-5V ⚪│\n\
├───────┐ ●│● └─────┘ ●│● └───┘ │\n\
│ USB-C │ ●│● ●│● ┌─────────────────────────────┐ │\n\
-│ PWR ♥ │ ●│● LUCKFOX ●│● │ ┌─────────────┐ │ │\n\
+│ PWR ⛊ │ ●│● LUCKFOX ●│● │ ┌─────────────┐ │ │\n\
│ DEBUG │ ●│● PICO MINI ●│● │ │ │ │ │\n\
├───────┘ ●│● ●│● │ │ │ │ │\n\
├───┐ ●│● FOXHOLE ●│● │ E │ │ │ │\n\
@@ -36,32 +36,31 @@ femtofox="\
│ ● RX- │ I2C GROVE │ 3 │ SEEED │ │ │\n\
│ ● RX+ │ ┌───────┐ │ 0 │WIO SX1262│ │ │\n\
│ ● GND ETHERNET │ │● ● ● ●│ │ S │ │ │ │\n\
-│ ● TX- │ ╞═══════╡ │ └───────────┘ │ │\n\
+│ ● TX- │ ├───────┤ │ └───────────┘ │ │\n\
│ ● TX+ │ │● ● ● ●│ │ │ │\n\
├──────────────────┘ └───────┘ └─────────────────────────────┘ │\n\
│ ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ■ │\n\
-│⚪● ● ● ● ● ● ♥ ♥ ♥ ● ● ♥ ♥ ● ● ● ● ● ● ●⚪│\n\
+│⚪● ● ● ● ● ● ⛊ ⛊ ⛊ ● ⛊ ⛊ ● ● ● ● ● ● ● ●⚪│\n\
└──────────────────────────────────────────────────────────────┘\n\
+ \n\
R M M \n\
G X G C I O 3 G S S 3 \n\
N E N L S S V N C D V \n\
D N D K O I 3 D L A 3 \n\
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ■ \n\
- ● ● ● ● ● ● ♥ ♥ ♥ ● ● ♥ ♥ ● ● ● ● ● ● ● \n\
+ ● ● ● ● ● ● ⛊ ⛊ ⛊ ● ● ⛊ ⛊ ● ● ● ● ● ● ● \n\
C B I G G G G S S G R T G R R T G 5 5 \n\
S U R N P N P R R N X X N S X X N V V \n\
0 S Q D I D I A A D 2 2 D T 4 4 D \n\
Y O O 1 0 \n\
-♥ Denotes Pro features: \n\
+⛊ Denotes Pro features: \n\
On Community Edition, PWR/DEBUG USB-C replaced by 4pin UART2. \n\
PWR/DEBUG USB-C also carries serial with no added adapter. \n\
-KILL: add PWR switch or thermal cutoff/fuse & remove resistor."
-
-
+KILL: add PWR switch or thermal cutoff/fuse & remove resistor. "
femtofox_zero="\
┌────┐ ┌────┐ \n\
- │⚪ \ / ⚪│ \n\
+ │⚪ \ / ⚪│ \n\
│ \ / │ \n\
│ └─────────┘ │ \n\
│ ┌─────────────────┐ │ \n\
@@ -85,11 +84,11 @@ UART4-TX │ ● │ │ │ WIO │ │ │ ● │ I2C SCL \n\
├───┘ │ │SX 1262│ │ └───┤ \n\
│ │ └───────┘ │ ● │ UNUSED \n\
│ └─────────────┘ ● │ GND \n\
- │⚪ ETH ⚪│ \n\
+ │⚪ ETH ⚪│ \n\
└────────●─●─●─●─●────────┘ \n\
R R G T T \n\
X X N X X \n\
- - + D - + "
+ - + D - + \n"
femtofox_tiny="coming soon"
@@ -138,5 +137,4 @@ while getopts "hlfzt" opt; do
exit 1
;;
esac
-done
-exit
\ No newline at end of file
+done
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh
index 2dd10c9..4891e8e 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh
@@ -1,125 +1,86 @@
#!/bin/bash
log_message() {
- echo -e "\e[32mFirst boot\e[0m: $1" # Echo to the screen
+ echo "First boot: $1" # Echo to the screen
logger "First boot: $1" # Log to the system log
}
-if ! systemctl is-enabled femto-runonce &>/dev/null; then # if not the first boot
-
- who | grep -q . || exit 0 # if not logged in, exit script. May not deal well with future web UI
-
+if [ ! -e "/etc/.firstboot" ]; then
# prevents weirdness over tty
export NCURSES_NO_UTF8_ACS=1
export TERM=xterm-256color
export LANG=C.UTF-8
dialog --title "Femtofox run once utility" --yesno "\
This does not appear to be this system's first boot.\n\
-\n\
-Re-running this script will:\n\
-* Resize filesystem to fit the SD card\n\
-* Allocate the swap file\n\
-* Replace the SSH encryption keys\n\
-* Replace the Web Terminal SSL encryption keys\n\
-* Set the eth0 MAC to be derivative of CPU serial number\n\
-* Add terminal type to user femto's .bashrc\n\
-* Add a shortcut \`sfc\` to user femto's .bashrc\n\
-* Enable the meshtasticd service\n\
-* Add compiler support\n\
-\n\
-Finally, the Femtofox will reboot.\n\
+Re-running this script will restore RTC support, set the Meshtastic nodeid and eth0 MAC address to be derivative of the CPU serial number, set the Meshtastic wifi status to \`enabled\` and then reboot.\n\
\n\
Re-running this script after first boot should not cause any harm, but may not work as expected.\n\
\n\
-Proceed?" 24 60
+Proceed?" 14 60
if [ $? -eq 1 ]; then #if cancel/no
- exit 0
+ exit 1
fi
fi
-echo -e "\e[32m******* First boot *******\e[0m"
-
-# pulse LED during firstboot
-(
- while true; do
- echo 1 > /sys/class/gpio/gpio34/value;
- sleep 0.5;
- echo 0 > /sys/class/gpio/gpio34/value;
- sleep 0.5;
- done
-) &
-
# Perform filesystem resize
-log_message "Resizing filesystem..."
-resize2fs /dev/mmcblk1p5
-resize2fs /dev/mmcblk1p6
-resize2fs /dev/mmcblk1p7
-log_message "Resizing filesystem complete."
+ log_message "Resizing filesystem. This can take up to 10 minutes, depending on microSD card size and speed"
+ sudo resize2fs /dev/mmcblk1p5
+ sudo resize2fs /dev/mmcblk1p6
+ sudo resize2fs /dev/mmcblk1p7
# allocate swap file
-if [ ! -f /swapfile ]; then # check if swap file already exists
- log_message "Allocating swap file..."
- fallocate -l 1G /swapfile
- chmod 600 /swapfile
- mkswap /swapfile > /dev/null
- swapon /swapfile > /dev/null
+if [ ! -f /etc/.filesystem_swap ]; then # check if swap file already exists
+ sudo fallocate -l 1G /swapfile
+ sudo chmod 600 /swapfile
+ sudo mkswap /swapfile > /dev/null
+ sudo swapon /swapfile > /dev/null
echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab > /dev/null
+ touch /etc/.filesystem_swap
log_message "Swap file allocated."
else
- log_message "Swap file already allocated, skipping..."
+ log_message "Swap file already allocated, skipping."
fi
+# add RTC support
+bash -c 'echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-3/new_device'
+log_message "Added ds1307/ds3231 RTC support."
+
# prevent randomized mac address for eth0. If `eth0`` is already present in /etc/network/interfaces, skip
-mac="$(awk '/Serial/ {print $3}' /proc/cpuinfo | tail -c 11 | sed 's/^\(.*\)/a2\1/' | sed 's/\(..\)/\1:/g;s/:$//')"
-file="/etc/network/interfaces"
-if ! grep -q " hwaddress ether $mac" "$file"; then
- log_message "Setting eth0 MAC address to $mac (derivative of CPU s/n)..."
- awk -v mac="$mac" '
- { print }
- /allow-hotplug eth0/ { count=5 }
- count && --count == 0 { print " hwaddress ether " mac }
- ' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
+if ! grep -q "eth0" /etc/network/interfaces; then
+ log_message "Setting eth0 MAC address to derivative of CPU s/n."
+ cat <> /etc/network/interfaces
+# static mac address for onboard ethernet (castellated pins)
+allow-hotplug eth0
+iface eth0 inet dhcp
+hwaddress ether $(awk '/Serial/ {print $3}' /proc/cpuinfo | tail -c 11 | sed 's/^\(.*\)/a2\1/' | sed 's/\(..\)/\1:/g;s/:$//')
+EOF
else
- log_message "eth0 mac address already set in /etc/network/interfaces, skipping..."
+ log_message "eth0 already exists in /etc/network/interfaces, skipping."
fi
# Add term stuff to .bashrc
lines="export NCURSES_NO_UTF8_ACS=1
export TERM=xterm-256color
export LANG=C.UTF-8"
-if ! grep -Fxq "$lines" /home/femto/.bashrc; then # Check if the lines are already in .bashrc
- log_message "Adding TERM, LANG and NCURSES_NO_UTF8_ACS to .bashrc..."
- echo "$lines" >> /home/femto/.bashrc
+
+# Check if the lines are already in .bashrc
+if ! grep -Fxq "$lines" /home/femto/.bashrc; then
+ echo "$lines" >> /home/femto/.bashrc
+ echo "Added TERM, LANG and NCURSES_NO_UTF8_ACS to .bashrc"
else
- log_message "TERM, LANG and NCURSES_NO_UTF8_ACS already present in .bashrc, skipping..."
+ echo "TERM, LANG and NCURSES_NO_UTF8_ACS already present in .bashrc, skipping"
fi
-# Fix Compiler
-log_message "Adding compiler support..."
-cp /usr/lib/arm-linux-gnueabihf/libc_nonshared.a.keep /usr/lib/arm-linux-gnueabihf/libc_nonshared.a
-
-# Add a cheeky alias to .bash_aliases
-if ! grep -Fxq "alias sfc='sudo femto-config'" /home/femto/.bashrc; then # Check if the lines are already in .bash_aliases
- echo "alias sfc='sudo femto-config'" >> /home/femto/.bashrc
- log_message "Added \`alias sfc='sudo femto-config'\` to .bashrc"
-else
- log_message "\`alias sfc='sudo femto-config'\` already present in .bashrc, skipping..."
-fi
-
-log_message "Enabling meshtasticd service..."
+# set meshtastic nodeid to derivative of CPU serial number (unique to this board)
+seed=$(sed -n '/Serial/ s/^.*: \(.*\)$/\U\1/p' /proc/cpuinfo | bc | tail -c 9)
+#seed=$((0x$(awk '/Serial/ {print $3}' /proc/cpuinfo) & 0x3B9AC9FF)) #alternate method for generating seed - not in use
+sed -i "s|^ExecStart=/usr/sbin/meshtasticd.*|ExecStart=/usr/sbin/meshtasticd -h $seed|" /usr/lib/systemd/system/meshtasticd.service
+log_message "Using Luckfox CPU S/N to generate nodeid for Meshtastic."
+systemctl daemon-reload
systemctl enable meshtasticd
-
-#generate SSH keys
-log_message "Generating new SSH encryption keys. This can take a few minutes..."
-femto-utils.sh -E
-
-#generate ttyd SSL keys
-log_message "Generating new Web Terminal (ttyd) SSL encryption keys. This can take a few minutes..."
-/usr/local/bin/packages/ttyd.sh -k
-log_message "Enabling Web Terminal (ttyd) service..."
-systemctl enable ttyd
+systemctl restart meshtasticd
# remove first boot flag
-systemctl disable femto-runonce
-log_message "Disabled first boot service and rebooting in 5 seconds..."
+rm /etc/.firstboot
+log_message "Removing first boot flag and rebooting in 5 seconds..."
sleep 5
-reboot
+reboot
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh
index 2ca6bd8..c3b5129 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh
@@ -1,11 +1,8 @@
#!/bin/bash
-# prevents weirdness over tty
-export NCURSES_NO_UTF8_ACS=1
-export TERM=xterm-256color
-export LANG=C.UTF-8
+export NCURSES_NO_UTF8_ACS=1 # prevents weirdness over tty
if [[ $EUID -ne 0 ]]; then
- echo -e "This script must be run as root. Try \`sudo femto-set-time.sh\`."
+ echo -e "This script must be run as root. Try \`sudo femto-set-timezone\`."
exit 1
fi
@@ -14,56 +11,32 @@ arg_count=$#
help=$(cat </dev/null 2>&1
- dpkg-reconfigure --frontend noninteractive tzdata >/dev/null 2>&1
- if [ ! -f /usr/share/zoneinfo/$1 >/dev/null 2>&1 ]; then
- echo -e "Invalid timezone: $1"
- return 1
- fi
- desired_offset=$(TZ=$1 date +"%:z")
- current_offset=$(date +"%:z")
- if [ "$desired_offset" != "$current_offset" ]; then
- echo -e "FAILED to set timezone to $1. Expected GMT offset: $desired_offset, but got: $current_offset"
- return 1
+log_message() {
+ logger $1
+ if [ $arg_count -eq 0 ]; then
+ dialog --msgbox "$1" 12 50
else
- echo "Set timezone to $current_offset"
- return 0
+ echo $1
fi
}
-set_timestamp() {
-for i in {1..5}; do
- if date -s "@$1" >/dev/null 2>&1; then
- if hwclock --systohc >/dev/null 2>&1; then
- echo "Time Zone updated to:\n$(timedatectl show --property=Timezone --value) $(date +%Z) (UTC$(date +%:z))\nSystem time updated to:\n$(date)\n\nNew time successfully saved to RTC.\nTime & date are also set automatically from internet, if connected."
- return 0
- else
- echo "System time updated to:\n$(date +"%B %d, %Y %H:%M:%S") $(timedatectl show --property=Timezone --value) ($(date +"UTC%z" | sed -E 's/GMT([+-])0?([0-9]{1,2})00/GMT\1\2/'))\n\nUnable to communicate with RTC module. An RTC module can remember system time between reboots/power outages.\nTime & date are also set automatically from internet, if connected."
- return 0
- fi
+set_timezone() {
+ if timedatectl set-timezone "$1"; then
+ log_message "\nTime zone set to $1 (UTC$(date +%z)) successfully."
+ else
+ log_message "\nFailed to set the time zone to $1."
+ exit 1
fi
-done
-echo "Failed to set system time to $(date -d @$1) after 5 attempts."
-return 1
}
-
-while getopts ":t:T:h" opt; do
+while getopts ":t:h" opt; do
case ${opt} in
t) # Option -t (timezone)
set_timezone "$OPTARG"
- [ $? -eq 1 ] && exit 1
- ;;
- T) # Option -t (timestamp)
- set_timestamp "$OPTARG"
- [ $? -eq 1 ] && exit 1 || exit 0
;;
h) # Option -h (help)
echo -e "$help"
@@ -71,62 +44,47 @@ while getopts ":t:T:h" opt; do
esac
done
-if [ $arg_count -eq 0 ]; then # if the script was launched with no arguments, then load the UI.
- echo "Loading current time settings..."
- current_timezone=$(timedatectl show --property=Timezone --value)
- dialog --no-collapse --title "System time" --yesno "\
-Current system time:\n\
-$(date +"%B %d, %Y %H:%M:%S") $(timedatectl show --property=Timezone --value) ($(date +"UTC%z" | sed -E 's/GMT([+-])0?([0-9]{1,2})00/GMT\1\2/'))\n\
-$(hwclock >/dev/null 2>&1 && echo "RTC module found!" || echo "RTC module not found.")\n\
-\n\
-Set new time and timezone?" 10 50
- if [ $? -eq 1 ]; then #unless cancel/no
- exit 0
- fi
- # Fetch available time zones
- echo "Loading time zones..."
- timezones=$(timedatectl list-timezones)
- # Build the options array
- options=()
- while IFS= read -r timezone; do
- options+=("$timezone" "x")
- done <<< "$timezones"
+# Fetch available time zones
+echo "Loading timezones..."
+timezones=$(timedatectl list-timezones)
+# Build the options array
+options=()
+while IFS= read -r timezone; do
+ options+=("$timezone" "x")
+done <<< "$timezones"
- # Convert options array to string
- options_str=$(printf '%s\n' "${options[@]}")
-
- # Show timezone selection menu with preselection of current timezone
- selected_timezone=$(dialog --title "Set Time Zone" \
- --default-item "$current_timezone" \
- --menu "Current time zone: $current_timezone (UTC$(date +%z))" 20 50 10 \
- $(printf "%s " "${options[@]}") 3>&1 1>&2 2>&3)
- exit_status=$?
- if [[ $exit_status -eq 0 && -n "$selected_timezone" ]]; then
- # Set the selected time zone
- set_timezone $selected_timezone
+# Convert options array to string
+options_str=$(printf '%s\n' "${options[@]}")
+
+# Show timezone selection menu with preselection of current timezone
+selected_timezone=$(dialog --title "Select Timezone" \
+ --default-item "$(cat /etc/timezone)" \
+ --menu "Current timezone: $(cat /etc/timezone) (UTC$(date +%z))" 20 60 10 \
+ $(printf "%s " "${options[@]}") 3>&1 1>&2 2>&3)
+exit_status=$?
+if [[ $exit_status -eq 0 && -n "$selected_timezone" ]]; then
+ # Set the selected time zone
+ set_timezone $selected_timezone
+else
+ exit 1
+fi
+
+DATE=$(echo "$(dialog --title "Select Date" --calendar "Choose a date:\nCurrent date: $(date "+%B %d, %Y")\nPress [TAB] to select." 0 0 $(date +%d) $(date +%m) $(date +%Y) 3>&1 1>&2 2>&3)" | awk -F/ '{printf "%04d-%02d-%02d", $3, $2, $1}')
+if [ $? -eq 1 ]; then #if cancel/no
+ exit 1
+fi
+TIME=$(dialog --title "Set Time" --timebox "Select time:\nCurrent time: $(date +%H:%M:%S)\nPress [TAB] to select." 0 0 3>&1 1>&2 2>&3) # Dialog timebox for time
+if [ $? -eq 1 ]; then #if cancel/no
+ exit 1
+fi
+if date -s "$DATE $TIME"; then # set time
+ if hwclock --systohc; then
+ rtc="New time successfully saved to RTC."
else
- exit 1
+ rtc="Unable to communicate with RTC module. An RTC module can save system time between reboots/power outages."
fi
-
- DATE=$(dialog --title "Set Date" --calendar "Current date: $(date "+%B %d, %Y") \nPress [TAB] to select." 0 0 $(date +%d) $(date +%m) $(date +%Y) 3>&1 1>&2 2>&3)
- if [ $? -ne 0 ]; then
- exit 1
- fi
- DATE=$(echo "$DATE" | awk -F'/' '{print $3"-"$2"-"$1}') #reformat to YYYY-MM-DD
- TIME=$(dialog --title "Set Time" --timebox "Current time: $(date +%H:%M:%S)\nPress [TAB] to select." 0 0 3>&1 1>&2 2>&3) # Dialog timebox for time
- if [ $? -eq 1 ]; then #if cancel/no
- exit 1
- fi
-
- msg="$(set_timestamp $(date -d "$DATE $TIME" +%s))"
- exit_status=$?
-
- logger $msg
- if [ $arg_count -eq 0 ]; then
- dialog --msgbox "$msg" 13 50
- else
- echo -e $msg
- fi
- exit $exit_status #exit status matches set_timestamp exit status
-
+ log_message "System time updated to:\n$(date)\n\n$rtc\nTime & date are also set automatically from internet."
+else
+ log_message "Failed to set system time."
+ exit 1
fi
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh
index 5abda29..4ed1a53 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh
@@ -4,67 +4,50 @@ title="Software Manager"
package_dir="/usr/local/bin/packages"
install() {
- dialog --no-collapse --title "Install $($package_dir/$1.sh -N)" --yesno "\nInstallation requires internet connectivity.\n\nInstall $($package_dir/$1.sh -N)?" 10 40
- [ $? -eq 1 ] && return 1 #if cancel/no
-
+ dialog --no-collapse --title "$title" --yesno "\nInstall $($package_dir/$1.sh -N)\n\nProceed?" 10 40
+ if [ $? -eq 1 ]; then #if cancel/no
+ return 1
+ fi
echo "Installing $($package_dir/$1.sh -N)..."
# Run the installation script, capturing the output and displaying it in real time
- output="$($package_dir/$1.sh -i 2>&1 | tee /dev/tty)"
- install_status=$([[ "$output" == *"failed"* ]] && echo 1 || echo 0)
- # Capture the exit status of the eval command
- if [ ${#output} -gt 2048 ]; then # Truncate to 2048 characters and append ellipsis and note if necessary
- truncated_output="${output:0:2000}...\nLOG TRUNCATED"
- if [[ "$output" =~ user_message: ]]; then # preserve user_message by adding to end of string
- truncated_output="$truncated_output\n$(echo "$output" | sed -n 's/.*\(user_message:.*\)/\1/p')"
- fi
- output="$truncated_output"
- fi
+ output=$($package_dir/$1.sh -i)
+ echo $output
+ install_status=$? # Capture the exit status of the eval command
user_message=$(echo "$output" | awk '/user_message: / {found=1; split($0, arr, "user_message: "); print arr[2]; next} found {print}' | sed '/^$/q') # grab the user_message, if present
- output=$(echo -e "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output
-
- echo $install_status
+ #output=$(echo -e "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output
if [ $install_status -eq 0 ]; then # if the installation was successful
- dialog --no-collapse --colors --title "$title" --beep --msgbox "\ZuInstallation of $($package_dir/$1.sh -N) successful!\Zn$([ -n "$user_message" ] && echo "\n\n$user_message")\n\nLog:\n$(echo $output)" 0 0 # if there's a user_message, display it with two preceeding line breaks
+ dialog --no-collapse --colors --title "$title" --beep --msgbox "\n\ZuInstallation of $($package_dir/$1.sh -N) successful!\Zn$([ -n "$user_message" ] && echo "\n\n$user_message")\n\nLog:\n$(echo $output)" 0 0 # if there's a user_message, display it with two preceeding line breaks
else
- dialog --no-collapse --colors --title "$title" --beep --msgbox "\ZuInstallation of $($package_dir/$1.sh -N) FAILED!\Zn\n\n$user_message\n\nLog:\n$(echo -e $output)" 0 0 # if there's a user_message, display it with two preceeding line breaks
+ dialog --no-collapse --colors --title "$title" --beep --msgbox "\n\ZuInstallation of $($package_dir/$1.sh -N) FAILED!\Zn\n\n$user_message\n\nLog:\n$(echo -e $output)" 0 0 # if there's a user_message, display it with two preceeding line breaks
fi
}
uninstall() {
- dialog --no-collapse --title "Uninstall $($package_dir/$1.sh -N)" --yesno "\nNote: reinstallation will require internet connectivity.\n\nUninstall $($package_dir/$1.sh -N)?" 10 40
- [ $? -eq 1 ] && return 1 #if cancel/no
+ dialog --no-collapse --title "$title" --yesno "\nUninstall $1\n\nProceed?" 10 40
+ if [ $? -eq 1 ]; then #if cancel/no
+ return 1
+ fi
echo "Uninstalling $($package_dir/$1.sh -N)..."
output=$(eval "$package_dir/$1.sh -u 2>&1 | tee /dev/tty")
install_status=$? # Capture the exit status of the eval command
user_message=$(echo "$output" | awk '/user_message: / {found=1; split($0, arr, "user_message: "); print arr[2]; next} found {print}' | sed '/^$/q') # grab the user_message, if present
- output=$(echo "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output
+ #output=$(echo "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output
if [ $install_status -eq 0 ]; then # if the installation was successful
dialog --no-collapse --colors --title "$title" --beep --msgbox "\n\ZuUninstallation of $($package_dir/$1.sh -N) successful!\Zn$([ -n "$user_message" ] && echo "\n\n$user_message")\n\nLog:\n$(echo -e "$output")" 0 0 # if there's a user_message, display it with two preceeding line breaks
else
dialog --no-collapse --colors --title "$title" --beep --msgbox "\n\ZuUninstallation of $($package_dir/$1.sh -N) FAILED!\Zn\n\n$user_message\n\nLog:\n$(echo "$output")" 0 0 # if there's a user_message, display it with two preceeding line breaks
- fi
-}
-
-initialize() {
- dialog --no-collapse --title "$title" --yesno "\nIntialize $($package_dir/$1.sh -N)\n\nInitialization runs commands that require user interaction and so can only be run from terminal.\n\nInitialize $($package_dir/$1.sh -N)?" 13 50
- [ $? -eq 1 ] && return 1 #if cancel/no
- clear
- echo "Initializing $($package_dir/$1.sh -N)..."
- eval "$package_dir/$1.sh -a"
- if [ $? -eq 0 ]; then # if the installation was successful
- dialog --no-collapse --colors --title "$title" --beep --msgbox "\nInitialization of $($package_dir/$1.sh -N) successful!" 8 50 # if there's a user_message, display it with two preceeding line breaks
- else
- dialog --no-collapse --colors --title "$title" --beep --msgbox "\nInitialization of $($package_dir/$1.sh -N) FAILED!" 8 50 # if there's a user_message, display it with two preceeding line breaks
- fi
+ fi
}
upgrade() {
- dialog --no-collapse --title "Upgrade $($package_dir/$1.sh -N)" --yesno "\nUpgrade requires internet connectivity.\n\nUpgrade $($package_dir/$1.sh -N)?" 10 40
- [ $? -eq 1 ] && return 1 #if cancel/no
+ dialog --no-collapse --title "$title" --yesno "\nUpgrade $1\n\nProceed?" 10 40
+ if [ $? -eq 1 ]; then #if cancel/no
+ return 1
+ fi
echo "Upgrading $($package_dir/$1.sh -N)..."
- output="$($package_dir/$1.sh -g 2>&1 | tee /dev/tty)"
- install_status=$([[ "$output" == *"failed"* ]] && echo 1 || echo 0)
+ output=$(eval "$package_dir/$1.sh -g 2>&1 | tee /dev/tty")
+ install_status=$? # Capture the exit status of the eval command
user_message=$(echo "$output" | awk '/user_message: / {found=1; split($0, arr, "user_message: "); print arr[2]; next} found {print}' | sed '/^$/q') # grab the user_message, if present
output=$(echo "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output
if [ $install_status -eq 0 ]; then # if the installation was successful
@@ -72,6 +55,7 @@ upgrade() {
else
dialog --no-collapse --colors --title "$title" --beep --msgbox "\n\ZuUpgrade of $($package_dir/$1.sh -N) FAILED!\Zn\n\n$user_message\n\nLog:\n$output" 0 0 # if there's a user_message, display it with two preceeding line breaks
fi
+
}
@@ -79,106 +63,91 @@ upgrade() {
package_intro() {
echo "Loading package info..."
# check if each field in the package info is supported by the package, and if so get it and insert it into the package info dialog
- dialog --no-collapse --colors --title "$title" --yes-label "Continue" --no-label "Back" --yesno "\
-$($package_dir/$1.sh -N)\n\
-$(if $package_dir/$1.sh -O | grep -q 'A'; then echo -e "by $($package_dir/$1.sh -A)"; fi)\n\
+ dialog --no-collapse --colors --title "$title" --msgbox "\
+ $($package_dir/$1.sh -N)\n\
+ $(if $package_dir/$1.sh -O | grep -q 'A'; then echo -e "by $($package_dir/$1.sh -A)"; fi)\n\
$(if $package_dir/$1.sh -O | grep -q 'D'; then echo "\n$($package_dir/$1.sh -D)"; fi)\n\
\n\
-$(echo "Currently: " && $package_dir/$1.sh -I && echo "\Zuinstalled\Zn" || echo "\Zunot installed\Zn")\n\
-$([ -n "$($package_dir/$1.sh -E)" ] && $package_dir/$1.sh -I && echo "Service status: \Zu$(femto-utils.sh -C "$($package_dir/$1.sh -E)" | sed 's/\x1b\[[0-9;]*m//g')\Zn\n")\
+$(echo "Currently: " && $package_dir/$1.sh -I && echo "\Zuinstalled\Zn" || echo " \Zunot installed\Zn")\n\
$(if output=$($package_dir/$1.sh -L); [ -n "$output" ]; then echo "Installs to: \Zu$output\Zn\n"; fi)\
$(if output=$($package_dir/$1.sh -C); [ -n "$output" ]; then echo "Conflicts with: \Zu$output\Zn\n"; fi)\
-$(if output=$($package_dir/$1.sh -T); [ -n "$output" ]; then echo "License: \Zu$output\Zn\n"; fi)\
-$(if $package_dir/$1.sh -O | grep -q 'U'; then echo "Website: \Zu$($package_dir/$1.sh -U)\Zn"; fi)" 0 0
- [ $? -eq 1 ] && return 1 # Exit the loop if the user selects "Cancel" or closes the dialog
+An internet connection is required for installation.\n\
+$(if $package_dir/$1.sh -O | grep -q 'U'; then echo "\nFor more information, visit $($package_dir/$1.sh -U)"; fi)" 0 0
package_menu $1 # after user hits "OK", move on to package menu
}
package_menu() {
- choice=""
while true; do
echo "Loading package menu..."
- license_button=""
- if $package_dir/$1.sh -O | grep -q 'G' && $package_dir/$1.sh -I; then license_button="--help-button --help-label License"; fi
# for each line, check if it's supported by the package, display it if the current install state of the package is appropriate (example: don't display "install" if the package is already installed, don't display "stop service" for a package with no services)
- if $package_dir/$1.sh -I; then service_state=$(femto-utils.sh -C "$($package_dir/$1.sh -E)"); fi
- # Removed from menu list until can be fixed - contact does not launch. When returned to list, should be first entry
- menu_list="\
+ choice=$(dialog --no-collapse --title "$title" --cancel-label "Back" --menu "$($package_dir/$1.sh -N)" 17 45 5 \
$(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \
$(if $package_dir/$1.sh -O | grep -q 'i' && ! $package_dir/$1.sh -I; then echo "Install x"; fi) \
$(if $package_dir/$1.sh -O | grep -q 'u' && $package_dir/$1.sh -I; then echo "Uninstall x"; fi) \
- $(if $package_dir/$1.sh -O | grep -q 'a' && $package_dir/$1.sh -I; then echo "Initialize x"; fi) \
$(if $package_dir/$1.sh -O | grep -q 'g' && $package_dir/$1.sh -I; then echo "Upgrade x"; fi) \
- $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "enabled" ]]; then echo "Enable service x"; fi) \
- $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "disabled" ]]; then echo "Disable service x"; fi) \
- $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "not running" ]]; then echo "Stop service x"; fi) \
- $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "Start/restart service x"; fi) \
- $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Detailed service status x"; fi)"
- menu_count=$(( $(echo "$menu_list" | grep -o " x" | wc -l) $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "+1"; fi) )) # count the number of menu items by counting how many times " x" shows up, +1 if there's a service. This is a stupid way to do this, but because each menu item only contains one space (the rest being space-sized invisible chars) it works. It's late at night, OKAY?!
- if $package_dir/$1.sh -O | grep -q 'e' && [ "$($package_dir/$1.sh -E | wc -w)" -gt 1 ]; then
- multiple_services_note="\nService will appear as \"running\" if any of the services are active."
- menu_count=$((menu_count + 2))
- fi
- choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" $license_button --cancel-label "Back" --default-item "$choice" --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)$multiple_services_note" $(( menu_count + 9 )) 45 $(( menu_count + 3 )) \
- $menu_list \
- " " "" \
+ $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "Enable service x"; fi) \
+ $(if $package_dir/$1.sh -O | grep -q 'd' && $package_dir/$1.sh -I; then echo "Disable service x"; fi) \
+ $(if $package_dir/$1.sh -O | grep -q 's' && $package_dir/$1.sh -I; then echo "Stop service x"; fi) \
+ $(if $package_dir/$1.sh -O | grep -q 'r' && $package_dir/$1.sh -I; then echo "Start/restart service x"; fi) \
+ $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Get service status x"; fi) \
+ "" "" \
"Back to software manager" "" 3>&1 1>&2 2>&3)
- exit_status=$? # This line checks the exit status of the dialog command
- if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
- return
- elif [ $exit_status -eq 2 ]; then # Help ("extra") button
- dialog --no-collapse --colors --title "$($package_dir/$1.sh -N) License" --msgbox " \Zu$($package_dir/$1.sh -N)\Zn\n$(if output=$($package_dir/$1.sh -T); [ -n "$output" ]; then echo "License: $output"; fi)\n\n$($package_dir/$1.sh -G)" 0 0
- else
- # execute the actual commands
- case $choice in
- "Run software") eval "$package_dir/$1.sh -l" ;;
- "Install") install $1 ;;
- "Uninstall") uninstall $1 ;;
- "Initialize") initialize $1 ;;
- "Upgrade") upgrade $1 ;;
- "Enable service") echo "Enabling and starting service..." && eval "$package_dir/$1.sh -e" && eval "$package_dir/$1.sh -r" ;;
- "Disable service") echo "Disabling and stopping service..." && eval "$package_dir/$1.sh -d" && eval "$package_dir/$1.sh -s" ;;
- "Stop service") echo "Stopping service..." && eval "$package_dir/$1.sh -s" ;;
- "Start/restart service") echo "Starting/restarting service..." && eval "$package_dir/$1.sh -r" ;;
- "Detailed service status") echo "Getting service status..." && dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;;
- "Back to software manager") break ;;
- esac
- fi
+
+ exit_status=$? # This line checks the exit status of the dialog command
+
+ if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
+ break
+ fi
+
+ # execute the actual commands
+ case $choice in
+ "Run software") eval "$package_dir/$1.sh -l" ;;
+ "Install") install $1 ;;
+ "Uninstall") uninstall $1 ;;
+ "Upgrade") upgrade $1 ;;
+ "Enable service") eval "$package_dir/$1.sh -e" ;;
+ "Disable service") eval "$package_dir/$1.sh -d" ;;
+ "Stop service") eval "$package_dir/$1.sh -s" ;;
+ "Start/restart service") eval "$package_dir/$1.sh -r" ;;
+ "Get service status") dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;;
+ "Back to software manager") break ;;
+ esac
done
}
-# generate menu from filenames in /usr/local/bin/packages
while true; do
- echo "Loading packages..."
- menu_entries=("Package name" "Installed?" "" "")
- index=1
- for file in /usr/local/bin/packages/*.sh; do
- filename=$(basename "$file" .sh)
- [[ "$filename" == femto_* ]] && continue # skip filenames starting with femto_
- menu_entries+=("$(/usr/local/bin/packages/"$filename".sh -N)" "$($package_dir/$filename.sh -I && echo "✅ " || echo "❌ ")")
- ((index++)) # keeping an index to determine menu window height
- done
-
- menu_entries+=(" " "") # add blank line and "Back to Main Menu" entry
- menu_entries+=("Back to main menu" "")
- software_option=$(dialog --no-collapse --cancel-label "Back" --default-item "$software_option" --menu "$title" $((11 + index)) 50 $((index + 3)) "${menu_entries[@]}" 3>&1 1>&2 2>&3)
- [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
-
- case_block=" case \$software_option in"
- index=1
- for file in /usr/local/bin/packages/*.sh; do
- filename=$(basename "$file" .sh)
- [[ "$filename" == femto_* ]] && continue # skip filenames starting with femto_
- case_block+="
- \"$(/usr/local/bin/packages/"$filename".sh -N)\") package_intro \"$filename\" ;;"
- ((index++))
- done
-
- case_block+="
- \"Back to main menu\") break ;;
- esac" #add return to main menu option
- eval "$case_block" # Execute the generated case statement
+title="$title"
+ option=""
+ option=$(dialog --no-collapse --cancel-label "Back" --menu "$title" 0 0 6 \
+ 1 "The Comms Channel BBS, TC²BBS" \
+ 2 "Contact (Meshtastic client)" \
+ 3 "Meshing Around by Spud" \
+ 4 "Mosquitto MQTT Broker" \
+ 5 "Mosquitto MQTT Client" \
+ "" ""\
+ 6 "Back to Main Menu" 3>&1 1>&2 2>&3)
+
+ exit_status=$? # This line checks the exit status of the dialog command
+ if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
+ break
+ fi
+
+ case $option in
+ 1) package_intro "tc2_bbs" ;;
+ 2) package_intro "contact_client" ;;
+ 3) package_intro "meshing_around" ;;
+ 4) package_intro "mosquitto_mqtt_broker" ;;
+ 5) package_intro "mosquitto_mqtt_client" ;;
+ 6) break ;;
+ esac
done
-exit 0
\ No newline at end of file
+exit 0
+
+
+ # 4 "Mosquitto MQTT broker" \
+ # 5 "GPS and Telemetry" \
+
+ # 4) mosquitto ;;
+ # 5) gpsd ;;
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh
index a7792de..e76f999 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh
@@ -1,34 +1,14 @@
#!/bin/bash
-
-if [[ $EUID -ne 0 ]]; then
- echo "This script must be run as root. Try \`sudo femto-meshtasticd-config\`."
- exit 1
-fi
-
mount_point="/mnt/usb" # Set the mount point
# Function to log to screen, syslog and logfile to be saved to usb drive
log_message() {
- echo -e "\e[32mUSB config\e[0m: $1"
+ echo "USB config: $1"
logger "USB config: $1"
echo "$(date +"%Y-%m-%d %H:%M:%S") $1" >> /tmp/femtofox-config.log
}
-if systemctl is-enabled femto-runonce &>/dev/null; then
- log_message "First boot, skipping USB Configuration Tool."
- exit 0
-fi
-
exit_script() {
- if [[ -n "$partial_failure" ]]; then
- log_message "\033[0;31mPartial failure in usb-config-tool...\033[0m"
- for _ in {1..2}; do #boot code
- blink "1" && sleep 0.5
- done
- for _ in {1..2}; do #boot code
- blink "0.25" && sleep 0.5
- done
- fi
if [ ! -z "$usb_path" ]; then #if usb path is populated
if ! df -T /mnt/usb 2>/dev/null | grep -qw 'ntfs'; then
log_message "USB configuration script complete. Copying femtofox-config.log to USB drive."
@@ -70,8 +50,6 @@ if [ ! -d "$mount_point" ]; then
mkdir -p "$mount_point"
fi
-echo -e "\e[32m******* USB configuration tool *******\e[0m"
-
# Debugging: Log and echo the extracted device name
log_message "USB device found: $full_device_path"
@@ -84,7 +62,7 @@ else
if [ $? -eq 0 ]; then
log_message "USB drive mounted successfully at $mount_point."
else
- log_message "\e[31mFailed to mount USB drive.\e[0m"
+ log_message "Failed to mount USB drive."
blink "5" && sleep "0.5" #boot code
exit_script 1
fi
@@ -118,8 +96,6 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then
wifi_command="femto-network-config.sh"
meshtastic_security_command="femto-meshtasticd-config.sh"
dont_run_if_log_exists=""
- software_install=""
- meshtastic_i2c=""
# Escape and read the fields from the USB config file if they exist
while IFS='=' read -r key value; do
@@ -129,7 +105,6 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then
fi
value=$(echo "$value" | tr -d '"')
case "$key" in
- act_led) act_led=$(escape_sed "$value") ;;
wifi_ssid) wifi_ssid=$(escape_sed "$value") ;;
wifi_psk) wifi_psk=$(escape_sed "$value") ;;
wifi_country) wifi_country=$(escape_sed "$value") ;;
@@ -137,28 +112,27 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then
timezone) timezone=$(escape_sed "$value") ;;
meshtastic_url) meshtastic_url=$(escape_sed "$value") ;;
meshtastic_legacy_admin) meshtastic_legacy_admin=$(escape_sed "$value") ;;
- meshtastic_public_key) meshtastic_public_key=$(escape_sed "$value") ;;
- meshtastic_private_key) meshtastic_private_key=$(escape_sed "$value") ;;
meshtastic_admin_key) meshtastic_admin_key=$(escape_sed "$value") ;;
dont_run_if_log_exists) dont_run_if_log_exists=$(escape_sed "$value") ;;
- software_install) software_install=$(escape_sed "$value") ;;
- meshtastic_i2c) meshtastic_i2c=$(escape_sed "$value") ;;
esac
- done < <(grep -E '^(act_led|wifi_ssid|wifi_psk|wifi_country|meshtastic_lora_radio|timezone|meshtastic_url|meshtastic_legacy_admin|meshtastic_public_key|meshtastic_private_key|meshtastic_admin_key|dont_run_if_log_exists|software_install|meshtastic_i2c)=' "$usb_config")
+ done < <(grep -E '^(wifi_ssid|wifi_psk|wifi_country|meshtastic_lora_radio|timezone|meshtastic_url|meshtastic_legacy_admin|meshtastic_admin_key|dont_run_if_log_exists)=' "$usb_config")
# Check if the log exits and if the dont_run_if_log_exists line is set in the script
if $log_exists && [[ $dont_run_if_log_exists = "true" ]]; then
- log_message "\e[31m\`dont_run_if_log_exists\` is set to \"true\" and log exists, ignoring.\e[0m"
+ log_message "\`dont_run_if_log_exists\` is set to \"true\" and log exists, ignoring."
for _ in {1..2}; do #boot code
blink "1.5" && sleep 0.5
done
exit_script 1
fi
-
- if [[ -n "$act_led" ]]; then
- # Update the ssid in the network block
- log_message "Updating Activity LED status to \`$act_led\`."
- femto-utils.sh -a "$act_led"
+
+ # Update wpa_supplicant.conf with the new values, if specified
+ if [[ -n "$wifi_country" ]]; then
+ # Update country field
+ wifi_command="$wifi_command -c \"$wifi_country\""
+ log_message "Updating Wi-Fi country in wpa_supplicant.conf to $wifi_country."
+ found_config="true"
+ update_wifi="true"
fi
if [[ -n "$wifi_ssid" ]]; then
@@ -172,27 +146,11 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then
if [[ -n "$wifi_psk" ]]; then
# Update the psk in the network block
wifi_command="$wifi_command -p \"$wifi_psk\""
- #log_message "Updating Wi-Fi PSK in wpa_supplicant.conf to \`$wifi_psk\`."
- log_message "Updating Wi-Fi PSK in wpa_supplicant.conf to *HIDDEN*."
+ log_message "Updating Wi-Fi PSK in wpa_supplicant.conf to \`$wifi_psk\`."
found_config="true"
update_wifi="true"
fi
-
- # Update wpa_supplicant.conf with the new values, if specified
- if [[ -n "$wifi_country" ]]; then
- # Update country field
- wifi_command="$wifi_command -c \"$wifi_country\""
- log_message "Updating Wi-Fi country in wpa_supplicant.conf to $wifi_country."
- found_config="true"
- update_wifi="true"
- fi
-
- if [ "$update_wifi" = true ]; then #if wifi config found, restart wifi
- log_message "Making changes to wifi settings and restarting wifi."
- wifi_command="$wifi_command -r"
- eval $wifi_command 2>&1 | tee -a /tmp/femtofox-config.log
- log_message "wpa_supplicant.conf updated and wifi restarted. Enabling Meshtastic wifi setting."
- fi
+
#get meshtastic_lora_radio model, if specified, and copy appropriate yaml to /etc/meshtasticd/config.d/
if [[ -n "$meshtastic_lora_radio" ]]; then
@@ -234,18 +192,12 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then
radio="none"
;;
*)
- log_message "\033[0;31mInvalid LoRa radio name: $meshtastic_lora_radio, ignoring.\033[0m"
- partial_failure=true
+ log_message "Invalid LoRa radio name: $meshtastic_lora_radio, ignoring."
;;
esac
if [[ -n "$radio" ]]; then # if a radio was found
femto-meshtasticd-config.sh -l "$radio" -s 2>&1 | tee -a /tmp/femtofox-config.log # set the radio and restart the service
- if [ $? -eq 0 ]; then
- log_message "Set LoRa radio to $meshtastic_lora_radio, restarting Meshtasticd."
- else
- log_message "\033[0;31mSeting LoRa radio to $meshtastic_lora_radio FAILED, restarting Meshtasticd.\033[0m" | tee -a /tmp/femtofox-config.log
- partial_failure=true
- fi
+ log_message "Set LoRa radio to $meshtastic_lora_radio, restarting Meshtasticd."
fi
fi
@@ -253,10 +205,6 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then
timezone=$(echo "$timezone" | sed 's/\\//g')
log_message "Updating system timezone to $timezone."
femto-set-time.sh -t "$timezone"
- if [ $? -eq 1 ]; then
- partial_failure=true
- log_message "\033[0;31mSeting timezone to $timezone FAILED.\033[0m" | tee -a /tmp/femtofox-config.log
- fi
found_config="true"
fi
@@ -265,22 +213,8 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then
log_message "Updating Meshtastic URL."
found_config="true"
fi
-
- if [[ -n "$meshtastic_public_key" ]]; then # public key
- meshtastic_public_key="$(echo "$meshtastic_public_key" | sed 's/\\//g')" # remove weirdo windows characters
- log_message "Updating Meshtastic public key."
- found_config="true"
- meshtastic_security_command+=" -U \"$meshtastic_public_key\"" # add to the command list
- fi
-
- if [[ -n "$meshtastic_private_key" ]]; then # private key
- meshtastic_private_key="$(echo "$meshtastic_private_key" | sed 's/\\//g')" # remove weirdo windows characters
- log_message "Updating Meshtastic private key."
- found_config="true"
- meshtastic_security_command+=" -R \"$meshtastic_private_key\"" # add to the command list
- fi
-
- if [[ -n "$meshtastic_admin_key" ]]; then # admin key
+
+ if [[ -n "$meshtastic_admin_key" ]]; then
meshtastic_admin_key=$(echo "$meshtastic_admin_key" | sed 's/\\//g') # remove weirdo windows characters
if [ "$meshtastic_admin_key" = "clear" ]; then
log_message "Clearing Meshtastic admin key list."
@@ -290,97 +224,48 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then
log_message "Updating Meshtastic admin key."
fi
found_config="true"
- meshtastic_security_command+=" -A \"$meshtastic_admin_key\"" # add to the command list
+ meshtastic_security_command+=" -a \"$meshtastic_admin_key\"" # add to the command list
fi
- if [[ -n "$meshtastic_legacy_admin" ]]; then # legacy admin
+ if [[ -n "$meshtastic_legacy_admin" ]]; then
meshtastic_legacy_admin=$(echo "$meshtastic_legacy_admin" | sed 's/\\//g') # remove weirdo windows characters
log_message "Updating Meshtastic legacy admin."
found_config="true"
meshtastic_security_command+=" -o \"$meshtastic_legacy_admin\"" # add to the command list
fi
- # get meshtastic_cli= lines and run them
- while IFS='=' read -r key value; do
- log_message "Meshtastic CLI command found."
- femto-meshtasticd-config.sh -m "$value" 3 "Meshtastic CLI command" 2>&1 | tee -a /tmp/femtofox-config.log
- if [ $? -eq 1 ]; then
- partial_failure=true
- log_message "\033[0;31mMeshtastic CLI command \`meshtastic --host $value\` FAILED.\033[0m" | tee -a /tmp/femtofox-config.log
- fi
- found_config=true
- done < <(grep '^meshtastic_cli=' "$usb_config" | sed -E 's/^meshtastic_cli=["]?(.*[^"])["]?$/meshtastic_cli=\1/')
-
- # install software packages from software_install=
- package_dir="/usr/local/bin/packages"
- export HOME=/root
- IFS=',' read -ra packages <<< "$software_install"
- for package in "${packages[@]}"; do
- if [[ -f "/usr/local/bin/packages/${package}.sh" ]]; then
- found_config=true
- log_message "Installing $($package_dir/${package}.sh -N) in non-interactive mode..." | tee -a /tmp/femtofox-config.log
- for i in {1..5}; do
- set -o pipefail
- $package_dir/${package}.sh -xi | tee -a /tmp/femtofox-config.log
- last_install_attempt_state=${PIPESTATUS[0]}
- set +o pipefail
- if [ $last_install_attempt_state -eq 0 ]; then
- log_message "\033[0;32mInstallation of $($package_dir/${package}.sh -N) successful!\033[0m"
- break
- fi
- [ $i = 5 ] && log_message "Installation failed... Is internet connected?" && break
- log_message "Installation failed ($((i+1))/5). Retrying..."
- sleep 4
- done
- if [ $last_install_attempt_state -ne 0 ]; then
- log_message "\033[0;31mInstallation of $($package_dir/${package}.sh -N) unsuccessful!\033[0m"
- partial_failure=true
- fi
- else
- log_message "\033[0;31mSoftware package $package_dir/${package}.sh does not exist, ignoring...\033[0m"
- partial_failure=true
- fi
- done
-
- if [[ -n "$meshtastic_i2c" ]]; then # set meshtastic i2c state
- femto-meshtasticd-config.sh -I $meshtastic_i2c 2>&1 | tee -a /tmp/femtofox-config.log
- log_message "Set Meshtastic i2c state to \`$meshtastic_i2c\`."
- found_config="true"
- fi
-
-
if [ "$found_config" = true ]; then #if we found a config file containing valid data
+ if [ "$update_wifi" = true ]; then #if wifi config found, restart wifi
+ log_message "Making changes to wifi settings and restarting wifi."
+ wifi_command="$wifi_command -r"
+ eval $wifi_command 2>&1 | tee -a /tmp/femtofox-config.log
+ log_message "wpa_supplicant.conf updated and wifi restarted. Enabling Meshtastic wifi setting."
+ fi
+
if [ "$meshtastic_url" != "" ]; then
log_message "Connecting to Meshtastic radio and submitting $meshtastic_url"
femto-meshtasticd-config.sh -q "$meshtastic_url" 2>&1 | tee -a /tmp/femtofox-config.log
- if [ $? -eq 1 ]; then
- partial_failure=true
- log_message "\033[0;31mSetting Meshtastic URL to $meshtastic_url FAILED.\033[0m" | tee -a /tmp/femtofox-config.log
- fi
fi
if [ "$meshtastic_security_command" != "femto-meshtasticd-config.sh" ]; then
log_message "Connecting to Meshtastic radio and submitting $meshtastic_security_command"
eval "$meshtastic_security_command" 2>&1 | tee -a /tmp/femtofox-config.log
- if [ $? -eq 1 ]; then
- partial_failure=true
- log_message "\033[0;31mSetting Meshtastic security settings FAILED.\033[0m" | tee -a /tmp/femtofox-config.log
- fi
fi
for _ in {1..10}; do #do our successful config boot code
blink "0.125" && sleep 0.125
done
else #if no valid data in config file
- log_message "\e[31mfemtofox-config.txt does not contain valid configuration info, ignoring.\e[0m"
+ log_message "femtofox-config.txt does not contain valid configuration info, ignoring."
for _ in {1..5}; do #boot code
blink "1.5" && sleep 0.5
done
exit_script 1
fi
+
else
- log_message "\e[31mUSB drive mounted but femtofox-config.txt not found, ignoring.\e[0m"
+ log_message "USB drive mounted but femtofox-config.txt not found, ignoring."
for _ in {1..3}; do #boot code
blink "1.5" && sleep 0.5
done
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh
deleted file mode 100755
index 0e3af30..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh
+++ /dev/null
@@ -1,326 +0,0 @@
-#!/bin/bash
-
-if [[ $EUID -ne 0 ]]; then
- echo "This script must be run as root. Try \`sudo femto-meshtasticd-config\`."
- exit 1
-fi
-
-help=$(cat < /sys/class/leds/work/trigger
- grep -qE '^act_led=' /etc/femto.conf && sed -i -E 's/^act_led=.*/act_led=disable/' /etc/femto.conf || echo 'act_led=disable' | tee -a /etc/femto.conf > /dev/null
- echo "Disabled activity LED."
- exit 0
- elif [ "$1" = "enable" ]; then
- echo "activity" > /sys/class/leds/work/trigger
- grep -qE '^act_led=' /etc/femto.conf && sed -i -E 's/^act_led=.*/act_led=enable/' /etc/femto.conf || echo 'act_led=enable' | tee -a /etc/femto.conf > /dev/null
- echo "Enabled activity LED."
- exit 0
- elif [ "$1" = "check" ]; then
- if grep -qE '^act_led=enable' /etc/femto.conf; then
- echo -e "\033[0;34menabled\033[0m"
- elif grep -qE '^act_led=disable' /etc/femto.conf; then
- echo -e "\033[0;31mdisabled\033[0m"
- else
- echo "unknown"
- fi
- elif [ -z $1 ]; then
- local state=$(act_led "check" 2>/dev/null)
- if [[ "$state" =~ "enabled" ]]; then
- act_led "enable"
- elif [[ "$state" =~ "disabled" ]]; then
- act_led "disable"
- fi
- fi
-}
-
-cpu_info() {
- local core="Luckfox Pico"
- local cpu_model="$(tr -d '\0' 1000) {printf "%.2f GB (%.2f%% free)", $2/1024, ($4/$2)*100} else {printf "%d MB (%.2f%% free)", $2, ($4/$2)*100}}')"
- local mounted_drives="$( [ "$(for dir in /mnt/*/; do [ -d "$dir" ] && echo -n "/mnt${dir#"/mnt"} "; done)" ] && echo "$(for dir in /mnt/*/; do [ -d "$dir" ] && echo -n "/mnt${dir#"/mnt"} "; done | sed 's/\/$//')" || echo "none" )"
-
- echo -e "\
-microSD size:$microsd_size\n\
-Memory:$memory\n\
-Swap:$swap\n\
-Mnted drives:$mounted_drives"
-}
-
-os_info() {
- local os_version="$(femto-utils.sh -v) ($(lsb_release -d | awk -F'\t' '{print $2}') $(lsb_release -c | awk -F'\t' '{print $2}'))"
- local system_uptime="$(uptime -p | awk '{$1=""; print $0}' | sed -e 's/ day\b/d/g' -e 's/ hour\b/h/g' -e 's/ hours\b/h/g' -e 's/ minute\b/m/g' -e 's/ minutes\b/m/g' | sed 's/,//g')"
- local kernel_active_modules="$(lsmod | awk 'NR>1 {print $1}' | tr '\n' ' ' && echo)"
- local kernel_boot_modules="$(modules=$(sed -n '6,$p' /etc/modules | sed ':a;N;$!ba;s/\n/, /g;s/, $//'); [ -z "$modules" ] && echo "none" || echo "$modules")"
- local kernel_modules_blacklist="$(femto-kernel-modules.sh -y | sed 's/\x1B\[[0-9;]*m//g')" #remove underline
- local ttyd_enabled="$(femto-utils.sh -C "ttyd")"
- local logging_enabled="$(logging "check" | sed 's/\x1b\[[0-9;]*m//g')"
- local act_led="$(femto-utils.sh -a "check" | sed -r 's/\x1B\[[0-9;]*[mK]//g')" #remove color from output
-
- echo -e "\
-OS:$os_version\n\
-Kernel ver:$(uname -r)\n\
-Uptime:$system_uptime\n\
-System time:$(date)\n\
-K mods active:$kernel_active_modules\n\
-K boot mods:$kernel_boot_modules\n\
-K mod blcklst: $kernel_modules_blacklist
-Web terminal:$ttyd_enabled\n\
-Logging:$logging_enabled\n\
-Activity LED:$act_led"
-}
-
-networking_info() {
- local wifi_status="$(femto-network-config.sh -w | grep -v '^$' | grep -v '^Hostname')" #remove hostname line, as it's identical to the one in ethernet settings
- local eth_status="$(femto-network-config.sh -e)"
- echo -e "$wifi_status\n\
-
-$eth_status"
-}
-
-peripherals_info() {
- local usb_mode="$(cat /sys/devices/platform/ff3e0000.usb2-phy/otg_mode)"
- local spi0_state="$([ "$(awk -F= '/^SPI0_M0_STATUS/ {print $2}' /etc/luckfox.cfg)" -eq 1 ] && echo "enabled" || echo "disabled")"
- local spi0_speed="$((0x$(xxd -p /sys/firmware/devicetree/base/spi@ff500000/spidev@0/spi-max-frequency | tr -d '\n')))"
- local i2c3_state="$([ "$(awk -F= '/^I2C3_M1_STATUS/ {print $2}' /etc/luckfox.cfg)" -eq 1 ] && echo "enabled" || echo "disabled")"
- local i2c3_speed="$(awk -F= '/^I2C3_M1_SPEED/ {print $2}' /etc/luckfox.cfg)"
- local uart3_state="$([ "$(awk -F= '/^UART3_M1_STATUS/ {print $2}' /etc/luckfox.cfg)" -eq 1 ] && echo "enabled" || echo "disabled")"
- local uart4_state="$([ "$(awk -F= '/^UART4_M1_STATUS/ {print $2}' /etc/luckfox.cfg)" -eq 1 ] && echo "enabled" || echo "disabled")"
- local lora_radio="$(femto-meshtasticd-config.sh -k)"
- local usb_devices="$(lsusb | grep -v 'root hub' | awk 'NR>0{printf "USB:"; for(i=7;i<=NF;i++) printf "%s ", $i; print ""} END {if (NR == 0) printf "USB:none detected"}')"
- # gather i2c addresses
- i2c_addresses="" # initialize empty string to collect populated addresses
- while IFS= read -r line; do # iterate over each row of output (captured at end of while loop)
- if [[ "$line" =~ ^[0-9a-f]+: ]]; then # check if the row contains addresses (skip header row)
- columns=($line) # split the line into columns based on spaces
- row="${columns[0]:0:1}" # use the first numeral of the row number
- for col_idx in "${!columns[@]}"; do # iterate columns
- if [[ $col_idx -gt 0 && "${columns[$col_idx]}" != "--" ]]; then # skip first column (row numbers)
- [[ "$row" == "0" ]] && col_idx=$((col_idx + 8)) # if first row, we start at #7, so add 8 to the column number reported
- i2c_addresses+="0x$(printf "%x" "$((16#$row))")$(printf "%x" $((col_idx - 1))) " # calculate hexadecimal with '0x'
- fi
- done
- fi
- done <<< "$(echo "$(timeout 3 i2cdetect -y 3)")" # when no i2c devices are connected, i2cdetect tries to connect for a solid 25 seconds. The timeout prevents this
- [[ -z "$i2c_addresses" ]] && i2c_addresses="none detected" # if no addresses found, "none detected"
-
- echo -e "LoRa radio:$lora_radio\n\
-$usb_devices\n\
-i2c devices:$i2c_addresses\n\
-USB mode:$usb_mode\n\
-SPI-0 state:$spi0_state\n\
-SPI-0 speed:$spi0_speed\n\
-i2c-3 state:$i2c3_state\n\
-i2c-3 speed:$i2c3_speed\n\
-UART-3 state:$uart3_state\n\
-UART-4 state:$uart4_state"
-}
-
-all_system_info() {
- echo -e "\
- Femtofox\n\
- CPU:\n\
-$(cpu_info)\n\
-\n\
- Operating System:\n\
-$(os_info)\n\
-\n\
- Storage:\n\
-$(storage_info)\n\)
-\n\
- Networking (wlan0 & eth0):\n\
-$(networking_info)\n\
-\n\
- Peripherals:\n\
-$(peripherals_info)\n\
-\n\
- Meshtasticd:\n\
-$(femto-meshtasticd-config.sh -i)"
-}
-
-# enable/disable/check system logging
-logging() {
- if [ "$1" = "disable" ]; then
- msg="Disabling system logging by making /var/log immutable."
- logger $msg
- echo $msg
- chattr +i /var/log
- return 0
- elif [ "$1" = "enable" ]; then
- chattr -i /var/log
- msg="Enabling system logging by making /var/log writable."
- logger $msg
- echo $msg
- return 0
- elif [ "$1" = "check" ]; then
- lsattr -d /var/log | grep -q 'i' && echo -e "\033[0;31mdisabled\033[0m" || echo -e "\033[0;34menabled\033[0m"
- else
- echo "\`$1\` is not a valid argument for -L. Options are \"enable\" and \"disable\"."
- echo -e "$help"
- fi
-}
-
-# Dialog uses a different method to display colors, and is limited to only these 8.
-replace_colors() {
- input="$1"
- input="${input//$(echo -e '\033[0;30m')/\\Z0}" # black
- input="${input//$(echo -e '\033[0;31m')/\\Z1}" # red
- input="${input//$(echo -e '\033[0;32m')/\\Z2}" # green
- input="${input//$(echo -e '\033[0;33m')/\\Z3}" # yellow
- input="${input//$(echo -e '\033[0;34m')/\\Z4}" # blue
- input="${input//$(echo -e '\033[0;35m')/\\Z5}" # magenta
- input="${input//$(echo -e '\033[0;36m')/\\Z6}" # cyan
- input="${input//$(echo -e '\033[0;37m')/\\Z7}" # white
- input="${input//$(echo -e '\033[7m')/\\Zr}" # invert
- input="${input//$(echo -e '\033[4m')/\\Zu}" # underline
- input="${input//$(echo -e '\e[39m')/\\Z0}" # reset colors not underline
- input="${input//$(echo -e '\033[0m')/\\Zn}" # reset all
- echo "$input"
-}
-
-while getopts ":harsl:ipcnoSEC:R:A:v" opt; do
- case ${opt} in
- h) # Option -h (help)
- echo -e "$help"
- ;;
- a) # Option -a (ACT LED enable/disable/check)
- act_led $2
- exit 0 # exit immediately for boot speed
- ;;
- r) # Option -r (reboot)
- echo -e "Rebooting..."
- reboot
- ;;
- s) # Option -s (shutdown)
- echo -e "Shutting down...\n\nPower consumption will not stop."
- logger "User requested system halt"
- halt
- ;;
- l) logging $OPTARG ;; # Option -l (Logging enable/disable/check)
- i) all_system_info ;; # Option -i (sysinfo)
- p) peripherals_info ;; # Option -p (Peripherals info)
- c) cpu_info ;; # Option -c (CPU info)
- n) networking_info ;; # Option -n (Networing info)
- o) os_info ;; # Option -o (OS info)
- S) storage_info ;; # Option -S (Storage & RAM info)
- E) # Option -E (new SSH encryption keys)
- rm /etc/ssh/ssh_host_*
- ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N ""
- ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key -N ""
- chmod 600 /etc/ssh/ssh_host_*_key
- chmod 644 /etc/ssh/ssh_host_*_key.pub
- chown root:root /etc/ssh/ssh_host_*
- systemctl restart ssh
- ;;
- C) # Option -C (Check service status)
- if systemctl is-enabled $OPTARG &>/dev/null; then
- state_message="\033[0;34m\033[4menabled\033[0m, "
- else
- state_message="\033[0;31m\033[4mdisabled\033[0m, "
- fi
- full_status=$(systemctl status $OPTARG)
- if echo $full_status | grep -q "active (running)"; then
- state_message+="\033[4m\033[0;34mrunning\033[0m"
- exit_state=0
- elif echo $full_status | grep -q "inactive (dead)"; then
- state_message+="\033[4m\033[0;31mnot running\033[0m"
- exit_state=1
- elif echo $full_status | grep -q "failed"; then
- state_message+="\033[4m\033[0;31mfailed\033[0m"
- exit_state=1
- elif echo $full_status | grep -q "activating"; then
- state_message+="\033[4mactivating\033[0m"
- exit_state=2
- else
- state_message+="\033[4munknown\033[0m"
- exit_state=2
- fi
- echo -e "$state_message"
- exit $exit_state
- ;;
- R) # replace colors)
- replace_colors "$OPTARG"
- ;;
- A) # Stop/start services that are using the meshtastic API)
- # this code cycles through all the software packages and looks for ones that are installed, conflict with Control and have a service that is enabled. If it finds such a software package, it either stops or starts it, according to $OPTARG
- if [[ $OPTARG == "stop" ]]; then
- action_text="Stopping"
- action="s"
- elif [[ $OPTARG == "start" ]]; then
- action_text="Starting"
- action="r"
- else
- echo "\`$OPTARG\` is not a valid argument for -A. Options are \"stop\" and \"start\"."
- echo -e "$help"
- exit 1
- fi
-
- for file in /usr/local/bin/packages/*.sh; do
- filename=$(basename "$file")
-
- [[ "$filename" == femto_* ]] && continue # Skip files starting with "femto_"
-
- if sudo "$file" -I; then
- if echo "$(sudo "$file" -C)" | grep -q "\"full control\" Meshtastic software"; then
- service_state=$(sudo femto-utils.sh -C "$(sudo $file -E)")
- if [[ $service_state =~ "enabled" ]] ; then
- echo "$action_text $(sudo $file -N) service..."
- eval "sudo $file -$action"
- fi
- fi
- fi
- done
- ;;
- v) # get foxbuntu version)
- echo "Foxbuntu v$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'patch=\K[0-9]+' /etc/foxbuntu-release)$(grep -oP 'hotfix=\K\S+' /etc/foxbuntu-release)"
- ;;
- \?) # Unknown argument)
- echo -e "Unknown argument $1.\n$help"
- ;;
- esac
-done
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh
deleted file mode 100755
index d6c56bc..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env bash
-
-THRESHOLD=$((7 * 24 * 60 * 60)) # 1 week in seconds
-LOGFILE="/var/log/time_change.log"
-LAST_TIME_FILE="/tmp/last_time"
-
-# Ensure the log file exists and is writable
-if [ ! -f "$LOGFILE" ]; then
- touch "$LOGFILE" || { echo "ERROR: Cannot create log file $LOGFILE"; exit 1; }
-fi
-if [ ! -w "$LOGFILE" ]; then
- echo "ERROR: Log file $LOGFILE is not writable"
- exit 1
-fi
-
-# Ensure the last time file exists and is writable
-if [ ! -f "$LAST_TIME_FILE" ]; then
- date +%s > "$LAST_TIME_FILE" || { echo "ERROR: Cannot create last time file $LAST_TIME_FILE"; exit 1; }
-fi
-if [ ! -w "$LAST_TIME_FILE" ]; then
- echo "ERROR: Last time file $LAST_TIME_FILE is not writable"
- exit 1
-fi
-
-while true; do
- # Check if meshtasticd service is running
- if ! systemctl is-active --quiet meshtasticd; then
- #echo "meshtasticd service is not running. Skipping..." | tee -a "$LOGFILE"
- sleep 30
- continue
- fi
- NEW_TIME=$(date +%s)
-
- # Ensure last_time file is readable before using it
- if [ ! -r "$LAST_TIME_FILE" ]; then
- echo "ERROR: Last time file $LAST_TIME_FILE is not readable" | tee -a "$LOGFILE"
- exit 1
- fi
-
- OLD_TIME=$(cat "$LAST_TIME_FILE")
- TIME_DIFF=$((NEW_TIME - OLD_TIME))
-
- if [ "${TIME_DIFF#-}" -ge "$THRESHOLD" ]; then
- echo "$(date) - Large time change detected ($TIME_DIFF seconds), restarting meshtasticd" | tee -a "$LOGFILE"
- systemctl restart meshtasticd
- fi
-
- # Ensure last_time file is writable before updating it
- if [ -w "$LAST_TIME_FILE" ]; then
- echo "$NEW_TIME" > "$LAST_TIME_FILE"
- else
- echo "ERROR: Failed to write to $LAST_TIME_FILE" | tee -a "$LOGFILE"
- exit 1
- fi
-
- sleep 30
-done
-
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh
index 4add3fd..4e18dd0 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh
@@ -1,25 +1,58 @@
#!/bin/bash
+if [[ $EUID -ne 0 ]]; then
+ echo "This script must be run as root. Try \`sudo femto-meshtasticd-config\`."
+ exit 1
+fi
+
+args="$@" # arguments to this script
+interactive="true"
+help=$(cat < /dev/null
# uninstall script
uninstall() {
rm -rf $location
- echo "Removed \`$location\`."
rm /usr/local/bin/contact
- echo "Removed \`contact\` shortcut."
echo "user_message: All files removed."
exit 0 # should be `exit 1` if the installation failed
}
@@ -83,12 +113,53 @@ check() {
fi
}
-# display license
-license() {
- echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")"
-}
-
-# parse arguments
-source /usr/local/bin/packages/femto_argument_parse.sh "$@"
+while getopts ":h$options" opt; do
+ case ${opt} in
+ h) # Option -h (help)
+ echo -e "$help"
+ ;;
+ x) # Option -x (no user interaction available)
+ interactive="false"
+ ;;
+ i) # Option -i (install)
+ install
+ ;;
+ u) # Option -u (uninstall)
+ uninstall
+ ;;
+ g) # Option -g (upgrade)
+ upgrade
+ ;;
+ e) # Option -e (Enable service, if applicable)
+ systemctl enable $service_name
+ ;;
+ d) # Option -d (Disable service, if applicable)
+ systemctl disable $service_name
+ ;;
+ s) # Option -s (Stop service)
+ systemctl stop $service_name
+ ;;
+ r) # Option -r (Start/Restart)
+ systemctl restart $service_name
+ ;;
+ l) # Option -l (Run software)
+ echo "Launching $name..."
+ sudo -u ${SUDO_USER:-$(whoami)} $launch
+ ;;
+ N) echo -e $name ;;
+ A) echo -e $author ;;
+ D) echo $description ;;
+ U) echo -e $URL ;;
+ O) echo -e $options ;;
+ S) # Option -S (Get service status)
+ systemctl status $service_name
+ ;;
+ L) echo -e $location ;;
+ C) echo -e $conflicts ;;
+ I) # Option -I (Check if already installed)
+ check
+ ;;
+ esac
+done
exit 0
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh
deleted file mode 100755
index 0272b95..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/bash
-### For package maintainer:
-# Fill the following fields and choose the options that are in use by this package
-# Populate the install, uninstall and upgrade functions
-# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't always possible
-# This system supports both interactive and non-interactive installs. For non-interactive installs, $interaction="false". In this cause special instructions to the user should be given as user_message, such as `After installation, edit /opt/software/config.ini`
-# Successful operations should `exit 0`, fails should `exit 1`
-# Messages to the user (such as configuration instructions, explanatory error messages, etc) should be given as: `echo "user_message: text"`
-# Everything following `user_message: ` will be displayed prominently to the user, so it must the last thing echoed
-
-name="Control for Meshtastic" # software name
-author="pdxlocations" # software author - OPTIONAL
-description="Control for Meshtastic is a fully-featured Meshtastic configuration tool made for running in console, utilizing Curses.\n\nControl is installed by default on Femtofox and is used for Meshtastic configuration in femto-config. Uninstallation is not recommended." # software description - OPTIONAL (but strongly recommended!)
-URL="https://github.com/pdxlocations/control" # software URL. Can contain multiple URLs - OPTIONAL
-options="hxiuglNADUOLGTIC" # script options in use by software package. For example, for a package with no service, exclude `edsrS`
-launch="echo \"Stopping conflicting services (if any), will restart after exit...\" && sudo femto-utils.sh -A stop && sudo -u ${SUDO_USER:-$(whoami)} env LANG=$LANG TERM=$TERM NCURSES_NO_UTF8_ACS=$NCURSES_NO_UTF8_ACS python /opt/control/main.py --host && echo \"Restarting conflicting services (if any)...\" && sudo femto-utils.sh -A start" # command to launch software, if applicable
-license="/opt/control/LICENSE" # file to cat to display license
-location="/opt/control" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name`
-license="$location/LICENSE" # file to cat to display license
-license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string
-conflicts="\"Full control\" Meshtastic software, such as TC²-BBS and Meshing Around - but only while running." # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI"
-
-# install script
-install() {
- if ! git clone https://github.com/pdxlocations/control.git /opt/control; then
- echo "user_message: Git clone failed. Is internet connected?"
- exit 1
- fi
- pip install -r $location/requirements.txt
- chown -R femto $location #give ownership of installation directory to $user
- git config --global --add safe.directory $location # prevents git error when updating
- echo "user_message: To launch, go to Meshtastic settings. Launching manually may conflict with \`full control\` Meshtastic software such as BBS."
- exit 0 # should be `exit 1` if operation failed
-}
-
-# uninstall script
-uninstall() {
- rm -rf $location
- echo "Removed \`$location\`."
- echo "user_message: All files removed."
- exit 0 # should be `exit 1` if operation failed
-}
-
-#upgrade script
-upgrade() {
- cd $location
- if ! git pull; then
- echo "user_message: Git pull failed. Is internet connected?"
- exit 1
- fi
- exit 0
-}
-
-# Check if already installed. `exit 0` if yes, `exit 1` if no
-check() {
- #the following works for cloned repos, but not for apt installs
- if [ -d "$location" ]; then
- #echo "Already installed"
- exit 0
- else
- #echo "Not installed"
- exit 1
- fi
-}
-
-# display license
-license() {
- echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")"
-}
-
-# parse arguments
-source /usr/local/bin/packages/femto_argument_parse.sh "$@"
-
-exit 0
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_argument_parse.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_argument_parse.sh
deleted file mode 100755
index a79d5d9..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_argument_parse.sh
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/bin/bash
-if [[ $EUID -ne 0 ]]; then
- echo "This script must be run as root. Try \`sudo\`."
- exit 1
-fi
-if [ $# -eq 0 ]; then
- echo "No arguments provided."
- echo -e "$help"
- exit 1
-fi
-interactive="true" # by default, we're in interactive mode
-
-help=$(cat <&1 | tee /dev/tty || { echo "user_message: apt update failed. Is internet connected?"; exit 1; }
- # DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty || { echo "user_message: apt install failed. Is internet connected?"; exit 1; }
- echo "user_message: Exit message to user, displayed prominently in post-install"
- exit 0 # should be `exit 1` if operation failed
-}
-
-# uninstall script
-uninstall() {
- echo "user_message: Exit message to user, displayed prominently in post-install"
- exit 0 # should be `exit 1` if operation failed
-}
-
-# code that must be run to initialize the installation prior to use, but can only be run from terminal
-interactive_init() {
- exit 0 # should be `exit 1` if operation failed
-}
-
-# upgrade script
-upgrade() {
- echo "user_message: Exit message to user, displayed prominently in post-install"
- exit 0 # should be `exit 1` if operation failed
-}
-
-# Check if already installed. `exit 0` if yes, `exit 1` if no
-check() {
- ## the following works for cloned repos, but not for apt installs
- # if [ -d "$location" ]; then
- # exit 0
- # else
- # exit 1
- # fi
-
- ## this works for apt packages
- # if dpkg-query -W -f='${Status}' $package_name 2>/dev/null | grep -q "install ok installed"; then
- # exit 0
- # else
- # exit 1
- # fi
-}
-
-# display license - limit to 2000 chars
-license() {
- echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")"
-}
-
-## custom getopts example for this package
-# if [[ "$1" == "-k" ]]; then
-# generate_keys
-# fi
-
-# parse arguments
-source /usr/local/bin/packages/femto_argument_parse.sh "$@"
-
-# extra help example for this package
-# if [[ "$1" == "-h" ]]; then
-# echo -e "Additional argument for this package:\n\
-# -k Generate SSL keys. Must be first argument."
-# fi
-
-exit 0
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh
index 2dda8ad..06528da 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh
@@ -1,9 +1,48 @@
#!/bin/bash
+if [[ $EUID -ne 0 ]]; then
+ echo "This script must be run as root. Try \`sudo\`."
+ exit 1
+fi
+if [ $# -eq 0 ]; then
+ echo "No arguments provided."
+ echo -e "$help"
+ exit 1
+fi
+
+args="$@" # arguments to this script
+interactive="true"
+help=$(cat <&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; }
- DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt install failed. Is internet connected?"; exit 1; }
+ DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
+ DEBIAN_FRONTEND=noninteractive apt-get install mosquitto -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
echo "user_message: Installation requires more setup. For a guide, see https://docs.vultr.com/how-to-install-mosquitto-mqtt-broker-on-ubuntu-24-04"
exit 0 # should be `exit 1` if operation failed
}
@@ -35,7 +71,7 @@ install() {
# uninstall script
uninstall() {
- DEBIAN_FRONTEND=noninteractive apt remove -y $package_name 2>&1 | tee /dev/tty
+ DEBIAN_FRONTEND=noninteractive apt remove -y mosquitto 2>&1 | tee /dev/tty
/usr/local/bin/mosquitto_mqtt_broker.sh -s # stop service
/usr/local/bin/mosquitto_mqtt_broker.sh -d # disable service
echo "user_message: Some files may remain on system. To remove, run \`sudo apt remove --purge mosquitto -y\` and \`sudo apt autoremove -y\`."
@@ -46,26 +82,67 @@ uninstall() {
#upgrade script
upgrade() {
echo "apt update can take a long while..."
- DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; }
- DEBIAN_FRONTEND=noninteractive apt upgrade -y $package_name 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt upgrade failed. Is internet connected?"; exit 1; }
+ DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
+ DEBIAN_FRONTEND=noninteractive apt upgrade -y mosquitto 2>&1 | tee /dev/tty
exit 0 # should be `exit 1` if operation failed
}
# Check if already installed. `exit 0` if yes, `exit 1` if no
check() {
-if dpkg-query -W -f='${Status}' $package_name 2>/dev/null | grep -q "install ok installed"; then
+if dpkg -l | grep -q mosquitto; then
exit 0
else
exit 1
fi
}
-# display license
-license() {
- echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")"
-}
-
-# parse arguments
-source /usr/local/bin/packages/femto_argument_parse.sh "$@"
+while getopts ":h$options" opt; do
+ case ${opt} in
+ h) # Option -h (help)
+ echo -e "$help"
+ ;;
+ x) # Option -x (no user interaction available)
+ interaction="false"
+ ;;
+ i) # Option -i (install)
+ install
+ ;;
+ u) # Option -u (uninstall)
+ uninstall
+ ;;
+ g) # Option -g (upgrade)
+ upgrade
+ ;;
+ e) # Option -e (Enable service, if applicable)
+ systemctl enable $service_name
+ ;;
+ d) # Option -d (Disable service, if applicable)
+ systemctl disable $service_name
+ ;;
+ s) # Option -s (Stop service)
+ systemctl stop $service_name
+ ;;
+ r) # Option -r (Start/Restart)
+ systemctl restart $service_name
+ ;;
+ l) # Option -l (Run software)
+ echo "Launching $name..."
+ sudo -u ${SUDO_USER:-$(whoami)} $launch
+ ;;
+ N) echo -e $name ;;
+ A) echo -e $author ;;
+ D) echo $description ;;
+ U) echo -e $URL ;;
+ O) echo -e $options ;;
+ S) # Option -S (Get service status)
+ systemctl status $service_name
+ ;;
+ L) echo -e $location ;;
+ C) echo -e $conflicts ;;
+ I) # Option -I (Check if already installed)
+ check
+ ;;
+ esac
+done
exit 0
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh
index 9814373..834d85c 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh
@@ -1,9 +1,48 @@
#!/bin/bash
+if [[ $EUID -ne 0 ]]; then
+ echo "This script must be run as root. Try \`sudo\`."
+ exit 1
+fi
+if [ $# -eq 0 ]; then
+ echo "No arguments provided."
+ echo -e "$help"
+ exit 1
+fi
+
+args="$@" # arguments to this script
+interaction="true"
+help=$(cat <&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; }
- DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt install failed. Is internet connected?"; exit 1; }
+ DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
+ DEBIAN_FRONTEND=noninteractive apt-get install mosquitto-clients -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
echo "user_message: Installation requires more setup. For a guide, see https://docs.vultr.com/how-to-install-mosquitto-mqtt-broker-on-ubuntu-24-04"
exit 0 # should be `exit 1` if operation failed
}
@@ -44,26 +80,67 @@ uninstall() {
#upgrade script
upgrade() {
echo "apt update can take a long while..."
- DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; }
- DEBIAN_FRONTEND=noninteractive apt upgrade -y $package_name 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt upgrade failed. Is internet connected?"; exit 1; }
+ DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
+ DEBIAN_FRONTEND=noninteractive apt upgrade -y mosquitto-clients 2>&1 | tee /dev/tty
exit 0 # should be `exit 1` if operation failed
}
# Check if already installed. `exit 0` if yes, `exit 1` if no
check() {
-if dpkg-query -W -f='${Status}' $package_name 2>/dev/null | grep -q "install ok installed"; then
+if dpkg -l | grep -q mosquitto-clients; then
exit 0
else
exit 1
fi
}
-# display license
-license() {
- echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")"
-}
-
-# parse arguments
-source /usr/local/bin/packages/femto_argument_parse.sh "$@"
+while getopts ":h$options" opt; do
+ case ${opt} in
+ h) # Option -h (help)
+ echo -e "$help"
+ ;;
+ x) # Option -x (no user interaction available)
+ interaction="false"
+ ;;
+ i) # Option -i (install)
+ install
+ ;;
+ u) # Option -u (uninstall)
+ uninstall
+ ;;
+ g) # Option -g (upgrade)
+ upgrade
+ ;;
+ e) # Option -e (Enable service, if applicable)
+ systemctl enable $service_name
+ ;;
+ d) # Option -d (Disable service, if applicable)
+ systemctl disable $service_name
+ ;;
+ s) # Option -s (Stop service)
+ systemctl stop $service_name
+ ;;
+ r) # Option -r (Start/Restart)
+ systemctl restart $service_name
+ ;;
+ l) # Option -l (Run software)
+ echo "Launching $name..."
+ sudo -u ${SUDO_USER:-$(whoami)} $launch
+ ;;
+ N) echo -e $name ;;
+ A) echo -e $author ;;
+ D) echo $description ;;
+ U) echo -e $URL ;;
+ O) echo -e $options ;;
+ S) # Option -S (Get service status)
+ systemctl status $service_name
+ ;;
+ L) echo -e $location ;;
+ C) echo -e $conflicts ;;
+ I) # Option -I (Check if already installed)
+ check
+ ;;
+ esac
+done
exit 0
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh
new file mode 100755
index 0000000..19a5dcd
--- /dev/null
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh
@@ -0,0 +1,150 @@
+#!/bin/bash
+if [[ $EUID -ne 0 ]]; then
+ echo "This script must be run as root. Try \`sudo\`."
+ exit 1
+fi
+if [ $# -eq 0 ]; then
+ echo "No arguments provided."
+ echo -e "$help"
+ exit 1
+fi
+
+args="$@" # arguments to this script
+interaction="true"
+help=$(cat <&1 | tee /dev/tty # allows output to be shown onscreen
+ echo "user_message: Exit message to user, displayed prominently in post-install"
+ exit 0 # should be `exit 1` if operation failed
+}
+
+
+# uninstall script
+uninstall() {
+ echo "user_message: Exit message to user, displayed prominently in post-install"
+ exit 0 # should be `exit 1` if operation failed
+}
+
+
+# upgrade script
+upgrade() {
+ echo "user_message: Exit message to user, displayed prominently in post-install"
+ exit 0 # should be `exit 1` if operation failed
+}
+
+# Check if already installed. `exit 0` if yes, `exit 1` if no
+check() {
+ # the following works for cloned repos, but not for apt installs
+ if [ -d "$location" ]; then
+ exit 0
+ else
+ exit 1
+ fi
+
+ # this works for apt packages
+ if [ dpkg -l | grep -q package-name ] ; then
+ exit 0
+ else
+ exit 1
+ fi
+}
+
+while getopts ":h$options" opt; do
+ case ${opt} in
+ h) # Option -h (help)
+ echo -e "$help"
+ ;;
+ x) # Option -x (no user interaction available)
+ interaction="false"
+ ;;
+ i) # Option -i (install)
+ install
+ ;;
+ u) # Option -u (uninstall)
+ uninstall
+ ;;
+ g) # Option -g (upgrade)
+ upgrade
+ ;;
+ e) # Option -e (Enable service, if applicable)
+ systemctl enable $service_name
+ ;;
+ d) # Option -d (Disable service, if applicable)
+ systemctl disable $service_name
+ ;;
+ s) # Option -s (Stop service)
+ systemctl stop $service_name
+ ;;
+ r) # Option -r (Start/Restart)
+ systemctl restart $service_name
+ ;;
+ l) # Option -l (Run software)
+ echo "Launching $name..."
+ sudo -u ${SUDO_USER:-$(whoami)} $launch
+ ;;
+ N) echo -e $name ;;
+ A) echo -e $author ;;
+ D) echo $description ;;
+ U) echo -e $URL ;;
+ O) echo -e $options ;;
+ S) # Option -S (Get service status)
+ systemctl status $service_name
+ ;;
+ L) echo -e $location ;;
+ C) echo -e $conflicts ;;
+ I) # Option -I (Check if already installed)
+ check
+ ;;
+ esac
+done
+
+exit 0
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh
deleted file mode 100755
index ef04599..0000000
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/bash
-
-### For package maintainer:
-# Fill the following fields and choose the options that are in use by this package
-# Populate the install, uninstall and upgrade functions
-# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't always possible
-# This system supports both interactive and non-interactive installs. For non-interactive installs, $interaction="false". In this cause special instructions to the user should be given as user_message, such as `After installation, edit /opt/software/config.ini`
-# Successful operations should `exit 0`, fails should `exit 1`
-# Messages to the user (such as configuration instructions, explanatory error messages, etc) should be given as: `echo "user_message: text"`
-# Everything following `user_message: ` will be displayed prominently to the user, so it must the last thing echoed
-
-user_message="To connect to network share, enter \`\\\\femtofox\\home\` in Windows, \`smb://$(hostname)/home\` in MacOS or \`smbclient //$(hostname)/femto -U femto\` in Linux. Default configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares.\n\nTroubleshooting: if Windows refuses to connect after succeeding previously, hit [win]+R and enter \`net use * /delete\`."
-init_instructions="To enable file sharing, run \`Initialize\` in the femto-config Samba menu to set a Samba password."
-
-name="Samba File Sharing" # software name
-author="Software Freedom Conservancy" # software author - OPTIONAL
-description="Femtofox comes with Samba preinstalled but disabled. $init_instructions\n\n$user_message" # software description - OPTIONAL (but strongly recommended!)
-URL="https://www.samba.org/" # software URL. Can contain multiple URLs - OPTIONAL
-options="xiuagedsrNADUOSEGTPCI" # script options in use by software package. For example, for a package with no service, exclude `edsr`
-launch="" # command to launch software, if applicable
-service_name="smbd nmbd" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2"
-location="" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name`
-license="/usr/share/doc/samba/copyright" # file to cat to display license
-license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string
-package_name="samba" # apt package name, if applicable
-conflicts="" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI"
-
-# install script
-install() {
- echo "apt update can take a long while..."
- # DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; }
- # DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt install failed. Is internet connected?"; exit 1; }
- if [ "$interactive" = "true" ]; then # interactive install
- interactive_init
- else # noninteractive installation (such as web-UI)
- echo -e "user_message: IMPORTANT: $init_instructions\n\n$user_message"
- exit 0 # should be `exit 1` if operation failed
- fi
-}
-
-# uninstall script
-uninstall() {
- DEBIAN_FRONTEND=noninteractive apt remove -y $package_name 2>&1 | tee /dev/tty
- echo "user_message: Some files may remain on system. To remove, run \`sudo apt remove --purge $package_name -y\` and \`sudo apt autoremove -y\`."
- exit 0 # should be `exit 1` if operation failed
-}
-
-# code that must be run to initialize the installation prior to use, but can only be run from terminal
-interactive_init() {
- echo -e "\nSet user \`Femto\` login password:"
- smbpasswd -a femto
- /usr/local/bin/packages/samba.sh -e
- /usr/local/bin/packages/samba.sh -r
- echo -e "user_message: Samba initialized, and service enabled and started. $user_message"
- exit 0
-}
-
-# upgrade script
-upgrade() {
- echo "apt update can take a long while..."
- DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; }
- DEBIAN_FRONTEND=noninteractive apt upgrade -y $package_name 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt upgrade failed. Is internet connected?"; exit 1; }
- exit 0 # should be `exit 1` if operation failed
-}
-
-# Check if already installed. `exit 0` if yes, `exit 1` if no
-check() {
-if dpkg-query -W -f='${Status}' $package_name 2>/dev/null | grep -q "install ok installed"; then
- exit 0
-else
- exit 1
-fi
-}
-
-# display license
-license() {
- echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")"
-}
-
-# parse arguments
-source /usr/local/bin/packages/femto_argument_parse.sh "$@"
-
-exit 0
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh
index e36a8ea..66af6c2 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh
@@ -1,26 +1,63 @@
#!/bin/bash
+if [[ $EUID -ne 0 ]]; then
+ echo "This script must be run as root. Try \`sudo\`."
+ exit 1
+fi
+if [ $# -eq 0 ]; then
+ echo "No arguments provided."
+ echo -e "$help"
+ exit 1
+fi
+
+args="$@" # arguments to this script
+interactive="true"
+help=$(cat </dev/null; then # if service is enabled
- systemctl restart ttyd
- fi
-}
-
-# custom getopts for ttyd: generate key
-if [[ "$1" == "-k" ]]; then
- generate_keys
-fi
-
-# parse arguments
-source /usr/local/bin/packages/femto_argument_parse.sh "$@"
-
-# extra help for this package
-if [[ "$1" == "-h" ]]; then
- echo -e "Additional argument for this package:\n\
--k Generate SSL keys. Must be first argument."
-fi
-
-exit 0
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-wifi-mesh-control.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/wifi-mesh-control.sh
similarity index 93%
rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-wifi-mesh-control.sh
rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/wifi-mesh-control.sh
index 6cfa7ba..9192e03 100755
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-wifi-mesh-control.sh
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/wifi-mesh-control.sh
@@ -17,13 +17,11 @@ get_mobile_wifi_state() {
set_mobile_wifi_state() {
local state="$1"
local meshtastic_output
-
if [[ "$state" == "up" ]]; then
- meshtastic_output=$(meshtastic --host 127.0.0.1 --set network.wifi_enabled true 2>&1 || true)
+ meshtastic_output=$(meshtastic --host 127.0.0.1 --set network.wifi_enabled true 2>&1)
else
- meshtastic_output=$(meshtastic --host 127.0.0.1 --set network.wifi_enabled false 2>&1 || true)
+ meshtastic_output=$(meshtastic --host 127.0.0.1 --set network.wifi_enabled false 2>&1)
fi
-
log "Set Meshtastic Wi-Fi state to $state. Output: $meshtastic_output"
}
@@ -69,8 +67,8 @@ monitor_changes() {
while true; do
PID=$(ps -C meshtasticd -o pid= | tr -d ' ')
- #if [[ -n "$PID" ]] && sudo lsof /dev/spidev0.0 | grep -q "$PID" && [[ -d /sys/class/net/wlan0 ]]; then
- if [[ -n "$PID" ]] && sudo lsof /dev/spidev0.0 | grep -q "$PID" && [[ -d /sys/class/net/wlan0 ]] && systemctl is-active --quiet meshtasticd; then
+ #if [[ -n "$PID" ]] && sudo lsof /dev/spidev0.0 | grep -q "$PID"; then
+ if [[ -n "$PID" ]] && sudo lsof /dev/spidev0.0 | grep -q "$PID" && [[ -d /sys/class/net/wlan0 ]]; then
local current_mobile_state current_wlan_state
current_mobile_state=$(get_mobile_wifi_state)
current_wlan_state=$(cat /sys/class/net/wlan0/operstate)
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/femtofox/long_license b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/femtofox/long_license
index 995f98e..c2d211f 100644
--- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/femtofox/long_license
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/femtofox/long_license
@@ -1,17 +1,3 @@
-Femtofox is comprised of two projects, with two different licenses:
-1. Femtofox - the hardware, which is licensed "CC BY-NC-ND - noncommercial". Summary: you may copy and share and modify the hardware files, but cannot sell them without license from Femtofox, and must give attribution to Femtofox.
-2. Foxbuntu - refers to the modifications to Ubuntu made as part of the Femtofox project, which is licensed GNU GPLv3. Summary: you may use, modify and distribute (including for commercial purposes) Foxbuntu, but must give attribution to Femtofox and distribute this license with your project. Any modified version must remain open source.
-
-See below for the full license texts.
-
- Hardware (Femtofox) license:
-Summary:
-Attribution — You must give appropriate credit , provide a link to the license, and indicate if changes were made . You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
-NonCommercial — You may not use the material for commercial purposes .
-NoDerivatives — If you remix, transform, or build upon the material, you may not distribute the modified material.
-
-Contact us to license Femtofox.
-
The license:
Attribution-NonCommercial-NoDerivatives 4.0 International
@@ -414,682 +400,4 @@ understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.
-Creative Commons may be contacted at creativecommons.org.
-
-
-
- Software (Foxbuntu) license:
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- 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
-them 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.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. 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.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey 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;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If 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 convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU 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 that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- 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.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-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.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- 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.
-
- 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
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- 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 3 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, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program 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, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
\ No newline at end of file
+Creative Commons may be contacted at creativecommons.org.
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_Black.svg b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_Black.svg
new file mode 100644
index 0000000..e0f9bb1
--- /dev/null
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_Black.svg
@@ -0,0 +1,12 @@
+
+
+
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_White.svg b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_White.svg
new file mode 100644
index 0000000..b1bcd57
--- /dev/null
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_White.svg
@@ -0,0 +1,12 @@
+
+
+
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/apple-touch-icon.png b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/apple-touch-icon.png
new file mode 100644
index 0000000..31e2210
Binary files /dev/null and b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/apple-touch-icon.png differ
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/favicon.ico b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/favicon.ico
new file mode 100644
index 0000000..2a1cdfc
Binary files /dev/null and b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/favicon.ico differ
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/icon.svg b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/icon.svg
new file mode 100644
index 0000000..e6863f6
--- /dev/null
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/icon.svg
@@ -0,0 +1,16 @@
+
+
+
\ No newline at end of file
diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-b9vwykds.js b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-b9vwykds.js
new file mode 100644
index 0000000..4925735
--- /dev/null
+++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-b9vwykds.js
@@ -0,0 +1,441 @@
+function lE(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();var _t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var D1={exports:{}},Tu={},L1={exports:{}},Me={};/**
+ * @license React
+ * react.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var Zs=Symbol.for("react.element"),cE=Symbol.for("react.portal"),uE=Symbol.for("react.fragment"),dE=Symbol.for("react.strict_mode"),fE=Symbol.for("react.profiler"),pE=Symbol.for("react.provider"),mE=Symbol.for("react.context"),hE=Symbol.for("react.forward_ref"),gE=Symbol.for("react.suspense"),vE=Symbol.for("react.memo"),yE=Symbol.for("react.lazy"),Ng=Symbol.iterator;function bE(e){return e===null||typeof e!="object"?null:(e=Ng&&e[Ng]||e["@@iterator"],typeof e=="function"?e:null)}var j1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},F1=Object.assign,B1={};function Mi(e,t,n){this.props=e,this.context=t,this.refs=B1,this.updater=n||j1}Mi.prototype.isReactComponent={};Mi.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Mi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function $1(){}$1.prototype=Mi.prototype;function Mp(e,t,n){this.props=e,this.context=t,this.refs=B1,this.updater=n||j1}var Ap=Mp.prototype=new $1;Ap.constructor=Mp;F1(Ap,Mi.prototype);Ap.isPureReactComponent=!0;var Pg=Array.isArray,U1=Object.prototype.hasOwnProperty,Rp={current:null},V1={key:!0,ref:!0,__self:!0,__source:!0};function z1(e,t,n){var r,o={},a=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(a=""+t.key),t)U1.call(t,r)&&!V1.hasOwnProperty(r)&&(o[r]=t[r]);var s=arguments.length-2;if(s===1)o.children=n;else if(1{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Eu(e){const t=e[De];return t?t.type_:Array.isArray(e)?1:Nu(e)?2:Pu(e)?3:0}function Uf(e,t){return Eu(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function X1(e,t,n){const r=Eu(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function AE(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Nu(e){return e instanceof Map}function Pu(e){return e instanceof Set}function ht(e){return e.copy_||e.base_}function Vf(e,t){if(Nu(e))return new Map(e);if(Pu(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=q1(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[De];let o=Reflect.ownKeys(r);for(let a=0;a1&&(e.set=e.add=e.clear=e.delete=RE),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Op(r,!0))),e}function RE(){vn(2)}function Mu(e){return Object.isFrozen(e)}var zf={};function qo(e){const t=zf[e];return t||vn(0,e),t}function IE(e,t){zf[e]||(zf[e]=t)}var ks;function Rc(){return ks}function OE(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Rg(e,t){t&&(qo("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Hf(e){Wf(e),e.drafts_.forEach(DE),e.drafts_=null}function Wf(e){e===ks&&(ks=e.parent_)}function Ig(e){return ks=OE(ks,e)}function DE(e){const t=e[De];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Og(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[De].modified_&&(Hf(t),vn(4)),_r(e)&&(e=Ic(t,e),t.parent_||Oc(t,e)),t.patches_&&qo("Patches").generateReplacementPatches_(n[De].base_,e,t.patches_,t.inversePatches_)):e=Ic(t,n,[]),Hf(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==K1?e:void 0}function Ic(e,t,n){if(Mu(t))return t;const r=t[De];if(!r)return xs(t,(o,a)=>Dg(e,r,t,o,a,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Oc(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const o=r.copy_;let a=o,i=!1;r.type_===3&&(a=new Set(o),o.clear(),i=!0),xs(a,(s,l)=>Dg(e,r,o,s,l,n,i)),Oc(e,o,!1),n&&e.patches_&&qo("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Dg(e,t,n,r,o,a,i){if(gi(o)){const s=a&&t&&t.type_!==3&&!Uf(t.assigned_,r)?a.concat(r):void 0,l=Ic(e,o,s);if(X1(n,r,l),gi(l))e.canAutoFreeze_=!1;else return}else i&&n.add(o);if(_r(o)&&!Mu(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ic(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Oc(e,o)}}function Oc(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Op(t,n)}function LE(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Rc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,a=Dp;n&&(o=[r],a=Cs);const{revoke:i,proxy:s}=Proxy.revocable(o,a);return r.draft_=s,r.revoke_=i,s}var Dp={get(e,t){if(t===De)return e;const n=ht(e);if(!Uf(n,t))return jE(e,n,t);const r=n[t];return e.finalized_||!_r(r)?r:r===Md(e.base_,t)?(Ad(e),e.copy_[t]=Ss(r,e)):r},has(e,t){return t in ht(e)},ownKeys(e){return Reflect.ownKeys(ht(e))},set(e,t,n){const r=Y1(ht(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=Md(ht(e),t),a=o?.[De];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(AE(n,o)&&(n!==void 0||Uf(e.base_,t)))return!0;Ad(e),mr(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Md(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ad(e),mr(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ht(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){vn(11)},getPrototypeOf(e){return hi(e.base_)},setPrototypeOf(){vn(12)}},Cs={};xs(Dp,(e,t)=>{Cs[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Cs.deleteProperty=function(e,t){return Cs.set.call(this,e,t,void 0)};Cs.set=function(e,t,n){return Dp.set.call(this,e[0],t,n,e[0])};function Md(e,t){const n=e[De];return(n?ht(n):e)[t]}function jE(e,t,n){const r=Y1(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}function Y1(e,t){if(!(t in e))return;let n=hi(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=hi(n)}}function mr(e){e.modified_||(e.modified_=!0,e.parent_&&mr(e.parent_))}function Ad(e){e.copy_||(e.copy_=Vf(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var FE=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const a=n;n=t;const i=this;return function(l=a,...c){return i.produce(l,u=>n.call(this,u,...c))}}typeof n!="function"&&vn(6),r!==void 0&&typeof r!="function"&&vn(7);let o;if(_r(t)){const a=Ig(this),i=Ss(t,void 0);let s=!0;try{o=n(i),s=!1}finally{s?Hf(a):Wf(a)}return Rg(a,r),Og(o,a)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===K1&&(o=void 0),this.autoFreeze_&&Op(o,!0),r){const a=[],i=[];qo("Patches").generateReplacementPatches_(t,o,a,i),r(a,i)}return o}else vn(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(i,...s)=>this.produceWithPatches(i,l=>t(l,...s));let r,o;return[this.produce(t,n,(i,s)=>{r=i,o=s}),r,o]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){_r(e)||vn(8),gi(e)&&(e=BE(e));const t=Ig(this),n=Ss(e,void 0);return n[De].isManual_=!0,Wf(t),n}finishDraft(e,t){const n=e&&e[De];(!n||!n.isManual_)&&vn(9);const{scope_:r}=n;return Rg(r,t),Og(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=qo("Patches").applyPatches_;return gi(e)?r(e,t):this.produce(e,o=>r(o,t))}};function Ss(e,t){const n=Nu(e)?qo("MapSet").proxyMap_(e,t):Pu(e)?qo("MapSet").proxySet_(e,t):LE(e,t);return(t?t.scope_:Rc()).drafts_.push(n),n}function BE(e){return gi(e)||vn(10,e),Q1(e)}function Q1(e){if(!_r(e)||Mu(e))return e;const t=e[De];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Vf(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Vf(e,!0);return xs(n,(r,o)=>{X1(n,r,Q1(o))}),t&&(t.finalized_=!1),n}function $E(){class e extends Map{constructor(l,c){super(),this[De]={type_:2,parent_:c,scope_:c?c.scope_:Rc(),modified_:!1,finalized_:!1,copy_:void 0,assigned_:void 0,base_:l,draft_:this,isManual_:!1,revoked_:!1}}get size(){return ht(this[De]).size}has(l){return ht(this[De]).has(l)}set(l,c){const u=this[De];return i(u),(!ht(u).has(l)||ht(u).get(l)!==c)&&(n(u),mr(u),u.assigned_.set(l,!0),u.copy_.set(l,c),u.assigned_.set(l,!0)),this}delete(l){if(!this.has(l))return!1;const c=this[De];return i(c),n(c),mr(c),c.base_.has(l)?c.assigned_.set(l,!1):c.assigned_.delete(l),c.copy_.delete(l),!0}clear(){const l=this[De];i(l),ht(l).size&&(n(l),mr(l),l.assigned_=new Map,xs(l.base_,c=>{l.assigned_.set(c,!1)}),l.copy_.clear())}forEach(l,c){const u=this[De];ht(u).forEach((d,p,g)=>{l.call(c,this.get(p),p,this)})}get(l){const c=this[De];i(c);const u=ht(c).get(l);if(c.finalized_||!_r(u)||u!==c.base_.get(l))return u;const d=Ss(u,c);return n(c),c.copy_.set(l,d),d}keys(){return ht(this[De]).keys()}values(){const l=this.keys();return{[Symbol.iterator]:()=>this.values(),next:()=>{const c=l.next();return c.done?c:{done:!1,value:this.get(c.value)}}}}entries(){const l=this.keys();return{[Symbol.iterator]:()=>this.entries(),next:()=>{const c=l.next();if(c.done)return c;const u=this.get(c.value);return{done:!1,value:[c.value,u]}}}}[Symbol.iterator](){return this.entries()}}function t(s,l){return new e(s,l)}function n(s){s.copy_||(s.assigned_=new Map,s.copy_=new Map(s.base_))}class r extends Set{constructor(l,c){super(),this[De]={type_:3,parent_:c,scope_:c?c.scope_:Rc(),modified_:!1,finalized_:!1,copy_:void 0,base_:l,draft_:this,drafts_:new Map,revoked_:!1,isManual_:!1}}get size(){return ht(this[De]).size}has(l){const c=this[De];return i(c),c.copy_?!!(c.copy_.has(l)||c.drafts_.has(l)&&c.copy_.has(c.drafts_.get(l))):c.base_.has(l)}add(l){const c=this[De];return i(c),this.has(l)||(a(c),mr(c),c.copy_.add(l)),this}delete(l){if(!this.has(l))return!1;const c=this[De];return i(c),a(c),mr(c),c.copy_.delete(l)||(c.drafts_.has(l)?c.copy_.delete(c.drafts_.get(l)):!1)}clear(){const l=this[De];i(l),ht(l).size&&(a(l),mr(l),l.copy_.clear())}values(){const l=this[De];return i(l),a(l),l.copy_.values()}entries(){const l=this[De];return i(l),a(l),l.copy_.entries()}keys(){return this.values()}[Symbol.iterator](){return this.values()}forEach(l,c){const u=this.values();let d=u.next();for(;!d.done;)l.call(c,d.value,d.value,this),d=u.next()}}function o(s,l){return new r(s,l)}function a(s){s.copy_||(s.copy_=new Set,s.base_.forEach(l=>{if(_r(l)){const c=Ss(l,s);s.drafts_.set(l,c),s.copy_.add(c)}else s.copy_.add(l)}))}function i(s){s.revoked_&&vn(3,JSON.stringify(ht(s)))}IE("MapSet",{proxyMap_:t,proxySet_:o})}var tn=new FE,Ie=tn.produce;tn.produceWithPatches.bind(tn);tn.setAutoFreeze.bind(tn);tn.setUseStrictShallowCopy.bind(tn);tn.applyPatches.bind(tn);tn.createDraft.bind(tn);tn.finishDraft.bind(tn);var Z1={exports:{}},rn={},J1={exports:{}},eb={};/**
+ * @license React
+ * scheduler.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */(function(e){function t(K,Z){var re=K.length;K.push(Z);e:for(;0>>1,U=K[fe];if(0>>1;feo(S,re))Xo(H,S)?(K[fe]=H,K[X]=re,fe=X):(K[fe]=S,K[se]=re,fe=se);else if(Xo(H,re))K[fe]=H,K[X]=re,fe=X;else break e}}return Z}function o(K,Z){var re=K.sortIndex-Z.sortIndex;return re!==0?re:K.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var i=Date,s=i.now();e.unstable_now=function(){return i.now()-s}}var l=[],c=[],u=1,d=null,p=3,g=!1,v=!1,h=!1,_=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(K){for(var Z=n(c);Z!==null;){if(Z.callback===null)r(c);else if(Z.startTime<=K)r(c),Z.sortIndex=Z.expirationTime,t(l,Z);else break;Z=n(c)}}function E(K){if(h=!1,x(K),!v)if(n(l)!==null)v=!0,G(w);else{var Z=n(c);Z!==null&&Y(E,Z.startTime-K)}}function w(K,Z){v=!1,h&&(h=!1,b(C),C=-1),g=!0;var re=p;try{for(x(Z),d=n(l);d!==null&&(!(d.expirationTime>Z)||K&&!R());){var fe=d.callback;if(typeof fe=="function"){d.callback=null,p=d.priorityLevel;var U=fe(d.expirationTime<=Z);Z=e.unstable_now(),typeof U=="function"?d.callback=U:d===n(l)&&r(l),x(Z)}else r(l);d=n(l)}if(d!==null)var ae=!0;else{var se=n(c);se!==null&&Y(E,se.startTime-Z),ae=!1}return ae}finally{d=null,p=re,g=!1}}var T=!1,k=null,C=-1,P=5,O=-1;function R(){return!(e.unstable_now()-O