From 96d17ccc320c54fb8984e7faf13dfa516b9718bd Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 15 Dec 2023 09:18:09 -0700 Subject: [PATCH 01/11] Added Runtime Conditions. --- lib/armbian-configng/runtime.sh | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 lib/armbian-configng/runtime.sh diff --git a/lib/armbian-configng/runtime.sh b/lib/armbian-configng/runtime.sh new file mode 100644 index 000000000..02a54f86e --- /dev/null +++ b/lib/armbian-configng/runtime.sh @@ -0,0 +1,35 @@ +# lib/armbian-configng/runtime-conditions.sh + +# File extention of the config file +config_format="conf" +# Path to the config file + +config_file="$etcpath"/"$filename"/"$filename"."$config_format" + +# Check if the config file exists +if [[ ! -f "$config_file" ]]; then + + [[ -d "$etcpath"/"$filename" ]] || mkdir -p "$etcpath"/"$filename" + # If not, create it + echo "Creating $config_file..." + touch "$config_file" + + # You can also set some default values here if needed + echo "VAR1=default_value1" >> "$config_file" + echo "VAR2=default_value2" >> "$config_file" + cat << EOF > "$config_file" +# PLEASE DO NOT EDIT THIS FILE +# This file is automatically generated by $filename +# Any changes made to this file will be overwritten the next time the script runs. +# To change the values of these variables, Setup a funtion to... + +# Default values for variables that can be read and modified by the User Interface. +# These variables can be toggled or their state can be changed as per user request. +VAR1=default_value1 +VAR2=default_value2 + + +EOF + + # And so on... +fi From 76a0b016cc3f898e8a769c0b30abb07bb16c6836 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 20 Dec 2023 12:02:08 -0700 Subject: [PATCH 02/11] legacy check. --- lib/armbian-configng/functions.sh | 22 ++++++++++++---------- src/lkars | 1 + 2 files changed, 13 insertions(+), 10 deletions(-) create mode 160000 src/lkars diff --git a/lib/armbian-configng/functions.sh b/lib/armbian-configng/functions.sh index 3d598c61b..c289c446a 100644 --- a/lib/armbian-configng/functions.sh +++ b/lib/armbian-configng/functions.sh @@ -17,29 +17,31 @@ generate_tui() { categories_array["$i"]="$category_name" description_array["$i"]="$category_description" options+=("$i" "$(printf '%-7s - %-8s' "${categories_array[$i]}" "${description_array[$i]}")") - #options+=("$i" "${categories_array[$i]} - ${description_array[$i]}") ((++i)) done - options+=("$i" "$(printf '%-7s - %-8s' "Legacy" "Run Legacy configuration")") - #options+=("$i" "Legacy - Run Legacy configuration") - ((++i)) + # Check if armbian-config is installed before adding the Legacy option + if which armbian-config > /dev/null; then + options+=("$i" "$(printf '%-7s - %-8s' "Legacy" "Run Legacy configuration")") + ((++i)) + fi + options+=("$i" "$(printf '%-7s - %-8s' "Help" "Documentation, support, sources")") - #options+=("$i" "Help - Documentation, support, sources" ) ((++i)) local choice - choice=$($dialogue --menu "Select a category:" 0 0 9 "${options[@]}" 3>&1 1>&2 2>&3) - if [[ -n $choice ]]; then - + if [[ -n $choice ]]; then if ((choice == "$i - 1")); then generate_help | armbian-interface -o exit ; elif ((choice == "$i - 2")); then - armbian-config - exit ; + # Check again before running armbian-config + if which armbian-config > /dev/null; then + armbian-config + exit ; + fi else generate_sub_tui "${categories_array[$choice]}" fi diff --git a/src/lkars b/src/lkars new file mode 160000 index 000000000..965a1cc7f --- /dev/null +++ b/src/lkars @@ -0,0 +1 @@ +Subproject commit 965a1cc7f05a06ad63c010f3e714923fd01de16a From b1e980012a69d7b7856c604a92ac1e0809f56992 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 20 Dec 2023 12:46:49 -0700 Subject: [PATCH 03/11] Remove generated files , ajusted debian.conf --- LICENSE | 339 ++++++++++++++++++ debian.conf | 1 - .../doc/armbian-configng/armbian-configng.csv | 5 - .../armbian-configng/armbian-configng.html | 98 ----- .../armbian-configng/armbian-configng.json | 34 -- share/doc/armbian-configng/armbianCPU.svg | 5 - share/doc/armbian-configng/index.html | 42 --- src/lkars | 1 - 8 files changed, 339 insertions(+), 186 deletions(-) create mode 100644 LICENSE delete mode 100755 share/doc/armbian-configng/armbian-configng.csv delete mode 100755 share/doc/armbian-configng/armbian-configng.html delete mode 100755 share/doc/armbian-configng/armbian-configng.json delete mode 100755 share/doc/armbian-configng/armbianCPU.svg delete mode 100755 share/doc/armbian-configng/index.html delete mode 160000 src/lkars diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..d159169d1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + 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 +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + 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 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This 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. diff --git a/debian.conf b/debian.conf index 465e3080c..baa31baef 100644 --- a/debian.conf +++ b/debian.conf @@ -1,3 +1,2 @@ -share:/usr/ lib:/usr/ bin:/usr/ diff --git a/share/doc/armbian-configng/armbian-configng.csv b/share/doc/armbian-configng/armbian-configng.csv deleted file mode 100755 index 717776e70..000000000 --- a/share/doc/armbian-configng/armbian-configng.csv +++ /dev/null @@ -1,5 +0,0 @@ -Function Name,Group Name,Description,Options,Category,Category Description -NMTUI,network,Network Manager.,none.,network,Network Wired wireless Bluetooth access point -Hello,system,Hello System.,none,system,System and Security -Bencharking,monitor,Armbian Monitor and Bencharking.,,system,System and Security -Install,system,Armbian installer,none.,system,System and Security diff --git a/share/doc/armbian-configng/armbian-configng.html b/share/doc/armbian-configng/armbian-configng.html deleted file mode 100755 index b80abc8df..000000000 --- a/share/doc/armbian-configng/armbian-configng.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - Armbian armbian-configng - - - -
-

armbian-configng

-
- -
-
- -
-
- - - - - - diff --git a/share/doc/armbian-configng/armbian-configng.json b/share/doc/armbian-configng/armbian-configng.json deleted file mode 100755 index eb936b4bf..000000000 --- a/share/doc/armbian-configng/armbian-configng.json +++ /dev/null @@ -1,34 +0,0 @@ -[ - { - "Function Name": "NMTUI", - "Group Name": "network", - "Description": "Network Manager.", - "Options": "none.", - "Category": "network", - "Category Description": "Network Wired wireless Bluetooth access point" - }, - { - "Function Name": "Hello", - "Group Name": "system", - "Description": "Hello System.", - "Options": "none", - "Category": "system", - "Category Description": "System and Security" - }, - { - "Function Name": "Bencharking", - "Group Name": "monitor", - "Description": "Armbian Monitor and Bencharking.", - "Options": "", - "Category": "system", - "Category Description": "System and Security" - }, - { - "Function Name": "Install", - "Group Name": "system", - "Description": "Armbian installer", - "Options": "none.", - "Category": "system", - "Category Description": "System and Security" - } -] diff --git a/share/doc/armbian-configng/armbianCPU.svg b/share/doc/armbian-configng/armbianCPU.svg deleted file mode 100755 index 4d19784d6..000000000 --- a/share/doc/armbian-configng/armbianCPU.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/share/doc/armbian-configng/index.html b/share/doc/armbian-configng/index.html deleted file mode 100755 index 0f3d2f124..000000000 --- a/share/doc/armbian-configng/index.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
Function NameGroup NameDescriptionOptionsCategoryCategory Description
NMTUInetworkNetwork Manager.none.networkNetwork Wired wireless Bluetooth access point
HellosystemHello System.nonesystemSystem and Security
BencharkingmonitorArmbian Monitor and Bencharking.systemSystem and Security
InstallsystemArmbian installernone.systemSystem and Security
- - - diff --git a/src/lkars b/src/lkars deleted file mode 160000 index 965a1cc7f..000000000 --- a/src/lkars +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 965a1cc7f05a06ad63c010f3e714923fd01de16a From 1c466705187eea2c988b5dac609ad11fba712991 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 20 Dec 2023 18:39:09 -0700 Subject: [PATCH 04/11] # Exposing legacy Variables --- README.md | 58 ++++-------------- lib/armbian-configng/runtime.sh | 101 +++++++++++++++++++++++++++++++- 2 files changed, 111 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index e771a0d64..ca3acb76d 100755 --- a/README.md +++ b/README.md @@ -9,6 +9,18 @@ # User guide ## Quick start + +### Git dev +~~~ +sudo apt install git +cd ~/ +git clone https://github.com/armbian/configng.git +cd configng +./bin/armbian-configng --dev +~~~ + +### Up Comming Apt. +~~~ Run the following commands: echo "deb [signed-by=/usr/share/keyrings/armbian.gpg] https://armbian.github.io/configng stable main" \ @@ -35,49 +47,3 @@ function group::string() {s return 0 } ~~~ -## Codestyle can be used to auto generate - - [Markdown](share/armbian-configng/readme.md) - - [JSON](share/armbian-configng/data/armbian-configng.json) - - [CSV](share/armbian-configng/data/armbian-configng.csv) - - [HTML](share/armbian-configng/armbian-configng-table.html) - - [github.io](//tearran/github.io/armbian-configng/index.html) -## Functions list as of 2023-12-06 -## network -System and Security - -### set_wifi.sh - - - **Group Name:** network - - **Action Name:** NMTUI - - **Options:** none. - - **Description:** Network Manager. - -## system -Network Wired wireless Bluetooth access point - -### armbian_install.sh - - - **Group Name:** system - - **Action Name:** Install - - **Options:** none - - **Description:** Armbian installer. - -### hello_world.sh - - - **Group Name:** system - - **Action Name:** Hello - - **Options:** none - - **Description:** Hello System. - -### see_monitor.sh - - - **Group Name:** monitor - - **Action Name:** Bencharking - - **Options:** - - **Description:** Armbian Monitor and Bencharking. - - -# Inclueded projects -- [Bash Utility](https://labbots.github.io/bash-utility) -- [Armbian config](https://github.com/armbian/config.git) - diff --git a/lib/armbian-configng/runtime.sh b/lib/armbian-configng/runtime.sh index 02a54f86e..5cdf76250 100644 --- a/lib/armbian-configng/runtime.sh +++ b/lib/armbian-configng/runtime.sh @@ -1,3 +1,5 @@ +# Exposing legacy Variables + # lib/armbian-configng/runtime-conditions.sh # File extention of the config file @@ -15,8 +17,103 @@ if [[ ! -f "$config_file" ]]; then touch "$config_file" # You can also set some default values here if needed - echo "VAR1=default_value1" >> "$config_file" - echo "VAR2=default_value2" >> "$config_file" + cat EOF >> "$config_file" +SUBSYSTEM=="tty", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="15c1", SYMLINK+="ttyWWAN%E{ID_USB_INTERFACE_NUM}" +SUBSYSTEM=="net", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="15c1", NAME="lte0" +SUBSYSTEM=="tty", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1c25", SYMLINK+="ttyWWAN%E{ID_USB_INTERFACE_NUM}" +SUBSYSTEM=="net", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1c25", NAME="umts0" +SUBSYSTEM=="tty", ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="251d", SYMLINK+="ttyWWAN%E{ID_USB_INTERFACE_NUM}" +SUBSYSTEM=="tty", ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1e1d", SYMLINK+="ttyWWAN%E{.ID_PORT}" +SUBSYSTEM=="tty", ATTRS{idVendor}=="413c", ATTRS{idProduct}=="819b", SYMLINK+="ttyWWAN%E{ID_USB_INTERFACE_NUM}" +SUBSYSTEM=="tty", ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9001", SYMLINK+="ttyWWAN%E{ID_USB_INTERFACE_NUM}" +SUBSYSTEM=="net", ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9001", NAME="lte0" +dflag= +vflag= +cflag= +table="\Z2Application Protocol Port\n +HOSTNAMEFQDN=$(\ +MYSQL_PASS=$(< /dev/urandom tr -dc A-Z-a-z-0-9 | head -c16) +i=0 +j=1 +IFS=" " +skupaj=${#PACKETS[@]} +IFS=" " +HOSTNAMESHORT="$1" +SMBUSER=$(whiptail --inputbox "What is your samba username?" 8 78 $SMBUSER --title "$SECTION" 3>&1 1>&2 2>&3) +exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi +SMBPASS=$(whiptail --inputbox "What is your samba password?" 8 78 $SMBPASS --title "$SECTION" 3>&1 1>&2 2>&3) +exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi +SMBGROUP=$(whiptail --inputbox "What is your samba group?" 8 78 $SMBGROUP --title "$SECTION" 3>&1 1>&2 2>&3) +exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi +wgeturl="https://github.com/OpenMediaVault-Plugin-Developers/installScript/raw/master/install" +PREFIX="https://hndl.urbackup.org/Server/latest/" +URL="https://hndl.urbackup.org/Server/latest/"$(wget -q $PREFIX -O - | html2text -width 120 | grep deb | awk ' { print $3 }' | grep $arch) +rmem_recommended=4194304 +wmem_recommended=1048576 +rmem_actual=$(sysctl net.core.rmem_max | awk -F" " '{print $3}') +wmem_actual=$(sysctl net.core.wmem_max | awk -F" " '{print $3}') +TEMP_DIR=$(mktemp -d || exit 1) +jdkBin=$(find /opt/jdk/*/bin ... -print -quit) +jdkLib=$(find /opt/jdk/*/lib ... -print -quit) +wgeturl=$(curl -s "https://api.github.com/repos/Radarr/Radarr/releases" | grep 'linux.tar.gz' | grep 'browser_download_url' | head -1 | cut -d \" -f 4) +Description=Radarr Daemon +After=network.target +User=root +Type=simple +ExecStart=/usr/bin/mono --debug /opt/Radarr/Radarr.exe -nobrowser +WantedBy=multi-user.target +Description=Sonarr (NzbDrone) Daemon +After=network.target +User=root +Type=simple +ExecStart=/usr/bin/mono --debug /opt/NzbDrone/NzbDrone.exe -nobrowser +WantedBy=multi-user.target +PREFIX="https://www.softether-download.com/files/softether/" +URL=$(wget -q $PREFIX -O - | html2text | grep rtm | awk ' { print $(NF) }' | tail -1) +SUFIX="${URL/-tree/}" +DLURL=$PREFIX$URL"/Linux/SoftEther_VPN_Server/32bit_-_ARM_EABI/softether-vpnserver-$SUFIX-linux-arm_eabi-32bit.tar.gz" +DLURL=$PREFIX$URL"/Linux/SoftEther_VPN_Server/32bit_-_Intel_x86/softether-vpnserver-$SUFIX-linux-x86-32bit.tar.gz" +Description=VPN service +Type=oneshot +ExecStart=/usr/local/vpnserver/vpnserver start +ExecStop=/usr/local/vpnserver/vpnserver stop +RemainAfterExit=yes +WantedBy=multi-user.target +DAEMON=/usr/local/vpnserver/vpnserver +LOCK=/var/lock/vpnserver +PREFIX="https://www.softether-download.com/files/softether/" +URL=$(wget -q $PREFIX -O - | html2text | grep rtm | awk ' { print $(NF) }' | tail -1) +SUFIX="${URL/-tree/}" +SECURE_MYSQL=$(expect -c " +packets="amavisd-new spamassassin clamav clamav-daemon unzip bzip2 arj p7zip unrar-free rpm nomarch lzop \ +WWW_RECONFIG=$(expect -c " +TEMP_DIR=$(mktemp -d || exit 1) +i=0 +TTY_X=$(($(stty size | awk '{print $2}')-6)) # determine terminal width +TTY_Y=$(($(stty size | awk '{print $1}')-6)) # determine terminal height +distribution=$(lsb_release -cs) +family=$(lsb_release -is) +DEFAULT_ADAPTER=$(ip -4 route ls | grep default | tail -1 | grep -Po '(?<=dev )(\S+)') +serverIP=$(ip -4 addr show dev $DEFAULT_ADAPTER | awk '/inet/ {print $2}' | cut -d'/' -f1) +SUBNET="$1.$2.$3." +hostnamefqdn=$(hostname -f) +mysql_pass="" +BACKTITLE="Softy - Armbian post deployment scripts, https://www.armbian.com" +SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +DIALOG_CANCEL=1 +DIALOG_ESC=255 +DATE=`date +%F` +DBBACKUPNAME="mysql-"$DATE +WEBBACKUPNAME="website-"$DATE +FILEBACKUPNAME="website-"$DATE +COPY_TO=/root/temp/$DATE +COPY_FROM=/var/www/clients +USER= +PASSWORD= +HOST=localhost +REMOTE= + +EOF cat << EOF > "$config_file" # PLEASE DO NOT EDIT THIS FILE # This file is automatically generated by $filename From ca8344aae839f0cb9d715774e2e9191aa1d0e5a3 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 20 Dec 2023 19:31:14 -0700 Subject: [PATCH 05/11] modified: lib/armbian-configng/runtime.sh --- lib/armbian-configng/runtime.sh | 39 +-------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/lib/armbian-configng/runtime.sh b/lib/armbian-configng/runtime.sh index 5cdf76250..ef57b3ac6 100644 --- a/lib/armbian-configng/runtime.sh +++ b/lib/armbian-configng/runtime.sh @@ -1,23 +1,4 @@ -# Exposing legacy Variables -# lib/armbian-configng/runtime-conditions.sh - -# File extention of the config file -config_format="conf" -# Path to the config file - -config_file="$etcpath"/"$filename"/"$filename"."$config_format" - -# Check if the config file exists -if [[ ! -f "$config_file" ]]; then - - [[ -d "$etcpath"/"$filename" ]] || mkdir -p "$etcpath"/"$filename" - # If not, create it - echo "Creating $config_file..." - touch "$config_file" - - # You can also set some default values here if needed - cat EOF >> "$config_file" SUBSYSTEM=="tty", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="15c1", SYMLINK+="ttyWWAN%E{ID_USB_INTERFACE_NUM}" SUBSYSTEM=="net", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="15c1", NAME="lte0" SUBSYSTEM=="tty", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1c25", SYMLINK+="ttyWWAN%E{ID_USB_INTERFACE_NUM}" @@ -111,22 +92,4 @@ COPY_FROM=/var/www/clients USER= PASSWORD= HOST=localhost -REMOTE= - -EOF - cat << EOF > "$config_file" -# PLEASE DO NOT EDIT THIS FILE -# This file is automatically generated by $filename -# Any changes made to this file will be overwritten the next time the script runs. -# To change the values of these variables, Setup a funtion to... - -# Default values for variables that can be read and modified by the User Interface. -# These variables can be toggled or their state can be changed as per user request. -VAR1=default_value1 -VAR2=default_value2 - - -EOF - - # And so on... -fi +REMOTE= \ No newline at end of file From 992bee7f46afc660b8241bc7f74aee3e9c214dbb Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 20 Dec 2023 20:49:05 -0700 Subject: [PATCH 06/11] modified: README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ca3acb76d..403e74d19 100755 --- a/README.md +++ b/README.md @@ -26,12 +26,13 @@ Run the following commands: echo "deb [signed-by=/usr/share/keyrings/armbian.gpg] https://armbian.github.io/configng stable main" \ | sudo tee /etc/apt/sources.list.d/armbian-development.list > /dev/null - armbian-configng --dev + armbian-configng If all goes well you should see the Text-Based User Inerface (TUI) ### To see a list of all functions and their descriptions, run the following command: -~~~ + + armbian-configng -h ~~~ ## Coding Style From 0ce940ce6c0a4cfda2eaa88fe98b782625759a27 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 20 Dec 2023 22:40:02 -0700 Subject: [PATCH 07/11] Refactor installation instructions in README.md --- README.md | 67 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 403e74d19..347f5e2f3 100755 --- a/README.md +++ b/README.md @@ -10,31 +10,64 @@ # User guide ## Quick start -### Git dev -~~~ -sudo apt install git -cd ~/ -git clone https://github.com/armbian/configng.git -cd configng -./bin/armbian-configng --dev -~~~ -### Up Comming Apt. -~~~ -Run the following commands: +### Installation Options + +There are three ways to install `armbian-configng`: + +1. **Install from the GitHub repository:** + + ```bash + sudo apt install git + cd ~/ + git clone https://github.com/armbian/configng.git + cd configng + ./bin/armbian-configng --dev + ``` + + To uninstall: + ```bash + cd ~/ + rm -rf configng + ``` + +2. **Install from a .deb package:** + + ```bash + latest_release=$(curl -s https://api.github.com/repos/armbian/configng/releases/latest) + deb_url=$(echo "$latest_release" | jq -r '.assets[] | select(.name | endswith(".deb")) | .browser_download_url') + curl -LO "$deb_url" + deb_file=$(echo "$deb_url" | awk -F"/" '{print $NF}') + sudo dpkg -i "$deb_file" + sudo apt --fix-broken install + ``` + + To uninstall: + + ```bash + sudo dpkg -r armbian-configng + ``` + +3. **Comming to a Armbian repository near you:** + + ```bash echo "deb [signed-by=/usr/share/keyrings/armbian.gpg] https://armbian.github.io/configng stable main" \ | sudo tee /etc/apt/sources.list.d/armbian-development.list > /dev/null - - armbian-configng + sudo apt update + sudo apt install armbian-configng + ``` -If all goes well you should see the Text-Based User Inerface (TUI) + To uninstall: -### To see a list of all functions and their descriptions, run the following command: + ```bash + sudo apt remove armbian-configng + sudo rm /etc/apt/sources.list.d/armbian-development.list + sudo apt update + ``` +Please choose the option that best suits your needs. -armbian-configng -h -~~~ ## Coding Style follow the following coding style: ~~~ From 35b7e5f4e92adf0b350bc8ac747fe083d67a0c1e Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 21 Dec 2023 00:35:20 -0700 Subject: [PATCH 08/11] modified: README.md --- README.md | 65 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 347f5e2f3..18c6e13a4 100755 --- a/README.md +++ b/README.md @@ -7,15 +7,17 @@ CodeFactor

+ # Table of Contents +- [User guide](#user-guide) + - [Quick start](#quick-start) + - [Installation Options](#installation-options) + - [Using Options](#using-options) + # User guide ## Quick start - - ### Installation Options - -There are three ways to install `armbian-configng`: - -1. **Install from the GitHub repository:** +Our applications support two Run styles +1. **Run localy from GitHub repository:** ```bash sudo apt install git @@ -29,18 +31,19 @@ There are three ways to install `armbian-configng`: ```bash cd ~/ - rm -rf configng + # rm -rf configng ``` 2. **Install from a .deb package:** ```bash - latest_release=$(curl -s https://api.github.com/repos/armbian/configng/releases/latest) + { latest_release=$(curl -s https://api.github.com/repos/armbian/configng/releases/latest) deb_url=$(echo "$latest_release" | jq -r '.assets[] | select(.name | endswith(".deb")) | .browser_download_url') curl -LO "$deb_url" deb_file=$(echo "$deb_url" | awk -F"/" '{print $NF}') sudo dpkg -i "$deb_file" - sudo apt --fix-broken install + sudo dpkg --configure -a + sudo apt --fix-broken install } ``` To uninstall: @@ -48,8 +51,11 @@ There are three ways to install `armbian-configng`: ```bash sudo dpkg -r armbian-configng ``` - -3. **Comming to a Armbian repository near you:** + or + ```bash + sudo apt remove armbian-configng + ``` +3. **Install from the Armbian repository(Coming Soon):** ```bash echo "deb [signed-by=/usr/share/keyrings/armbian.gpg] https://armbian.github.io/configng stable main" \ @@ -61,23 +67,24 @@ There are three ways to install `armbian-configng`: To uninstall: ```bash - sudo apt remove armbian-configng - sudo rm /etc/apt/sources.list.d/armbian-development.list - sudo apt update + { sudo apt remove armbian-configng + # sudo rm /etc/apt/sources.list.d/armbian-development.list + sudo apt update } ``` -Please choose the option that best suits your needs. - -## Coding Style -follow the following coding style: -~~~ -# @description A short description of the function. -# -# @exitcode 0 If successful. -# -# @options A description if there are options. -function group::string() {s - echo "hello world" - return 0 -} -~~~ +### Using Options + +Our applications support two styles of options: + +1. **C-style commands:** The `help` command provides a message with examples of how of use. + + ```bash + ./bin/armbian-configng help + ``` + +2. **Script-style options:** These are passed as `-option` or `--option`. For example, to request help, you would use `-h` or `--help`. + + ```bash + ./bin/armbian-configng -h + ./bin/armbian-configng --help + ``` \ No newline at end of file From 4cb05448efa9909493dc874d2a39990b9d4f091a Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 21 Dec 2023 01:17:57 -0700 Subject: [PATCH 09/11] Add installation options and disclaimers --- README.md | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 18c6e13a4..f5b463429 100755 --- a/README.md +++ b/README.md @@ -12,15 +12,17 @@ - [Quick start](#quick-start) - [Installation Options](#installation-options) - [Using Options](#using-options) + - [Disclamrs](#disclaimer) + - [Refrance](#referance) # User guide ## Quick start ### Installation Options Our applications support two Run styles 1. **Run localy from GitHub repository:** - + ` sudo apt update && sudo apt install git `` ```bash - sudo apt install git + cd ~/ git clone https://github.com/armbian/configng.git cd configng @@ -35,15 +37,17 @@ Our applications support two Run styles ``` 2. **Install from a .deb package:** - + [Disclamer](#disclaimer): Not recomened ```bash - { latest_release=$(curl -s https://api.github.com/repos/armbian/configng/releases/latest) + { + latest_release=$(curl -s https://api.github.com/repos/armbian/configng/releases/latest) deb_url=$(echo "$latest_release" | jq -r '.assets[] | select(.name | endswith(".deb")) | .browser_download_url') curl -LO "$deb_url" deb_file=$(echo "$deb_url" | awk -F"/" '{print $NF}') sudo dpkg -i "$deb_file" sudo dpkg --configure -a - sudo apt --fix-broken install } + sudo apt --fix-broken install + } ``` To uninstall: @@ -87,4 +91,16 @@ Our applications support two styles of options: ```bash ./bin/armbian-configng -h ./bin/armbian-configng --help - ``` \ No newline at end of file + ``` + +## Disclaimer + +This guide includes the use of `curl` command to download files from the internet. While we strive to provide safe and reliable instructions, we cannot guarantee the safety of any files downloaded using `curl`. + +Please ensure that you trust the source of the files you are downloading. Be aware that downloading files from the internet always carries a risk, and you should only download files from trusted sources. + +Always review the scripts and commands you run in your terminal. If you don't understand what a command or script does, take the time to learn about it before running it. This can help prevent unexpected behavior or damage to your system. + +## Referance + +[curl](https://medium.com/@esotericmeans/the-truth-about-curl-and-installing-software-securely-on-linux-63cd12e7befd) \ No newline at end of file From 096a924e4a853983c5f5314d33deda0028a64fd2 Mon Sep 17 00:00:00 2001 From: Joey Turner Date: Thu, 21 Dec 2023 04:07:48 -0700 Subject: [PATCH 10/11] Update README.md --- README.md | 50 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f5b463429..d5ba2ffad 100755 --- a/README.md +++ b/README.md @@ -12,15 +12,30 @@ - [Quick start](#quick-start) - [Installation Options](#installation-options) - [Using Options](#using-options) - - [Disclamrs](#disclaimer) - - [Refrance](#referance) # User guide ## Quick start ### Installation Options Our applications support two Run styles -1. **Run localy from GitHub repository:** - ` sudo apt update && sudo apt install git `` + +## Limitations +Foundation adhering to confirmed best practices in Bash scripting. + + +- functionaly may or may not work when requering administration privileges + - establsh a roll or funtions resposability +- armbian-configng does not requier adnistation access. +- administraation access + - advanced use +- non administrations access + - basic use + + + +1. **Run from GitHub repository:** + + ` sudo apt update && sudo apt install git ` + ```bash cd ~/ @@ -36,8 +51,11 @@ Our applications support two Run styles # rm -rf configng ``` -2. **Install from a .deb package:** - [Disclamer](#disclaimer): Not recomened +3. **Install from a .deb package:** + [Disclamer](#disclaimer): Not recomened + + + ```bash { latest_release=$(curl -s https://api.github.com/repos/armbian/configng/releases/latest) @@ -59,7 +77,7 @@ Our applications support two Run styles ```bash sudo apt remove armbian-configng ``` -3. **Install from the Armbian repository(Coming Soon):** +4. **Install from the Armbian repository(Coming Soon):** ```bash echo "deb [signed-by=/usr/share/keyrings/armbian.gpg] https://armbian.github.io/configng stable main" \ @@ -81,12 +99,24 @@ Our applications support two Run styles Our applications support two styles of options: 1. **C-style commands:** The `help` command provides a message with examples of how of use. +2. These option bypass user interations +3. Limitations + a. small sample size + - error handeling + b. migration of legacy + - A sugested astabliment of responsibilty + - configng does not requier super user priveges to run + - a default requierment of sudo for every option needed or ad/hoc + - armbian-configng does not requer it + - safe and best practie sugest + 1. /sbin for admin and /bin for others + 2. ```bash ./bin/armbian-configng help ``` -2. **Script-style options:** These are passed as `-option` or `--option`. For example, to request help, you would use `-h` or `--help`. +5. **Script-style options:** These are passed as `-option` or `--option`. For example, to request help, you would use `-h` or `--help`. ```bash ./bin/armbian-configng -h @@ -100,7 +130,3 @@ This guide includes the use of `curl` command to download files from the interne Please ensure that you trust the source of the files you are downloading. Be aware that downloading files from the internet always carries a risk, and you should only download files from trusted sources. Always review the scripts and commands you run in your terminal. If you don't understand what a command or script does, take the time to learn about it before running it. This can help prevent unexpected behavior or damage to your system. - -## Referance - -[curl](https://medium.com/@esotericmeans/the-truth-about-curl-and-installing-software-securely-on-linux-63cd12e7befd) \ No newline at end of file From 8f56528b6e4fa42873066e1ec5e8b79370cf5fc7 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 23 Dec 2023 08:53:34 -0700 Subject: [PATCH 11/11] Add requirements --- bin/armbian-configng | 4 +++- lib/armbian-configng/network/set_wifi.sh | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/armbian-configng b/bin/armbian-configng index 2a6c89774..d2b137529 100755 --- a/bin/armbian-configng +++ b/bin/armbian-configng @@ -19,8 +19,10 @@ filename="${file_name%.*}" libpath=$(cd "$directory/lib/$filename/" && pwd) #sharepath=$(cd "$directory/share/${filename%-dev}/" && pwd) - +requirements=("nmtui" "armbian-config") +echo "${requirements[@]}" | grep -o "nmtui" # + # Consept Distribution Compatibility checks check_distro() { diff --git a/lib/armbian-configng/network/set_wifi.sh b/lib/armbian-configng/network/set_wifi.sh index 337a7d899..731f9bdec 100644 --- a/lib/armbian-configng/network/set_wifi.sh +++ b/lib/armbian-configng/network/set_wifi.sh @@ -6,8 +6,6 @@ # License version 2. This program is licensed "as is" without any # warranty of any kind, whether express or implied. - - # @description Network Manager. # # @exitcode 0 If successful.