首次迁移
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
arch all 1
|
||||
arch noarch 1
|
||||
arch aarch64_cortex-a53 5
|
||||
arch aarch64_cortex-a53_neon-vfpv4 10
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
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.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
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:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
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
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -1,2 +1,28 @@
|
||||
# gl
|
||||
## 备用脚本
|
||||
[](https://github.com/wukongdaily/gl-inet-onescript/blob/master/LICENSE)
|
||||

|
||||

|
||||
|
||||
- 主项目 https://github.com/wukongdaily/gl-inet-onescript
|
||||
- 悟空新百科站:https://wklife.netlify.app
|
||||
|
||||
## 🚀 快速上手
|
||||
|
||||
### 1. SSH连接到路由器,或者在路由器终端执行如下命令
|
||||
#### mt3000/2500/6000
|
||||
```bash
|
||||
sh -c "$(curl -fsSL https://mt3000.netlify.app/gl-inet.sh)"
|
||||
|
||||
```
|
||||
|
||||
#### mt3000/2500/6000 op24-4.8.2 以上
|
||||
```bash
|
||||
sh -c "$(curl -fsSL https://mt3000.netlify.app/gl-inet-op24.sh)"
|
||||
|
||||
```
|
||||
|
||||
#### be3600
|
||||
```bash
|
||||
sh -c "$(curl -fsSL https://mt3000.netlify.app/be3600.sh)"
|
||||
|
||||
```
|
||||
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
# GL-iNet 系列路由器 一键iStoreOS风格化脚本
|
||||
[](https://github.com/wukongdaily/gl-inet-onescript/blob/master/LICENSE)
|
||||

|
||||

|
||||
|
||||
|
||||
|
||||
## 🤔 这是什么?
|
||||
|
||||
该项目可以让MT2500/MT3000/MT6000路由器在不刷机情况下,一键变成iStoreOS风格。<br><br>
|
||||
<img alt="Static Badge" src="https://img.shields.io/badge/MT6000-0?style=flat-square&logoColor=8A2BE2&label=%E5%9E%8B%E5%8F%B7&labelColor=000000&color=336666">
|
||||
<img alt="Static Badge" src="https://img.shields.io/badge/MT2500A-0?style=flat-square&logoColor=8A2BE2&label=%E5%9E%8B%E5%8F%B7&labelColor=000000&color=D94600">
|
||||
<img alt="Static Badge" src="https://img.shields.io/badge/MT3000-0?style=flat-square&logoColor=8A2BE2&label=%E5%9E%8B%E5%8F%B7&labelColor=000000&color=2828FF">
|
||||
## 💡 特色功能
|
||||
|
||||
- 💻 支持`一键安装iStoreOS风格`
|
||||
- 💻 支持`一键安装紫色的Argon主题`
|
||||
- 💻 支持`一键安装文件管理器`
|
||||
- 🔑 支持`一键设置MT-3000风扇开始工作的温度`
|
||||
- 🌏 支持`一键部署Docker运行环境`
|
||||
- 🌏 支持`一键安装docker-compose`
|
||||
- 🐋 支持`一键安装GL原厂adguardhome`
|
||||
- 📕 支持`一键恢复原厂的OPKG软件源`
|
||||
- 🔑 支持`MT-3000 一键更换分区到U盘`
|
||||
- 💡 使用条件:GL-iNet 原厂固件(非测试版、预览版)
|
||||
- GL-inet MT-6000✅
|
||||
- GL-inet MT-3000 ✅
|
||||
- GL-inet MT-2500 ✅ 固件版本4.5.0(最好降级到此版本)
|
||||
- OrangePi Zero3(官方Openwrt镜像)
|
||||
|
||||
|
||||
## 🚀 快速上手
|
||||
|
||||
### 1. SSH连接到路由器,或者在路由器终端执行如下命令
|
||||
|
||||
#### mt3000/2500/6000
|
||||
```bash
|
||||
sh -c "$(curl -fsSL https://mt3000.netlify.app/gl-inet.sh)"
|
||||
|
||||
```
|
||||
|
||||
#### mt3000/2500/6000 op24-4.8.2 以上
|
||||
```bash
|
||||
sh -c "$(curl -fsSL https://mt3000.netlify.app/gl-inet-op24.sh)"
|
||||
|
||||
```
|
||||
### 下次如何调用? 输入快捷键 g 即可
|
||||
```bash
|
||||
g
|
||||
```
|
||||
|
||||
### 2.单独安装Docker
|
||||
```bash
|
||||
wget -O do_docker.sh https://cafe.cpolar.top/wkdaily/gl-inet-onescript/raw/branch/master/docker/do_docker.sh && chmod +x do_docker.sh && ./do_docker.sh
|
||||
```
|
||||
|
||||
|
||||
### 3.单独安装iStore商店
|
||||
```bash
|
||||
wget -O /tmp/reinstall_istore.sh https://gitee.com/wukongdaily/gl_onescript/raw/master/reinstall_istore.sh && chmod +x /tmp/reinstall_istore.sh && /tmp/reinstall_istore.sh
|
||||
|
||||
```
|
||||
|
||||
### 4.单独安装文件管理器
|
||||
```bash
|
||||
wget -O /tmp/reinstall_istore.sh https://gitee.com/wukongdaily/gl_onescript/raw/master/reinstall_istore.sh && chmod +x /tmp/reinstall_istore.sh && /tmp/reinstall_istore.sh
|
||||
/tmp/is-opkg install app-meta-linkease
|
||||
|
||||
```
|
||||
|
||||
|
||||
### 5.新手ssh连接注意事项
|
||||
https://github.com/wukongdaily/HowToUseSSH
|
||||
### 6.使用独立版docker-compose
|
||||
```bash
|
||||
docker-compose version
|
||||
```
|
||||
```bash
|
||||
# 注意上述代码中使用的是独立版docker-compose,并非标准安装的docker compose
|
||||
# 区别就是中间没有空格是一个独立的可执行文件。当然这个叫做docker-compose的可执行文件,
|
||||
# 你可以任意命名,不过就是习惯这样写,还有的人重命名为docker_compose之类的都可以。
|
||||
```
|
||||
|
||||
### 辅助视频教程⬇️
|
||||
https://www.bilibili.com/video/BV1YJ4m1L7A3/
|
||||
# Docker面板的选择
|
||||
## 🔑 安装1panel 面板 来管理Docker 容器
|
||||
|
||||
### 可以使用 docker离线包加载
|
||||
```bash
|
||||
国内地址 https://pan.baidu.com/s/1Zh913sP6rZWXmhC_rKjWQA?pwd=1111
|
||||
|
||||
备选地址 https://drive.google.com/drive/folders/15HL-lHxW9J74Fwwebrg0lMjRsenScWnO
|
||||
```
|
||||
### 上传到U盘其他空间(这里注意是/mnt/upan_data)
|
||||
```bash
|
||||
docker load < /mnt/upan_data/1panel-arm64.tar.gz
|
||||
```
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
--name 1panel \
|
||||
--restart always \
|
||||
--network host \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v /www/data/1panel-data:/mnt/data_sda2/1panel_data \
|
||||
-e TZ=Asia/Shanghai \
|
||||
moelin/1panel:latest
|
||||
```
|
||||
`其中 /mnt/data_sda2/ 可以换成自己实际的路径,最好是空间大点的`
|
||||
- 默认端口:10086
|
||||
- 默认账户:1panel
|
||||
- 默认密码:1panel_password
|
||||
- 默认入口:entrance
|
||||
|
||||
## 访问地址
|
||||
```bash
|
||||
http://192.168.8.1:10086/entrance
|
||||
```
|
||||
|
||||
## 🔑 安装Fast OS面板 来管理Docker 容器
|
||||
```bash
|
||||
docker run -d \
|
||||
--name fastos \
|
||||
--restart always \
|
||||
-p 8081:8081 \
|
||||
-p 8082:8082 \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v /etc/docker/:/etc/docker/ \
|
||||
-v /root/data:/fast/data \
|
||||
-e FAST_STORE=http://dockernb.com:8300 \
|
||||
wangbinxingkong/fast:latest
|
||||
```
|
||||
### Fast OS 面板离线包
|
||||
```bash
|
||||
https://pan.baidu.com/s/1S5jxahCzE-HyIa-mUvOcZQ?pwd=1111
|
||||
```
|
||||
|
||||
## 🗂️ 引用项目
|
||||
|
||||
本项目的开发参照了以下项目,感谢这些开源项目的作者:
|
||||
### istore
|
||||
https://github.com/linkease/istore
|
||||
|
||||

|
||||
|
||||
# 其他docker举例 盒子助手docker版
|
||||
```bash
|
||||
docker run -d \
|
||||
--restart unless-stopped \
|
||||
--name tvhelper \
|
||||
-p 2299:22 \
|
||||
-p 2288:80 \
|
||||
-v "/mnt/upan_data/tvhelper_data:/tvhelper/shells/data" \
|
||||
-e PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/android-sdk/platform-tools \
|
||||
wukongdaily/box:latest
|
||||
```
|
||||
# 常见问题
|
||||
- 1、如果你发现运行容器后,访问docker容器的web界面之后,路由器的指示灯发生闪烁,不用慌,其实没有断网。
|
||||
wan口网线拔了再插上就好了。其实不处理也无所谓的。闪烁也不代表没有网络。不准确的。
|
||||
- 2、如果你发现运行容器后,访问不了docker容器的web界面。一般重启路由器就能解决。
|
||||
- 3、请注意为了节省路由器空间,平时上传文件 最好是上传到 /mnt/upan_data 这个目录下。因为这是U盘空间,比较大。
|
||||
# 💰打赏作者💰
|
||||
<img src="https://github.com/wukongdaily/tvhelper-docker/assets/143675923/1f92c5ba-1b6b-4967-a1ab-20697159badc" width="30%" />
|
||||
|
||||
@@ -0,0 +1,487 @@
|
||||
#!/bin/sh
|
||||
# 定义颜色输出函数
|
||||
red() { echo -e "\033[31m\033[01m$1\033[0m"; }
|
||||
green() { echo -e "\033[32m\033[01m$1\033[0m"; }
|
||||
yellow() { echo -e "\033[33m\033[01m$1\033[0m"; }
|
||||
blue() { echo -e "\033[34m\033[01m$1\033[0m"; }
|
||||
light_magenta() { echo -e "\033[95m\033[01m$1\033[0m"; }
|
||||
light_yellow() { echo -e "\033[93m\033[01m$1\033[0m"; }
|
||||
cyan() { echo -e "\033[38;2;0;255;255m$1\033[0m"; }
|
||||
third_party_source="https://istore.linkease.com/repo/all/nas_luci"
|
||||
HTTP_HOST="https://mt3000.netlify.app"
|
||||
setup_base_init() {
|
||||
#添加出处信息
|
||||
add_author_info
|
||||
#添加安卓时间服务器
|
||||
add_dhcp_domain
|
||||
##设置时区
|
||||
uci set system.@system[0].zonename='Asia/Shanghai'
|
||||
uci set system.@system[0].timezone='CST-8'
|
||||
uci commit system
|
||||
/etc/init.d/system reload
|
||||
green "安装完毕!请使用8080端口访问luci界面:http://192.168.8.1:8080"
|
||||
green "作者更多动态务必收藏:https://tvhelper.cpolar.cn/"
|
||||
}
|
||||
|
||||
## 安装应用商店和主题
|
||||
install_istore_os_style() {
|
||||
##设置Argon 紫色主题
|
||||
do_install_argon_skin
|
||||
#增加终端
|
||||
opkg install luci-i18n-ttyd-zh-cn
|
||||
#默认安装必备工具SFTP 方便下载文件 比如finalshell等工具可以直接浏览路由器文件
|
||||
opkg install openssh-sftp-server
|
||||
#默认使用体积很小的文件传输:系统——文件传输
|
||||
do_install_filetransfer
|
||||
FILE_PATH="/etc/openwrt_release"
|
||||
NEW_DESCRIPTION="Openwrt like iStoreOS Style by wukongdaily"
|
||||
CONTENT=$(cat $FILE_PATH)
|
||||
UPDATED_CONTENT=$(echo "$CONTENT" | sed "s/DISTRIB_DESCRIPTION='[^']*'/DISTRIB_DESCRIPTION='$NEW_DESCRIPTION'/")
|
||||
echo "$UPDATED_CONTENT" >$FILE_PATH
|
||||
}
|
||||
# 安装iStore
|
||||
do_istore() {
|
||||
echo "do_istore 64bit ==================>"
|
||||
opkg update
|
||||
# 定义目标 URL 和本地目录
|
||||
URL="https://repo.istoreos.com/repo/all/store/"
|
||||
DIR="/tmp/ipk_store"
|
||||
|
||||
# 创建目录
|
||||
mkdir -p "$DIR"
|
||||
cd "$DIR" || exit 1
|
||||
|
||||
for ipk in $(wget -qO- "$URL" | grep -oE 'href="[^"]+\.ipk"' | cut -d'"' -f2); do
|
||||
echo "下载 $ipk"
|
||||
wget -q "${URL}${ipk}"
|
||||
done
|
||||
|
||||
# 安装所有下载的 .ipk 包
|
||||
opkg install ./*.ipk
|
||||
|
||||
#调整a53架构优先级
|
||||
add_arch_64bit
|
||||
|
||||
}
|
||||
|
||||
# 首页和网络向导
|
||||
do_quickstart() {
|
||||
download_lib_quickstart
|
||||
download_luci_quickstart
|
||||
opkg install /tmp/ipk_downloads/*.ipk
|
||||
green "正在更新到最新版iStoreOS首页风格 "
|
||||
TMPATH=/tmp/qstart
|
||||
mkdir -p ${TMPATH}
|
||||
app_aarch64='quickstart_0.11.7-1_aarch64_cortex-a53.ipk'
|
||||
app_ui='luci-app-quickstart_0.11.7-r1_all.ipk'
|
||||
app_lng='luci-i18n-quickstart-zh-cn_git-25.283.23675-635149e_all.ipk'
|
||||
wget $HTTP_HOST/newquickstart/$app_aarch64 -O ${TMPATH}/$app_aarch64
|
||||
wget $HTTP_HOST/newquickstart/$app_ui -O ${TMPATH}/$app_ui
|
||||
wget $HTTP_HOST/newquickstart/$app_lng -O ${TMPATH}/$app_lng
|
||||
opkg install ${TMPATH}/*.ipk
|
||||
rm -rf ${TMPATH}
|
||||
hide_ui_elements
|
||||
green "首页风格安装完毕!请使用8080端口访问luci界面:http://192.168.8.1:8080"
|
||||
green "作者更多动态务必收藏:https://tvhelper.cpolar.cn/"
|
||||
}
|
||||
|
||||
download_luci_quickstart() {
|
||||
# 目标目录
|
||||
REPO_URL="https://repo.istoreos.com/repo/all/nas_luci/"
|
||||
DOWNLOAD_DIR="/tmp/ipk_downloads"
|
||||
|
||||
# 创建下载目录
|
||||
mkdir -p "$DOWNLOAD_DIR"
|
||||
|
||||
# 获取目录索引并筛选 quickstart ipk 链接
|
||||
wget -qO- "$REPO_URL" | grep -oE 'href="[^"]*quickstart[^"]*\.ipk"' |
|
||||
sed 's/href="//;s/"//' | while read -r FILE; do
|
||||
echo "📦 正在下载: $FILE"
|
||||
wget -q -P "$DOWNLOAD_DIR" "$REPO_URL$FILE"
|
||||
done
|
||||
|
||||
echo "✅ 所有 quickstart 相关 IPK 文件已下载到: $DOWNLOAD_DIR"
|
||||
}
|
||||
|
||||
download_lib_quickstart() {
|
||||
# 目标目录
|
||||
REPO_URL="https://repo.istoreos.com/repo/aarch64_cortex-a53/nas/"
|
||||
DOWNLOAD_DIR="/tmp/ipk_downloads"
|
||||
|
||||
# 创建下载目录
|
||||
mkdir -p "$DOWNLOAD_DIR"
|
||||
|
||||
# 获取目录索引并筛选 quickstart ipk 链接
|
||||
wget -qO- "$REPO_URL" | grep -oE 'href="[^"]*quickstart[^"]*\.ipk"' |
|
||||
sed 's/href="//;s/"//' | while read -r FILE; do
|
||||
echo "📦 正在下载: $FILE"
|
||||
wget -q -P "$DOWNLOAD_DIR" "$REPO_URL$FILE"
|
||||
done
|
||||
|
||||
echo "✅ 所有 quickstart 相关 IPK 文件已下载到: $DOWNLOAD_DIR"
|
||||
}
|
||||
|
||||
# 判断系统是否为iStoreOS
|
||||
is_iStoreOS() {
|
||||
DISTRIB_ID=$(cat /etc/openwrt_release | grep "DISTRIB_ID" | cut -d "'" -f 2)
|
||||
# 检查DISTRIB_ID的值是否等于'iStoreOS'
|
||||
if [ "$DISTRIB_ID" = "iStoreOS" ]; then
|
||||
return 0 # true
|
||||
else
|
||||
return 1 # false
|
||||
fi
|
||||
}
|
||||
|
||||
## 去除opkg签名
|
||||
remove_check_signature_option() {
|
||||
local opkg_conf="/etc/opkg.conf"
|
||||
sed -i '/option check_signature/d' "$opkg_conf"
|
||||
}
|
||||
|
||||
## 添加opkg签名
|
||||
add_check_signature_option() {
|
||||
local opkg_conf="/etc/opkg.conf"
|
||||
echo "option check_signature 1" >>"$opkg_conf"
|
||||
}
|
||||
|
||||
#设置第三方软件源
|
||||
setup_software_source() {
|
||||
## 传入0和1 分别代表原始和第三方软件源
|
||||
if [ "$1" -eq 0 ]; then
|
||||
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
|
||||
##如果是iStoreOS系统,还原软件源之后,要添加签名
|
||||
if is_iStoreOS; then
|
||||
add_check_signature_option
|
||||
else
|
||||
echo
|
||||
fi
|
||||
# 还原软件源之后更新
|
||||
opkg update
|
||||
elif [ "$1" -eq 1 ]; then
|
||||
#传入1 代表设置第三方软件源 先要删掉签名
|
||||
remove_check_signature_option
|
||||
# 先删除再添加以免重复
|
||||
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
|
||||
echo "src/gz third_party_source $third_party_source" >>/etc/opkg/customfeeds.conf
|
||||
# 设置第三方源后要更新
|
||||
opkg update
|
||||
else
|
||||
echo "Invalid option. Please provide 0 or 1."
|
||||
fi
|
||||
}
|
||||
|
||||
# 添加主机名映射(解决安卓原生TV首次连不上wifi的问题)
|
||||
add_dhcp_domain() {
|
||||
local domain_name="time.android.com"
|
||||
local domain_ip="203.107.6.88"
|
||||
|
||||
# 检查是否存在相同的域名记录
|
||||
existing_records=$(uci show dhcp | grep "dhcp.@domain\[[0-9]\+\].name='$domain_name'")
|
||||
if [ -z "$existing_records" ]; then
|
||||
# 添加新的域名记录
|
||||
uci add dhcp domain
|
||||
uci set "dhcp.@domain[-1].name=$domain_name"
|
||||
uci set "dhcp.@domain[-1].ip=$domain_ip"
|
||||
uci commit dhcp
|
||||
else
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
#添加出处信息
|
||||
add_author_info() {
|
||||
uci set system.@system[0].description='wukongdaily'
|
||||
uci set system.@system[0].notes='文档说明:
|
||||
https://tvhelper.cpolar.cn/'
|
||||
uci commit system
|
||||
}
|
||||
|
||||
##获取软路由型号信息
|
||||
get_router_name() {
|
||||
model_info=$(cat /tmp/sysinfo/model)
|
||||
echo "$model_info"
|
||||
}
|
||||
|
||||
get_router_hostname() {
|
||||
hostname=$(uci get system.@system[0].hostname)
|
||||
echo "$hostname 路由器"
|
||||
}
|
||||
|
||||
# 安装体积非常小的文件传输软件 默认上传位置/tmp/upload/
|
||||
do_install_filetransfer() {
|
||||
mkdir -p /tmp/luci-app-filetransfer/
|
||||
cd /tmp/luci-app-filetransfer/
|
||||
wget --user-agent="Mozilla/5.0" -O luci-app-filetransfer_all.ipk "$HTTP_HOST/luci-app-filetransfer/luci-app-filetransfer_all.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O luci-lib-fs_1.0-14_all.ipk "$HTTP_HOST/luci-app-filetransfer/luci-lib-fs_1.0-14_all.ipk"
|
||||
opkg install *.ipk --force-depends
|
||||
}
|
||||
do_install_depends_ipk() {
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/luci-lua-runtime_all.ipk" "$HTTP_HOST/theme/luci-lua-runtime_all.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/libopenssl3.ipk" "$HTTP_HOST/theme/libopenssl3.ipk"
|
||||
opkg install "/tmp/luci-lua-runtime_all.ipk"
|
||||
opkg install "/tmp/libopenssl3.ipk"
|
||||
}
|
||||
#单独安装argon主题
|
||||
do_install_argon_skin() {
|
||||
echo "正在尝试安装argon主题......."
|
||||
#下载和安装argon的依赖
|
||||
do_install_depends_ipk
|
||||
# bug fix 由于2.3.1 最新版的luci-argon-theme 登录按钮没有中文匹配,而2.3版本字体不对。
|
||||
# 所以这里安装上一个版本2.2.9,考虑到主题皮肤并不需要长期更新,因此固定版本没问题
|
||||
opkg update
|
||||
opkg install luci-lib-ipkg
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/luci-theme-argon.ipk" "$HTTP_HOST/theme/luci-theme-argon-master_2.2.9.4_all.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/luci-app-argon-config.ipk" "$HTTP_HOST/theme/luci-app-argon-config_0.9_all.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/luci-i18n-argon-config-zh-cn.ipk" "$HTTP_HOST/theme/luci-i18n-argon-config-zh-cn.ipk"
|
||||
cd /tmp/
|
||||
opkg install luci-theme-argon.ipk luci-app-argon-config.ipk luci-i18n-argon-config-zh-cn.ipk
|
||||
# 检查上一个命令的返回值
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "argon主题 安装成功"
|
||||
# 设置主题和语言
|
||||
uci set luci.main.mediaurlbase='/luci-static/argon'
|
||||
uci set luci.main.lang='zh_cn'
|
||||
uci commit
|
||||
sed -i 's/value="<%:Login%>"/value="登录"/' /usr/lib/lua/luci/view/themes/argon/sysauth.htm
|
||||
echo "重新登录web页面后, 查看新主题 "
|
||||
else
|
||||
echo "argon主题 安装失败! 建议再执行一次!再给我一个机会!事不过三!"
|
||||
fi
|
||||
}
|
||||
|
||||
recovery() {
|
||||
echo "⚠️ 警告:此操作将恢复出厂设置,所有配置将被清除!"
|
||||
echo "⚠️ 请确保已备份必要数据。"
|
||||
read -p "是否确定执行恢复出厂设置?(yes/[no]): " confirm
|
||||
|
||||
if [ "$confirm" = "yes" ]; then
|
||||
echo "正在执行恢复出厂设置..."
|
||||
# 安静执行 firstboot,不显示其内部的提示信息
|
||||
firstboot -y >/dev/null 2>&1
|
||||
echo "操作完成,正在重启设备..."
|
||||
reboot
|
||||
else
|
||||
echo "操作已取消。"
|
||||
fi
|
||||
}
|
||||
|
||||
add_arch_64bit() {
|
||||
if ! wget -O /etc/opkg/arch.conf $HTTP_HOST/64bit/arch.conf; then
|
||||
echo "下载 arch.conf 失败,脚本终止。"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 防止误操作 隐藏首页无用的元素
|
||||
hide_ui_elements() {
|
||||
|
||||
TARGET="/www/luci-static/quickstart/style.css"
|
||||
MARKER="/* hide custom luci elements */"
|
||||
|
||||
# 如果没有追加过,就添加
|
||||
if ! grep -q "$MARKER" "$TARGET"; then
|
||||
cat <<EOF >>"$TARGET"
|
||||
|
||||
$MARKER
|
||||
/* 隐藏首页格式化按钮 */
|
||||
.value-data button {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏网络页的第 3 个 item */
|
||||
#main > div > div.network-container.align-c > div > div > div:nth-child(3) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏网络页的第 5 个 item */
|
||||
#main > div > div.network-container.align-c > div > div > div:nth-child(5) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏 feature-card.pink */
|
||||
#main > div > div.card-container > div.feature-card.pink {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
EOF
|
||||
echo "✅ 自定义元素已隐藏"
|
||||
else
|
||||
echo "⚠️ 无需重复操作"
|
||||
fi
|
||||
}
|
||||
|
||||
#自定义风扇开始工作的温度
|
||||
set_glfan_temp() {
|
||||
|
||||
is_integer() {
|
||||
if [[ $1 =~ ^[0-9]+$ ]]; then
|
||||
return 0 # 是整数
|
||||
else
|
||||
return 1 # 不是整数
|
||||
fi
|
||||
}
|
||||
echo "兼容带风扇机型的GL-iNet路由器"
|
||||
echo "请输入风扇开始工作的温度(建议40-70之间的整数):"
|
||||
read temp
|
||||
|
||||
if is_integer "$temp"; then
|
||||
uci set glfan.@globals[0].temperature="$temp"
|
||||
uci set glfan.@globals[0].warn_temperature="$temp"
|
||||
uci set glfan.@globals[0].integration=4
|
||||
uci set glfan.@globals[0].differential=20
|
||||
uci commit glfan
|
||||
/etc/init.d/gl_fan restart
|
||||
echo "设置成功!稍等片刻,请查看风扇转动情况"
|
||||
else
|
||||
echo "错误: 请输入整数."
|
||||
fi
|
||||
}
|
||||
|
||||
toggle_adguardhome() {
|
||||
status=$(uci get adguardhome.config.enabled)
|
||||
|
||||
if [ "$status" -eq 1 ]; then
|
||||
echo "Disabling AdGuardHome..."
|
||||
uci set adguardhome.config.enabled='0' >/dev/null 2>&1
|
||||
uci commit adguardhome >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome disable >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome stop >/dev/null 2>&1
|
||||
green "AdGuardHome 已关闭"
|
||||
else
|
||||
echo "Enabling AdGuardHome..."
|
||||
uci set adguardhome.config.enabled='1' >/dev/null 2>&1
|
||||
uci commit adguardhome >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome enable >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome start >/dev/null 2>&1
|
||||
green "AdGuardHome 已开启 访问 http://192.168.8.1:3000"
|
||||
fi
|
||||
}
|
||||
|
||||
# 安装[官方辅助UI]插件 by 论坛 iBelieve
|
||||
do_install_ui_helper() {
|
||||
|
||||
echo "⚠️ 请您确保当前固件版本大于 4.7.2,若低于此版本建议先升级。"
|
||||
read -p "👉 如果您已确认,请按 [回车] 继续;否则按 Ctrl+C 或输入任意内容后回车退出:" user_input
|
||||
|
||||
if [ -n "$user_input" ]; then
|
||||
echo "🚫 用户取消安装。"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local ipk_file="/tmp/glinjector_3.0.5-6_all.ipk"
|
||||
local sha_file="${ipk_file}.sha256"
|
||||
|
||||
echo "📥 正在下载 IPK 及 SHA256 校验文件..."
|
||||
wget -O "$sha_file" "$HTTP_HOST/ui/glinjector_3.0.5-6_all.ipk.sha256" || {
|
||||
echo "❌ 下载 SHA256 文件失败"
|
||||
return 1
|
||||
}
|
||||
|
||||
wget --user-agent="Mozilla/5.0" -O "$ipk_file" "$HTTP_HOST/ui/glinjector_3.0.5-6_all.ipk" || {
|
||||
echo "❌ 下载 IPK 文件失败"
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "🔐 正在进行 SHA256 校验..."
|
||||
|
||||
cd "$(dirname "$ipk_file")"
|
||||
sha256sum -c "$sha_file" || {
|
||||
echo "❌ 校验失败:文件已损坏或未完整下载"
|
||||
rm -f "$ipk_file"
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "✅ 校验通过,开始安装..."
|
||||
|
||||
opkg update
|
||||
opkg install "$ipk_file"
|
||||
}
|
||||
|
||||
#高级卸载
|
||||
advanced_uninstall(){
|
||||
echo "📥 正在下载 高级卸载插件..."
|
||||
wget -O /tmp/advanced_uninstall.run $HTTP_HOST/luci-app-uninstall.run && chmod +x /tmp/advanced_uninstall.run
|
||||
sh /tmp/advanced_uninstall.run
|
||||
}
|
||||
|
||||
while true; do
|
||||
clear
|
||||
gl_name=$(get_router_name)
|
||||
result="GL-iNet Be3600 一键iStoreOS风格化"
|
||||
echo "***********************************************************************"
|
||||
echo "* 一键安装工具箱(for gl-inet be3600) by @wukongdaily 20251118 "
|
||||
echo "**********************************************************************"
|
||||
echo "*******支持的机型列表***************************************************"
|
||||
green "*******GL-iNet BE-3600********"
|
||||
green "请确保您的固件版本在4.7.2以上"
|
||||
echo
|
||||
|
||||
light_magenta " 1. $result (64位)"
|
||||
echo
|
||||
light_magenta " 2. 安装argon紫色主题"
|
||||
echo
|
||||
light_magenta " 3. 单独安装iStore商店"
|
||||
echo
|
||||
light_magenta " 4. 隐藏首页格式化按钮"
|
||||
echo
|
||||
light_magenta " 5. 自定义风扇启动温度"
|
||||
echo
|
||||
light_magenta " 6. 启用或关闭AdGuardHome广告拦截"
|
||||
echo
|
||||
light_magenta " 7. 安装个性化UI辅助插件(by VMatrices)"
|
||||
echo
|
||||
light_magenta " 8. 安装高级卸载插件"
|
||||
echo
|
||||
light_magenta " 9. 恢复出厂设置/重置路由器"
|
||||
echo
|
||||
echo " Q. 退出本程序"
|
||||
echo
|
||||
read -p "请选择一个选项: " choice
|
||||
|
||||
case $choice in
|
||||
|
||||
1)
|
||||
#安装iStore风格
|
||||
install_istore_os_style
|
||||
#基础必备设置
|
||||
setup_base_init
|
||||
#安装iStore商店
|
||||
do_istore
|
||||
#安装首页和网络向导
|
||||
do_quickstart
|
||||
;;
|
||||
2)
|
||||
do_install_argon_skin
|
||||
;;
|
||||
3)
|
||||
do_istore
|
||||
;;
|
||||
4)
|
||||
hide_ui_elements
|
||||
;;
|
||||
5)
|
||||
set_glfan_temp
|
||||
;;
|
||||
6)
|
||||
toggle_adguardhome
|
||||
;;
|
||||
7)
|
||||
do_install_ui_helper
|
||||
;;
|
||||
8)
|
||||
advanced_uninstall
|
||||
;;
|
||||
9)
|
||||
recovery
|
||||
;;
|
||||
q | Q)
|
||||
echo "退出"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "无效选项,请重新选择。"
|
||||
;;
|
||||
esac
|
||||
|
||||
read -p "按 Enter 键继续..."
|
||||
done
|
||||
@@ -0,0 +1,491 @@
|
||||
#!/bin/sh
|
||||
# 定义颜色输出函数
|
||||
red() { echo -e "\033[31m\033[01m$1\033[0m"; }
|
||||
green() { echo -e "\033[32m\033[01m$1\033[0m"; }
|
||||
yellow() { echo -e "\033[33m\033[01m$1\033[0m"; }
|
||||
blue() { echo -e "\033[34m\033[01m$1\033[0m"; }
|
||||
light_magenta() { echo -e "\033[95m\033[01m$1\033[0m"; }
|
||||
light_yellow() { echo -e "\033[93m\033[01m$1\033[0m"; }
|
||||
cyan() { echo -e "\033[38;2;0;255;255m$1\033[0m"; }
|
||||
third_party_source="https://istore.linkease.com/repo/all/nas_luci"
|
||||
HTTP_HOST="https://mt3000.netlify.app"
|
||||
setup_base_init() {
|
||||
#添加出处信息
|
||||
add_author_info
|
||||
#添加安卓时间服务器
|
||||
add_dhcp_domain
|
||||
##设置时区
|
||||
uci set system.@system[0].zonename='Asia/Shanghai'
|
||||
uci set system.@system[0].timezone='CST-8'
|
||||
uci commit system
|
||||
/etc/init.d/system reload
|
||||
green "安装完毕!请使用8080端口访问luci界面:http://192.168.8.1:8080"
|
||||
green "作者更多动态务必收藏:https://tvhelper.cpolar.cn/"
|
||||
}
|
||||
|
||||
## 安装应用商店和主题
|
||||
install_istore_os_style() {
|
||||
##设置Argon 紫色主题
|
||||
do_install_argon_skin
|
||||
#增加终端
|
||||
opkg install luci-i18n-ttyd-zh-cn
|
||||
#默认安装必备工具SFTP 方便下载文件 比如finalshell等工具可以直接浏览路由器文件
|
||||
opkg install openssh-sftp-server
|
||||
#默认使用体积很小的文件传输:系统——文件传输
|
||||
do_install_filetransfer
|
||||
FILE_PATH="/etc/openwrt_release"
|
||||
NEW_DESCRIPTION="Openwrt like iStoreOS Style by wukongdaily"
|
||||
CONTENT=$(cat $FILE_PATH)
|
||||
UPDATED_CONTENT=$(echo "$CONTENT" | sed "s/DISTRIB_DESCRIPTION='[^']*'/DISTRIB_DESCRIPTION='$NEW_DESCRIPTION'/")
|
||||
echo "$UPDATED_CONTENT" >$FILE_PATH
|
||||
}
|
||||
# 安装iStore
|
||||
do_istore() {
|
||||
echo "do_istore 64bit ==================>"
|
||||
opkg update
|
||||
# 定义目标 URL 和本地目录
|
||||
URL="https://repo.istoreos.com/repo/all/store/"
|
||||
DIR="/tmp/ipk_store"
|
||||
|
||||
# 创建目录
|
||||
mkdir -p "$DIR"
|
||||
cd "$DIR" || exit 1
|
||||
|
||||
for ipk in $(wget -qO- "$URL" | grep -oE 'href="[^"]+\.ipk"' | cut -d'"' -f2); do
|
||||
echo "下载 $ipk"
|
||||
wget -q "${URL}${ipk}"
|
||||
done
|
||||
|
||||
# 安装所有下载的 .ipk 包
|
||||
opkg install ./*.ipk
|
||||
|
||||
#调整a53架构优先级
|
||||
add_arch_64bit
|
||||
|
||||
}
|
||||
|
||||
# 首页和网络向导
|
||||
do_quickstart() {
|
||||
download_lib_quickstart
|
||||
download_luci_quickstart
|
||||
opkg install /tmp/ipk_downloads/*.ipk
|
||||
do_install_new_quickstart
|
||||
}
|
||||
|
||||
download_luci_quickstart() {
|
||||
# 目标目录
|
||||
REPO_URL="https://repo.istoreos.com/repo/all/nas_luci/"
|
||||
DOWNLOAD_DIR="/tmp/ipk_downloads"
|
||||
|
||||
# 创建下载目录
|
||||
mkdir -p "$DOWNLOAD_DIR"
|
||||
|
||||
# 获取目录索引并筛选 quickstart ipk 链接
|
||||
wget -qO- "$REPO_URL" | grep -oE 'href="[^"]*quickstart[^"]*\.ipk"' |
|
||||
sed 's/href="//;s/"//' | while read -r FILE; do
|
||||
echo "📦 正在下载: $FILE"
|
||||
wget -q -P "$DOWNLOAD_DIR" "$REPO_URL$FILE"
|
||||
done
|
||||
|
||||
echo "✅ 所有 quickstart 相关 IPK 文件已下载到: $DOWNLOAD_DIR"
|
||||
}
|
||||
|
||||
download_lib_quickstart() {
|
||||
# 目标目录
|
||||
REPO_URL="https://repo.istoreos.com/repo/aarch64_cortex-a53/nas/"
|
||||
DOWNLOAD_DIR="/tmp/ipk_downloads"
|
||||
|
||||
# 创建下载目录
|
||||
mkdir -p "$DOWNLOAD_DIR"
|
||||
|
||||
# 获取目录索引并筛选 quickstart ipk 链接
|
||||
wget -qO- "$REPO_URL" | grep -oE 'href="[^"]*quickstart[^"]*\.ipk"' |
|
||||
sed 's/href="//;s/"//' | while read -r FILE; do
|
||||
echo "📦 正在下载: $FILE"
|
||||
wget -q -P "$DOWNLOAD_DIR" "$REPO_URL$FILE"
|
||||
done
|
||||
|
||||
echo "✅ 所有 quickstart 相关 IPK 文件已下载到: $DOWNLOAD_DIR"
|
||||
}
|
||||
|
||||
# 判断系统是否为iStoreOS
|
||||
is_iStoreOS() {
|
||||
DISTRIB_ID=$(cat /etc/openwrt_release | grep "DISTRIB_ID" | cut -d "'" -f 2)
|
||||
# 检查DISTRIB_ID的值是否等于'iStoreOS'
|
||||
if [ "$DISTRIB_ID" = "iStoreOS" ]; then
|
||||
return 0 # true
|
||||
else
|
||||
return 1 # false
|
||||
fi
|
||||
}
|
||||
|
||||
## 去除opkg签名
|
||||
remove_check_signature_option() {
|
||||
local opkg_conf="/etc/opkg.conf"
|
||||
sed -i '/option check_signature/d' "$opkg_conf"
|
||||
}
|
||||
|
||||
## 添加opkg签名
|
||||
add_check_signature_option() {
|
||||
local opkg_conf="/etc/opkg.conf"
|
||||
echo "option check_signature 1" >>"$opkg_conf"
|
||||
}
|
||||
|
||||
#设置第三方软件源
|
||||
setup_software_source() {
|
||||
## 传入0和1 分别代表原始和第三方软件源
|
||||
if [ "$1" -eq 0 ]; then
|
||||
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
|
||||
##如果是iStoreOS系统,还原软件源之后,要添加签名
|
||||
if is_iStoreOS; then
|
||||
add_check_signature_option
|
||||
else
|
||||
echo
|
||||
fi
|
||||
# 还原软件源之后更新
|
||||
opkg update
|
||||
elif [ "$1" -eq 1 ]; then
|
||||
#传入1 代表设置第三方软件源 先要删掉签名
|
||||
remove_check_signature_option
|
||||
# 先删除再添加以免重复
|
||||
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
|
||||
echo "src/gz third_party_source $third_party_source" >>/etc/opkg/customfeeds.conf
|
||||
# 设置第三方源后要更新
|
||||
opkg update
|
||||
else
|
||||
echo "Invalid option. Please provide 0 or 1."
|
||||
fi
|
||||
}
|
||||
|
||||
# 添加主机名映射(解决安卓原生TV首次连不上wifi的问题)
|
||||
add_dhcp_domain() {
|
||||
local domain_name="time.android.com"
|
||||
local domain_ip="203.107.6.88"
|
||||
|
||||
# 检查是否存在相同的域名记录
|
||||
existing_records=$(uci show dhcp | grep "dhcp.@domain\[[0-9]\+\].name='$domain_name'")
|
||||
if [ -z "$existing_records" ]; then
|
||||
# 添加新的域名记录
|
||||
uci add dhcp domain
|
||||
uci set "dhcp.@domain[-1].name=$domain_name"
|
||||
uci set "dhcp.@domain[-1].ip=$domain_ip"
|
||||
uci commit dhcp
|
||||
else
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
#添加出处信息
|
||||
add_author_info() {
|
||||
uci set system.@system[0].description='wukongdaily'
|
||||
uci set system.@system[0].notes='文档说明:
|
||||
https://tvhelper.cpolar.cn/'
|
||||
uci commit system
|
||||
}
|
||||
|
||||
##获取软路由型号信息
|
||||
get_router_name() {
|
||||
model_info=$(cat /tmp/sysinfo/model)
|
||||
echo "$model_info"
|
||||
}
|
||||
|
||||
get_router_hostname() {
|
||||
hostname=$(uci get system.@system[0].hostname)
|
||||
echo "$hostname 路由器"
|
||||
}
|
||||
|
||||
# 安装体积非常小的文件传输软件 默认上传位置/tmp/upload/
|
||||
do_install_filetransfer() {
|
||||
mkdir -p /tmp/luci-app-filetransfer/
|
||||
cd /tmp/luci-app-filetransfer/
|
||||
wget --user-agent="Mozilla/5.0" -O luci-app-filetransfer_all.ipk "$HTTP_HOST/luci-app-filetransfer/luci-app-filetransfer_all.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O luci-lib-fs_1.0-14_all.ipk "$HTTP_HOST/luci-app-filetransfer/luci-lib-fs_1.0-14_all.ipk"
|
||||
opkg install *.ipk --force-depends
|
||||
}
|
||||
do_install_depends_ipk() {
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/luci-lua-runtime_all.ipk" "$HTTP_HOST/theme/luci-lua-runtime_all.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/libopenssl3.ipk" "$HTTP_HOST/theme/libopenssl3.ipk"
|
||||
opkg install "/tmp/luci-lua-runtime_all.ipk"
|
||||
opkg install "/tmp/libopenssl3.ipk"
|
||||
}
|
||||
#单独安装argon主题
|
||||
do_install_argon_skin() {
|
||||
echo "正在尝试安装argon主题......."
|
||||
#下载和安装argon的依赖
|
||||
do_install_depends_ipk
|
||||
# bug fix 由于2.3.1 最新版的luci-argon-theme 登录按钮没有中文匹配,而2.3版本字体不对。
|
||||
# 所以这里安装上一个版本2.2.9,考虑到主题皮肤并不需要长期更新,因此固定版本没问题
|
||||
opkg update
|
||||
opkg install luci-lib-ipkg
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/luci-theme-argon.ipk" "$HTTP_HOST/theme/luci-theme-argon-master_2.2.9.4_all.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/luci-app-argon-config.ipk" "$HTTP_HOST/theme/luci-app-argon-config_0.9_all.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/luci-i18n-argon-config-zh-cn.ipk" "$HTTP_HOST/theme/luci-i18n-argon-config-zh-cn.ipk"
|
||||
cd /tmp/
|
||||
opkg install luci-theme-argon.ipk luci-app-argon-config.ipk luci-i18n-argon-config-zh-cn.ipk
|
||||
# 检查上一个命令的返回值
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "argon主题 安装成功"
|
||||
# 设置主题和语言
|
||||
uci set luci.main.mediaurlbase='/luci-static/argon'
|
||||
uci set luci.main.lang='zh_cn'
|
||||
uci commit
|
||||
sed -i 's/value="<%:Login%>"/value="登录"/' /usr/lib/lua/luci/view/themes/argon/sysauth.htm
|
||||
echo "重新登录web页面后, 查看新主题 "
|
||||
else
|
||||
echo "argon主题 安装失败! 建议再执行一次!再给我一个机会!事不过三!"
|
||||
fi
|
||||
}
|
||||
|
||||
recovery() {
|
||||
echo "⚠️ 警告:此操作将恢复出厂设置,所有配置将被清除!"
|
||||
echo "⚠️ 请确保已备份必要数据。"
|
||||
read -p "是否确定执行恢复出厂设置?(yes/[no]): " confirm
|
||||
|
||||
if [ "$confirm" = "yes" ]; then
|
||||
echo "正在执行恢复出厂设置..."
|
||||
# 安静执行 firstboot,不显示其内部的提示信息
|
||||
firstboot -y >/dev/null 2>&1
|
||||
echo "操作完成,正在重启设备..."
|
||||
reboot
|
||||
else
|
||||
echo "操作已取消。"
|
||||
fi
|
||||
}
|
||||
|
||||
add_arch_64bit() {
|
||||
if ! wget -O /etc/opkg/arch.conf $HTTP_HOST/64bit/arch.conf; then
|
||||
echo "下载 arch.conf 失败,脚本终止。"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 防止误操作 隐藏首页无用的元素
|
||||
hide_ui_elements() {
|
||||
|
||||
TARGET="/www/luci-static/quickstart/style.css"
|
||||
MARKER="/* hide custom luci elements */"
|
||||
|
||||
# 如果没有追加过,就添加
|
||||
if ! grep -q "$MARKER" "$TARGET"; then
|
||||
cat <<EOF >>"$TARGET"
|
||||
|
||||
$MARKER
|
||||
/* 隐藏首页格式化按钮 */
|
||||
.value-data button {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏网络页的第 3 个 item */
|
||||
#main > div > div.network-container.align-c > div > div > div:nth-child(3) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏网络页的第 5 个 item */
|
||||
#main > div > div.network-container.align-c > div > div > div:nth-child(5) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏 feature-card.pink */
|
||||
#main > div > div.card-container > div.feature-card.pink {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
EOF
|
||||
echo "✅ 自定义元素已隐藏"
|
||||
else
|
||||
echo "⚠️ 无需重复操作"
|
||||
fi
|
||||
}
|
||||
|
||||
#自定义风扇开始工作的温度
|
||||
set_glfan_temp() {
|
||||
|
||||
is_integer() {
|
||||
if [[ $1 =~ ^[0-9]+$ ]]; then
|
||||
return 0 # 是整数
|
||||
else
|
||||
return 1 # 不是整数
|
||||
fi
|
||||
}
|
||||
echo "兼容带风扇机型的GL-iNet路由器"
|
||||
echo "请输入风扇开始工作的温度(建议40-70之间的整数):"
|
||||
read temp
|
||||
|
||||
if is_integer "$temp"; then
|
||||
uci set glfan.@globals[0].temperature="$temp"
|
||||
uci set glfan.@globals[0].warn_temperature="$temp"
|
||||
uci set glfan.@globals[0].integration=4
|
||||
uci set glfan.@globals[0].differential=20
|
||||
uci commit glfan
|
||||
/etc/init.d/gl_fan restart
|
||||
echo "设置成功!稍等片刻,请查看风扇转动情况"
|
||||
else
|
||||
echo "错误: 请输入整数."
|
||||
fi
|
||||
}
|
||||
|
||||
toggle_adguardhome() {
|
||||
status=$(uci get adguardhome.config.enabled)
|
||||
|
||||
if [ "$status" -eq 1 ]; then
|
||||
echo "Disabling AdGuardHome..."
|
||||
uci set adguardhome.config.enabled='0' >/dev/null 2>&1
|
||||
uci commit adguardhome >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome disable >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome stop >/dev/null 2>&1
|
||||
green "AdGuardHome 已关闭"
|
||||
else
|
||||
echo "Enabling AdGuardHome..."
|
||||
uci set adguardhome.config.enabled='1' >/dev/null 2>&1
|
||||
uci commit adguardhome >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome enable >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome start >/dev/null 2>&1
|
||||
green "AdGuardHome 已开启 访问 http://192.168.8.1:3000"
|
||||
fi
|
||||
}
|
||||
|
||||
# 安装[官方辅助UI]插件 by 论坛 iBelieve
|
||||
do_install_ui_helper() {
|
||||
|
||||
echo "⚠️ 请您确保当前固件版本大于 4.7.2,若低于此版本建议先升级。"
|
||||
read -p "👉 如果您已确认,请按 [回车] 继续;否则按 Ctrl+C 或输入任意内容后回车退出:" user_input
|
||||
|
||||
if [ -n "$user_input" ]; then
|
||||
echo "🚫 用户取消安装。"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local ipk_file="/tmp/glinjector_3.0.5-6_all.ipk"
|
||||
local sha_file="${ipk_file}.sha256"
|
||||
|
||||
echo "📥 正在下载 IPK 及 SHA256 校验文件..."
|
||||
wget -O "$sha_file" "$HTTP_HOST/ui/glinjector_3.0.5-6_all.ipk.sha256" || {
|
||||
echo "❌ 下载 SHA256 文件失败"
|
||||
return 1
|
||||
}
|
||||
|
||||
wget --user-agent="Mozilla/5.0" -O "$ipk_file" "$HTTP_HOST/ui/glinjector_3.0.5-6_all.ipk" || {
|
||||
echo "❌ 下载 IPK 文件失败"
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "🔐 正在进行 SHA256 校验..."
|
||||
|
||||
cd "$(dirname "$ipk_file")"
|
||||
sha256sum -c "$sha_file" || {
|
||||
echo "❌ 校验失败:文件已损坏或未完整下载"
|
||||
rm -f "$ipk_file"
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "✅ 校验通过,开始安装..."
|
||||
|
||||
opkg update
|
||||
opkg install "$ipk_file"
|
||||
}
|
||||
#高级卸载
|
||||
advanced_uninstall(){
|
||||
echo "📥 正在下载 高级卸载插件..."
|
||||
wget -O /tmp/advanced_uninstall.run $HTTP_HOST/luci-app-uninstall.run && chmod +x /tmp/advanced_uninstall.run
|
||||
sh /tmp/advanced_uninstall.run
|
||||
}
|
||||
|
||||
# 安装新首页风格
|
||||
do_install_new_quickstart(){
|
||||
green "正在更新到最新版iStoreOS首页风格 "
|
||||
TMPATH=/tmp/qstart
|
||||
mkdir -p ${TMPATH}
|
||||
app_aarch64='quickstart_0.11.7-1_aarch64_cortex-a53.ipk'
|
||||
app_ui='luci-app-quickstart_0.11.7-r1_all.ipk'
|
||||
app_lng='luci-i18n-quickstart-zh-cn_git-25.283.23675-635149e_all.ipk'
|
||||
wget $HTTP_HOST/newquickstart/$app_aarch64 -O ${TMPATH}/$app_aarch64
|
||||
wget $HTTP_HOST/newquickstart/$app_ui -O ${TMPATH}/$app_ui
|
||||
wget $HTTP_HOST/newquickstart/$app_lng -O ${TMPATH}/$app_lng
|
||||
opkg install ${TMPATH}/*.ipk
|
||||
rm -rf ${TMPATH}
|
||||
hide_ui_elements
|
||||
green "首页风格安装完毕!请使用8080端口访问luci界面:http://192.168.8.1:8080"
|
||||
green "作者更多动态务必收藏:https://tvhelper.cpolar.cn/"
|
||||
}
|
||||
|
||||
while true; do
|
||||
clear
|
||||
gl_name=$(get_router_name)
|
||||
result="GL-iNet Be6500 一键iStoreOS风格化(新版)"
|
||||
echo "***********************************************************************"
|
||||
echo "* 一键安装工具箱(for gl-inet be6500) by @wukongdaily "
|
||||
echo "**********************************************************************"
|
||||
echo "*******支持的机型列表***************************************************"
|
||||
green "*******GL-iNet BE-6500********"
|
||||
green "请确保您的固件版本在4.7.2以上"
|
||||
echo
|
||||
|
||||
light_magenta " 1. $result"
|
||||
echo
|
||||
light_magenta " 2. 安装argon紫色主题"
|
||||
echo
|
||||
light_magenta " 3. 单独安装iStore商店"
|
||||
echo
|
||||
light_magenta " 4. 隐藏首页无用元素"
|
||||
echo
|
||||
light_magenta " 5. 自定义风扇启动温度"
|
||||
echo
|
||||
light_magenta " 6. 安装个性化UI辅助插件(by VMatrices)"
|
||||
echo
|
||||
light_magenta " 7. 安装高级卸载插件"
|
||||
echo
|
||||
light_magenta " 8. 安装新首页"
|
||||
echo
|
||||
light_magenta " 9. 恢复出厂设置"
|
||||
echo
|
||||
echo " Q. 退出本程序"
|
||||
echo
|
||||
read -p "请选择一个选项: " choice
|
||||
|
||||
case $choice in
|
||||
|
||||
1)
|
||||
#安装iStore风格
|
||||
install_istore_os_style
|
||||
#基础必备设置
|
||||
setup_base_init
|
||||
#安装iStore商店
|
||||
do_istore
|
||||
#安装首页和网络向导
|
||||
do_quickstart
|
||||
;;
|
||||
2)
|
||||
do_install_argon_skin
|
||||
;;
|
||||
3)
|
||||
do_istore
|
||||
;;
|
||||
4)
|
||||
hide_ui_elements
|
||||
;;
|
||||
5)
|
||||
set_glfan_temp
|
||||
;;
|
||||
6)
|
||||
do_install_ui_helper
|
||||
;;
|
||||
7)
|
||||
advanced_uninstall
|
||||
;;
|
||||
8)
|
||||
do_install_new_quickstart
|
||||
;;
|
||||
9)
|
||||
recovery
|
||||
;;
|
||||
q | Q)
|
||||
echo "退出"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "无效选项,请重新选择。"
|
||||
;;
|
||||
esac
|
||||
|
||||
read -p "按 Enter 键继续..."
|
||||
done
|
||||
@@ -0,0 +1,220 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 定义颜色输出函数
|
||||
red() { echo -e "\033[31m\033[01m[WARNING] $1\033[0m"; }
|
||||
green() { echo -e "\033[32m\033[01m[INFO] $1\033[0m"; }
|
||||
yellow() { echo -e "\033[33m\033[01m[NOTICE] $1\033[0m"; }
|
||||
blue() { echo -e "\033[34m\033[01m[MESSAGE] $1\033[0m"; }
|
||||
light_magenta() { echo -e "\033[95m\033[01m[NOTICE] $1\033[0m"; }
|
||||
light_yellow() { echo -e "\033[93m\033[01m[NOTICE] $1\033[0m"; }
|
||||
|
||||
|
||||
# 获取路由器型号信息
|
||||
get_router_name() {
|
||||
cat /tmp/sysinfo/model
|
||||
}
|
||||
|
||||
# 安装依赖应用
|
||||
install_depends_apps() {
|
||||
blue "正在安装部署环境的所需要的工具 lsblk 和 fdisk ..."
|
||||
router_name=$(get_router_name)
|
||||
case "$router_name" in
|
||||
*2500* | *3000*)
|
||||
opkg update >/dev/null 2>&1
|
||||
if opkg install lsblk fdisk >/dev/null 2>&1; then
|
||||
green "$router_name 的 lsblk fdisk 工具 安装成功。"
|
||||
else
|
||||
red "安装失败。"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*6000*)
|
||||
red "由于 mt6000 的软件源中没有找到 lsblk 和 fdisk ..."
|
||||
yellow "因此先借用 mt3000 的软件源来安装 lsblk 和 fdisk 工具"
|
||||
# 备份 /etc/opkg/distfeeds.conf
|
||||
cp /etc/opkg/distfeeds.conf /etc/opkg/distfeeds.conf.backup
|
||||
# 先替换为 mt3000 的软件源来安装 lsblk 和 fdisk 工具
|
||||
mt3000_opkg="https://cafe.cpolar.top/wkdaily/gl-inet-onescript/raw/branch/master/mt-3000/distfeeds.conf"
|
||||
wget -O /etc/opkg/distfeeds.conf ${mt3000_opkg}
|
||||
green "正在更新为 mt3000 的软件源"
|
||||
cat /etc/opkg/distfeeds.conf
|
||||
opkg update
|
||||
green "再次尝试安装 lsblk 和 fdisk 工具"
|
||||
if opkg install fdisk lsblk; then
|
||||
green "$router_name 的 lsblk fdisk 工具 安装成功。"
|
||||
# 还原软件源
|
||||
cp /etc/opkg/distfeeds.conf.backup /etc/opkg/distfeeds.conf
|
||||
else
|
||||
red "安装失败。"
|
||||
# 还原软件源
|
||||
cp /etc/opkg/distfeeds.conf.backup /etc/opkg/distfeeds.conf
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Router name does not contain '3000', '6000', or '2500'."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# 准备USB设备
|
||||
prepare_usb_device() {
|
||||
green "现在开始查找USB设备分区,请稍后......"
|
||||
local usb_disk=$(lsblk -dn -o NAME,RM,TYPE | awk '$2=="1" && $3=="disk" {print "/dev/"$1; exit}')
|
||||
if [ -z "$usb_disk" ]; then
|
||||
red "未找到USB磁盘。"
|
||||
exit 1
|
||||
fi
|
||||
yellow "找到USB磁盘:$usb_disk"
|
||||
|
||||
# 清零磁盘开始部分以清除分区表和文件系统签名
|
||||
dd if=/dev/zero of=$usb_disk bs=1M count=10
|
||||
sync
|
||||
|
||||
# 卸载所有与该磁盘相关的挂载点
|
||||
unmount_usb_device "$usb_disk"
|
||||
|
||||
red "正在重新分区并格式化$usb_disk..."
|
||||
create_and_format_partition "$usb_disk"
|
||||
}
|
||||
|
||||
# 卸载USB设备
|
||||
unmount_usb_device() {
|
||||
for mount in $(mount | grep "$1" | awk '{print $3}'); do
|
||||
yellow "正在尝试卸载U盘挂载点:$mount"
|
||||
umount $mount || {
|
||||
red "警告:无法卸载挂载点 $mount。可能有文件正在被访问或权限不足。"
|
||||
exit 1
|
||||
}
|
||||
green "U盘挂载点 $mount 卸载成功。"
|
||||
done
|
||||
}
|
||||
|
||||
# 创建并格式化分区
|
||||
create_and_format_partition() {
|
||||
{
|
||||
echo o # 创建一个新的空DOS分区表
|
||||
echo n # 添加一个新分区
|
||||
echo p # 主分区
|
||||
echo 1 # 分区号1
|
||||
echo # 第一个可用扇区(默认)
|
||||
echo # 最后一个扇区(默认,使用剩余空间)
|
||||
echo w # 写入并退出
|
||||
} | fdisk $1 >/dev/null 2>&1
|
||||
|
||||
sleep 5
|
||||
|
||||
local new_partition="${1}1"
|
||||
red "正在将U盘 $new_partition 格式化为EXT4文件系统..."
|
||||
mkfs.ext4 -F $new_partition >/dev/null 2>&1
|
||||
green "$new_partition 已成功格式化为EXT4文件系统。"
|
||||
configure_and_start_docker $new_partition
|
||||
}
|
||||
|
||||
# 配置并启动Docker
|
||||
configure_and_start_docker() {
|
||||
local new_partition="$1"
|
||||
local usb_mount_point="/mnt/upan_data"
|
||||
local docker_root="$usb_mount_point/docker"
|
||||
|
||||
mkdir -p $docker_root
|
||||
green "将U盘 挂载到 $usb_mount_point..."
|
||||
mount -t ext4 $new_partition $usb_mount_point
|
||||
if [ $? -ne 0 ]; then
|
||||
red "挂载失败,脚本退出。"
|
||||
exit 1
|
||||
fi
|
||||
green "U盘挂载成功啦\n"
|
||||
|
||||
green "正在创建 Docker 配置文件 /etc/docker/daemon.json"
|
||||
mkdir -p /etc/docker
|
||||
echo '{
|
||||
"bridge": "docker0",
|
||||
"storage-driver": "overlay2",
|
||||
"data-root": "'$docker_root'"
|
||||
}' >/etc/docker/daemon.json
|
||||
|
||||
install_docker
|
||||
configure_docker_to_start_on_boot "$new_partition" "$usb_mount_point"
|
||||
|
||||
}
|
||||
|
||||
# 安装 Docker 和 dockerd
|
||||
install_docker() {
|
||||
green "正在更新 OPKG 软件包..."
|
||||
opkg update >/dev/null 2>&1
|
||||
green "正在安装 Docker 及相关服务...请耐心等待一会...大约需要1分钟\n"
|
||||
opkg install luci-app-dockerman >/dev/null 2>&1
|
||||
opkg install luci-i18n-dockerman-zh-cn >/dev/null 2>&1
|
||||
opkg install dockerd --force-depends >/dev/null 2>&1
|
||||
# 修改 /etc/config/dockerd 文件中的 data_root 配置
|
||||
sed -i "/option data_root/c\ option data_root '/mnt/upan_data/docker/'" /etc/config/dockerd
|
||||
}
|
||||
|
||||
# 配置 Docker 开机启动
|
||||
configure_docker_to_start_on_boot() {
|
||||
local new_partition="$1"
|
||||
local usb_mount_point="$2"
|
||||
# 创建并配置启动脚本
|
||||
green "正在设置 Docker 跟随系统启动的文件:/etc/init.d/docker"
|
||||
cat <<EOF >/etc/init.d/docker
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
PROG="/usr/bin/dockerd"
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command \$PROG --config-file /etc/docker/daemon.json
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
killall dockerd
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
EOF
|
||||
|
||||
chmod +x /etc/init.d/docker
|
||||
/etc/init.d/docker enable
|
||||
|
||||
green "正在设置开机启动顺序的配置\n\n先挂载U盘,再启动Docker 修改/etc/rc.local后如下\n"
|
||||
# 首先,备份 /etc/rc.local
|
||||
cp /etc/rc.local /etc/rc.local.backup
|
||||
# glinet系统重启后的 USB自动挂载点
|
||||
SYSTEM_USB_AUTO_MOUNTPOINT="/tmp/mountd/disk1_part1"
|
||||
# 卸载USB自动挂载点 挂载自定义挂载点 /mnt/upan_data
|
||||
if ! grep -q "umount $SYSTEM_USB_AUTO_MOUNTPOINT" /etc/rc.local; then
|
||||
sed -i '/exit 0/d' /etc/rc.local
|
||||
|
||||
# 将新的命令添加到 /etc/rc.local,然后再加上 exit 0
|
||||
{
|
||||
echo "umount $SYSTEM_USB_AUTO_MOUNTPOINT || true"
|
||||
echo "mount $new_partition $usb_mount_point || true"
|
||||
echo "/etc/init.d/docker start || true"
|
||||
echo "exit 0"
|
||||
} >>/etc/rc.local
|
||||
fi
|
||||
|
||||
cat /etc/rc.local
|
||||
green "Docker 运行环境部署完成 重启后生效\n"
|
||||
red "是否立即重启?(y/n)"
|
||||
read -r answer
|
||||
if [ "$answer" = "y" ] || [ -z "$answer" ]; then
|
||||
red "正在重启..."
|
||||
reboot
|
||||
else
|
||||
yellow "您选择了不重启"
|
||||
fi
|
||||
}
|
||||
|
||||
# START
|
||||
install_depends_apps
|
||||
prepare_usb_device
|
||||
+629
@@ -0,0 +1,629 @@
|
||||
#!/bin/sh
|
||||
# 定义颜色输出函数
|
||||
red() { echo -e "\033[31m\033[01m$1\033[0m"; }
|
||||
green() { echo -e "\033[32m\033[01m$1\033[0m"; }
|
||||
yellow() { echo -e "\033[33m\033[01m$1\033[0m"; }
|
||||
blue() { echo -e "\033[34m\033[01m$1\033[0m"; }
|
||||
light_magenta() { echo -e "\033[95m\033[01m$1\033[0m"; }
|
||||
light_yellow() { echo -e "\033[93m\033[01m$1\033[0m"; }
|
||||
cyan() { echo -e "\033[38;2;0;255;255m$1\033[0m"; }
|
||||
third_party_source="https://istore.linkease.com/repo/all/nas_luci"
|
||||
HTTP_HOST="https://mt3000.netlify.app"
|
||||
# 设置全局命令 g
|
||||
cp -f "$0" /usr/bin/g
|
||||
chmod +x /usr/bin/g
|
||||
|
||||
|
||||
setup_base_init() {
|
||||
|
||||
#添加出处信息
|
||||
add_author_info
|
||||
#添加安卓时间服务器
|
||||
add_dhcp_domain
|
||||
##设置时区
|
||||
uci set system.@system[0].zonename='Asia/Shanghai'
|
||||
uci set system.@system[0].timezone='CST-8'
|
||||
uci commit system
|
||||
/etc/init.d/system reload
|
||||
|
||||
## 设置防火墙wan 打开,方便主路由访问
|
||||
uci set firewall.@zone[1].input='ACCEPT'
|
||||
uci commit firewall
|
||||
|
||||
}
|
||||
|
||||
## 安装应用商店和主题
|
||||
install_istore_os_style() {
|
||||
##设置Argon 紫色主题
|
||||
do_install_argon_skin
|
||||
#增加首页终端图标
|
||||
opkg install ttyd
|
||||
#默认使用体积很小的文件传输:系统——文件传输
|
||||
do_install_filetransfer
|
||||
#默认安装必备工具SFTP 方便下载文件 比如finalshell等工具可以直接浏览路由器文件
|
||||
is-opkg install app-meta-sftp
|
||||
is-opkg install 'app-meta-ddnsto'
|
||||
# 安装磁盘管理
|
||||
is-opkg install 'app-meta-diskman'
|
||||
FILE_PATH="/etc/openwrt_release"
|
||||
NEW_DESCRIPTION="Openwrt like iStoreOS Style by wukongdaily"
|
||||
CONTENT=$(cat $FILE_PATH)
|
||||
UPDATED_CONTENT=$(echo "$CONTENT" | sed "s/DISTRIB_DESCRIPTION='[^']*'/DISTRIB_DESCRIPTION='$NEW_DESCRIPTION'/")
|
||||
echo "$UPDATED_CONTENT" >$FILE_PATH
|
||||
|
||||
}
|
||||
# 安装iStore 参考 https://github.com/linkease/istore
|
||||
do_istore() {
|
||||
echo "do_istore method==================>"
|
||||
ISTORE_REPO=https://istore.linkease.com/repo/all/store
|
||||
FCURL="curl --fail --show-error"
|
||||
|
||||
curl -V >/dev/null 2>&1 || {
|
||||
echo "prereq: install curl"
|
||||
opkg info curl | grep -Fqm1 curl || opkg update
|
||||
opkg install curl
|
||||
}
|
||||
|
||||
IPK=$($FCURL "$ISTORE_REPO/Packages.gz" | zcat | grep -m1 '^Filename: luci-app-store.*\.ipk$' | sed -n -e 's/^Filename: \(.\+\)$/\1/p')
|
||||
|
||||
[ -n "$IPK" ] || exit 1
|
||||
|
||||
$FCURL "$ISTORE_REPO/$IPK" | tar -xzO ./data.tar.gz | tar -xzO ./bin/is-opkg >/tmp/is-opkg
|
||||
|
||||
[ -s "/tmp/is-opkg" ] || exit 1
|
||||
|
||||
chmod 755 /tmp/is-opkg
|
||||
/tmp/is-opkg update
|
||||
# /tmp/is-opkg install taskd
|
||||
/tmp/is-opkg opkg install --force-reinstall luci-lib-taskd luci-lib-xterm
|
||||
/tmp/is-opkg opkg install --force-reinstall luci-app-store || exit $?
|
||||
[ -s "/etc/init.d/tasks" ] || /tmp/is-opkg opkg install --force-reinstall taskd
|
||||
[ -s "/usr/lib/lua/luci/cbi.lua" ] || /tmp/is-opkg opkg install luci-compat >/dev/null 2>&1
|
||||
|
||||
}
|
||||
|
||||
#设置风扇工作温度
|
||||
setup_cpu_fans() {
|
||||
#设定温度阀值,cpu高于48度,则风扇开始工作
|
||||
uci set glfan.@globals[0].temperature=50
|
||||
uci set glfan.@globals[0].warn_temperature=50
|
||||
uci set glfan.@globals[0].integration=4
|
||||
uci set glfan.@globals[0].differential=20
|
||||
uci commit glfan
|
||||
/etc/init.d/gl_fan restart
|
||||
}
|
||||
|
||||
# 判断系统是否为iStoreOS
|
||||
is_iStoreOS() {
|
||||
DISTRIB_ID=$(cat /etc/openwrt_release | grep "DISTRIB_ID" | cut -d "'" -f 2)
|
||||
# 检查DISTRIB_ID的值是否等于'iStoreOS'
|
||||
if [ "$DISTRIB_ID" = "iStoreOS" ]; then
|
||||
return 0 # true
|
||||
else
|
||||
return 1 # false
|
||||
fi
|
||||
}
|
||||
|
||||
## 去除opkg签名
|
||||
remove_check_signature_option() {
|
||||
local opkg_conf="/etc/opkg.conf"
|
||||
sed -i '/option check_signature/d' "$opkg_conf"
|
||||
}
|
||||
|
||||
## 添加opkg签名
|
||||
add_check_signature_option() {
|
||||
local opkg_conf="/etc/opkg.conf"
|
||||
echo "option check_signature 1" >>"$opkg_conf"
|
||||
}
|
||||
|
||||
#设置第三方软件源
|
||||
setup_software_source() {
|
||||
## 传入0和1 分别代表原始和第三方软件源
|
||||
if [ "$1" -eq 0 ]; then
|
||||
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
|
||||
##如果是iStoreOS系统,还原软件源之后,要添加签名
|
||||
if is_iStoreOS; then
|
||||
add_check_signature_option
|
||||
else
|
||||
echo
|
||||
fi
|
||||
# 还原软件源之后更新
|
||||
opkg update
|
||||
elif [ "$1" -eq 1 ]; then
|
||||
#传入1 代表设置第三方软件源 先要删掉签名
|
||||
remove_check_signature_option
|
||||
# 先删除再添加以免重复
|
||||
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
|
||||
echo "src/gz third_party_source $third_party_source" >>/etc/opkg/customfeeds.conf
|
||||
# 设置第三方源后要更新
|
||||
opkg update
|
||||
else
|
||||
echo "Invalid option. Please provide 0 or 1."
|
||||
fi
|
||||
}
|
||||
|
||||
# 添加主机名映射(解决安卓原生TV首次连不上wifi的问题)
|
||||
add_dhcp_domain() {
|
||||
local domain_name="time.android.com"
|
||||
local domain_ip="203.107.6.88"
|
||||
|
||||
# 检查是否存在相同的域名记录
|
||||
existing_records=$(uci show dhcp | grep "dhcp.@domain\[[0-9]\+\].name='$domain_name'")
|
||||
if [ -z "$existing_records" ]; then
|
||||
# 添加新的域名记录
|
||||
uci add dhcp domain
|
||||
uci set "dhcp.@domain[-1].name=$domain_name"
|
||||
uci set "dhcp.@domain[-1].ip=$domain_ip"
|
||||
uci commit dhcp
|
||||
else
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
#添加出处信息
|
||||
add_author_info() {
|
||||
uci set system.@system[0].description='wukongdaily'
|
||||
uci set system.@system[0].notes='文档说明:
|
||||
https://tvhelper.cpolar.cn/'
|
||||
uci commit system
|
||||
}
|
||||
|
||||
##获取软路由型号信息
|
||||
get_router_name() {
|
||||
model_info=$(cat /tmp/sysinfo/model)
|
||||
echo "$model_info"
|
||||
}
|
||||
|
||||
get_router_hostname() {
|
||||
hostname=$(uci get system.@system[0].hostname)
|
||||
echo "$hostname 路由器"
|
||||
}
|
||||
|
||||
add_custom_feed() {
|
||||
# 先清空配置
|
||||
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
|
||||
# Prompt the user to enter the feed URL
|
||||
echo "请输入自定义软件源的地址(通常是https开头 aarch64_cortex-a53 结尾):"
|
||||
read feed_url
|
||||
if [ -n "$feed_url" ]; then
|
||||
echo "src/gz custom_feed $feed_url" >>/etc/opkg/customfeeds.conf
|
||||
opkg update
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "已添加并更新列表."
|
||||
else
|
||||
echo "已添加但更新失败,请检查网络或重试."
|
||||
fi
|
||||
else
|
||||
echo "Error: Feed URL not provided. No changes were made."
|
||||
fi
|
||||
}
|
||||
|
||||
remove_custom_feed() {
|
||||
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
|
||||
opkg update
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "已删除并更新列表."
|
||||
else
|
||||
echo "已删除了自定义软件源但更新失败,请检查网络或重试."
|
||||
fi
|
||||
}
|
||||
|
||||
# 检查是否安装了 whiptail
|
||||
check_whiptail_installed() {
|
||||
if [ -e /usr/bin/whiptail ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# 执行重启操作
|
||||
do_reboot() {
|
||||
reboot
|
||||
}
|
||||
|
||||
#自定义风扇开始工作的温度
|
||||
set_glfan_temp() {
|
||||
|
||||
is_integer() {
|
||||
if [[ $1 =~ ^[0-9]+$ ]]; then
|
||||
return 0 # 是整数
|
||||
else
|
||||
return 1 # 不是整数
|
||||
fi
|
||||
}
|
||||
echo "兼容带风扇机型的GL-iNet路由器"
|
||||
echo "请输入风扇开始工作的温度(建议40-70之间的整数):"
|
||||
read temp
|
||||
|
||||
if is_integer "$temp"; then
|
||||
uci set glfan.@globals[0].temperature="$temp"
|
||||
uci set glfan.@globals[0].warn_temperature="$temp"
|
||||
uci set glfan.@globals[0].integration=4
|
||||
uci set glfan.@globals[0].differential=20
|
||||
uci commit glfan
|
||||
/etc/init.d/gl_fan restart
|
||||
echo "设置成功!稍等片刻,请查看风扇转动情况"
|
||||
else
|
||||
echo "错误: 请输入整数."
|
||||
fi
|
||||
}
|
||||
|
||||
recovery_opkg_settings() {
|
||||
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
|
||||
mt3000_opkg="$HTTP_HOST/mt-3000/distfeeds-24.conf"
|
||||
wget -O /etc/opkg/distfeeds.conf ${mt3000_opkg}
|
||||
}
|
||||
|
||||
update_opkg_config() {
|
||||
kernel_version=$(uname -r)
|
||||
echo "MT-6000 kernel version: $kernel_version"
|
||||
case $kernel_version in
|
||||
5.4*)
|
||||
mt6000_opkg="$HTTP_HOST/mt-6000/distfeeds-5.4.conf"
|
||||
wget -O /etc/opkg/distfeeds.conf ${mt6000_opkg}
|
||||
# 更换5.4.238 内核之后 缺少的依赖
|
||||
|
||||
mkdir -p /tmp/mt6000
|
||||
wget --user-agent="Mozilla/5.0" -O /tmp/mt6000/script-utils.ipk "$HTTP_HOST/mt-6000/script-utils.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O /tmp/mt6000/mdadm.ipk "$HTTP_HOST/mt-6000/mdadm.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O /tmp/mt6000/lsblk.ipk "$HTTP_HOST/mt-6000/lsblk.ipk"
|
||||
opkg update
|
||||
if [ -f "/tmp/mt6000/lsblk.ipk" ]; then
|
||||
# 先卸载之前安装过的lsblk,确保使用的是正确的lsblk
|
||||
opkg remove lsblk
|
||||
fi
|
||||
opkg install /tmp/mt6000/*.ipk
|
||||
;;
|
||||
5.15*)
|
||||
mt6000_opkg="$HTTP_HOST/mt-6000/distfeeds.conf"
|
||||
wget -O /etc/opkg/distfeeds.conf ${mt6000_opkg}
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported kernel version: $kernel_version"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
do_luci_app_wireguard() {
|
||||
setup_software_source 0
|
||||
opkg install luci-app-wireguard
|
||||
opkg install luci-i18n-wireguard-zh-cn
|
||||
echo "请访问 http://"$(uci get network.lan.ipaddr)"/cgi-bin/luci/admin/status/wireguard 查看状态 "
|
||||
echo "也可以去接口中 查看是否增加了新的wireguard 协议的选项 "
|
||||
}
|
||||
update_luci_app_quickstart() {
|
||||
if [ -f "/bin/is-opkg" ]; then
|
||||
# 如果 /bin/is-opkg 存在,则执行 is-opkg update
|
||||
is-opkg update
|
||||
is-opkg install luci-i18n-quickstart-zh-cn --force-depends >/dev/null 2>&1
|
||||
opkg install iptables-mod-tproxy
|
||||
opkg install iptables-mod-socket
|
||||
opkg install iptables-mod-iprange
|
||||
green "正在更新到最新版iStoreOS首页风格 "
|
||||
TMPATH=/tmp/qstart
|
||||
mkdir -p ${TMPATH}
|
||||
app_aarch64='quickstart_0.11.7-1_aarch64_cortex-a53.ipk'
|
||||
app_ui='luci-app-quickstart_0.11.7-r1_all.ipk'
|
||||
app_lng='luci-i18n-quickstart-zh-cn_git-25.283.23675-635149e_all.ipk'
|
||||
wget $HTTP_HOST/newquickstart/$app_aarch64 -O ${TMPATH}/$app_aarch64
|
||||
wget $HTTP_HOST/newquickstart/$app_ui -O ${TMPATH}/$app_ui
|
||||
wget $HTTP_HOST/newquickstart/$app_lng -O ${TMPATH}/$app_lng
|
||||
opkg install ${TMPATH}/*.ipk
|
||||
rm -rf ${TMPATH}
|
||||
hide_ui_elements
|
||||
yellow "恭喜您!现在你的路由器已经变成iStoreOS风格啦!"
|
||||
green "现在您可以访问8080端口 查看是否生效 http://192.168.8.1:8080"
|
||||
green "更多up主项目和动态 请务必收藏我的导航站 https://tvhelper.cpolar.cn "
|
||||
green "赞助本项目作者 https://wkdaily.cpolar.cn/01 "
|
||||
addr_hostname=$(uci get system.@system[0].hostname)
|
||||
else
|
||||
red "请先执行第一项 一键iStoreOS风格化"
|
||||
fi
|
||||
}
|
||||
|
||||
# 安装体积非常小的文件传输软件 默认上传位置/tmp/upload/
|
||||
do_install_filetransfer() {
|
||||
mkdir -p /tmp/luci-app-filetransfer/
|
||||
cd /tmp/luci-app-filetransfer/
|
||||
wget --user-agent="Mozilla/5.0" -O luci-app-filetransfer_all.ipk "$HTTP_HOST/luci-app-filetransfer/luci-app-filetransfer_all.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O luci-lib-fs_1.0-14_all.ipk "$HTTP_HOST/luci-app-filetransfer/luci-lib-fs_1.0-14_all.ipk"
|
||||
opkg install *.ipk --force-depends
|
||||
}
|
||||
do_install_depends_ipk() {
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/luci-lua-runtime_all.ipk" "$HTTP_HOST/theme/luci-lua-runtime_all.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/libopenssl3.ipk" "$HTTP_HOST/theme/libopenssl3.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/luci-compat.ipk" "$HTTP_HOST/theme/luci-compat.ipk"
|
||||
opkg install "/tmp/luci-lua-runtime_all.ipk"
|
||||
opkg install "/tmp/libopenssl3.ipk"
|
||||
opkg install "/tmp/luci-compat.ipk"
|
||||
}
|
||||
#单独安装argon主题
|
||||
do_install_argon_skin() {
|
||||
echo "正在尝试安装argon主题......."
|
||||
wget "$HTTP_HOST/theme/argon-2.4.3.run" -O /tmp/argon.run
|
||||
sh /tmp/argon.run
|
||||
# 检查上一个命令的返回值
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "argon主题 安装成功"
|
||||
# 设置主题和语言
|
||||
uci set luci.main.mediaurlbase='/luci-static/argon'
|
||||
uci set luci.main.lang='zh_cn'
|
||||
uci commit
|
||||
echo "重新登录web页面后, 查看新主题 "
|
||||
else
|
||||
echo "argon主题 安装失败! 建议再执行一次!再给我一个机会!事不过三!"
|
||||
fi
|
||||
}
|
||||
|
||||
#单独安装文件管理器
|
||||
do_install_filemanager() {
|
||||
echo "为避免bug,安装文件管理器之前,需要先iStore商店"
|
||||
do_istore
|
||||
echo "接下来 尝试安装文件管理器......."
|
||||
is-opkg install 'app-meta-linkease'
|
||||
echo "重新登录web页面,然后您可以访问: http://192.168.8.1/cgi-bin/luci/admin/services/linkease/file/?path=/root"
|
||||
}
|
||||
#更新脚本
|
||||
update_myself() {
|
||||
wget -O gl-inet.sh "$HTTP_HOST/gl-inet.sh" && chmod +x gl-inet.sh
|
||||
echo "脚本已更新并保存在当前目录 gl-inet.sh,现在将执行新脚本。"
|
||||
./gl-inet.sh
|
||||
exit 0
|
||||
}
|
||||
|
||||
#根据release地址和命名前缀获取apk地址
|
||||
get_docker_compose_url() {
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "需要提供GitHub releases页面的URL作为参数。"
|
||||
return 1
|
||||
fi
|
||||
local releases_url=$1
|
||||
# 使用curl获取重定向的URL
|
||||
latest_url=$(curl -Ls -o /dev/null -w "%{url_effective}" "$releases_url")
|
||||
# 使用sed从URL中提取tag值,并保留前导字符'v'
|
||||
tag=$(echo $latest_url | sed 's|.*/v|v|')
|
||||
# 检查是否成功获取到tag
|
||||
if [ -z "$tag" ]; then
|
||||
echo "未找到最新的release tag。"
|
||||
return 1
|
||||
fi
|
||||
# 拼接docker-compose下载链接
|
||||
local repo_path=$(echo "$releases_url" | sed -n 's|https://github.com/\(.*\)/releases/latest|\1|p')
|
||||
docker_compose_download_url="https://github.com/${repo_path}/releases/download/${tag}/docker-compose-linux-aarch64"
|
||||
echo "$docker_compose_download_url"
|
||||
}
|
||||
|
||||
# 下载并安装Docker Compose
|
||||
do_install_docker_compose() {
|
||||
# https://github.com/docker/compose/releases/download/v2.26.0/docker-compose-linux-aarch64
|
||||
# 检查/usr/bin/docker是否存在并且可执行
|
||||
if [ -f "/usr/bin/docker" ] && [ -x "/usr/bin/docker" ]; then
|
||||
echo "Docker is installed and has execute permissions."
|
||||
else
|
||||
red "警告 您还没有安装Docker"
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$gl_name" == *3000* ]]; then
|
||||
red "警告 docker-compose 组件的大小将近60MB,请谨慎安装"
|
||||
yellow "确定要继续安装吗(y|n)"
|
||||
read -r answer
|
||||
if [ "$answer" = "y" ] || [ -z "$answer" ]; then
|
||||
green "正在获取最新版docker-compose下载地址"
|
||||
else
|
||||
yellow "已退出docker-compose安装流程"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
local github_releases_url="https://github.com/docker/compose/releases/latest"
|
||||
local docker_compose_url=$(get_docker_compose_url "$github_releases_url")
|
||||
echo "最新版docker-compose 地址:$docker_compose_url"
|
||||
wget -O /usr/bin/docker-compose $docker_compose_url
|
||||
if [ $? -eq 0 ]; then
|
||||
green "docker-compose下载并安装成功,你可以使用啦"
|
||||
chmod +x /usr/bin/docker-compose
|
||||
else
|
||||
red "安装失败,请检查网络连接.或者手动下载到 /usr/bin/docker-compose 记得赋予执行权限"
|
||||
yellow "刚才使用的地址是:$docker_compose_url"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
#mt3000更换分区
|
||||
mt3000_overlay_changed() {
|
||||
wget -O mt3000.sh "$HTTP_HOST/mt-3000/mt3000.sh" && chmod +x mt3000.sh
|
||||
sh mt3000.sh
|
||||
}
|
||||
|
||||
# 防止误操作 隐藏首页无用的元素
|
||||
hide_ui_elements() {
|
||||
|
||||
TARGET="/www/luci-static/quickstart/style.css"
|
||||
MARKER="/* hide custom luci elements */"
|
||||
|
||||
# 如果没有追加过,就添加
|
||||
if ! grep -q "$MARKER" "$TARGET"; then
|
||||
cat <<EOF >>"$TARGET"
|
||||
|
||||
$MARKER
|
||||
/* 隐藏首页格式化按钮 */
|
||||
.value-data button {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏网络页的第 3 个 item */
|
||||
#main > div > div.network-container.align-c > div > div > div:nth-child(3) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏网络页的第 5 个 item */
|
||||
#main > div > div.network-container.align-c > div > div > div:nth-child(5) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏 feature-card.pink */
|
||||
#main > div > div.card-container > div.feature-card.pink {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
EOF
|
||||
echo "✅ 自定义元素已隐藏"
|
||||
else
|
||||
echo "⚠️ 无需重复操作"
|
||||
fi
|
||||
}
|
||||
|
||||
# 启用adguardhome
|
||||
toggle_adguardhome() {
|
||||
status=$(uci get adguardhome.config.enabled)
|
||||
|
||||
if [ "$status" -eq 1 ]; then
|
||||
echo "Disabling AdGuardHome..."
|
||||
uci set adguardhome.config.enabled='0' >/dev/null 2>&1
|
||||
uci commit adguardhome >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome disable >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome stop >/dev/null 2>&1
|
||||
green "AdGuardHome 已关闭"
|
||||
else
|
||||
echo "Enabling AdGuardHome..."
|
||||
uci set adguardhome.config.enabled='1' >/dev/null 2>&1
|
||||
uci commit adguardhome >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome enable >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome start >/dev/null 2>&1
|
||||
green "AdGuardHome 已开启 访问 http://192.168.8.1:3000"
|
||||
fi
|
||||
}
|
||||
|
||||
# 安装[官方辅助UI]插件 by 论坛 iBelieve
|
||||
do_install_ui_helper() {
|
||||
|
||||
echo "⚠️ 请您确保当前固件版本大于 4.7.0,若低于此版本建议先升级。"
|
||||
read -p "👉 如果您已确认,请按 [回车] 继续;否则按 Ctrl+C 或输入任意内容后回车退出:" user_input
|
||||
|
||||
if [ -n "$user_input" ]; then
|
||||
echo "🚫 用户取消安装。"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local ipk_file="/tmp/glinjector_3.0.5-6_all.ipk"
|
||||
local sha_file="${ipk_file}.sha256"
|
||||
|
||||
echo "📥 正在下载 IPK 及 SHA256 校验文件..."
|
||||
wget -O "$sha_file" "$HTTP_HOST/ui/glinjector_3.0.5-6_all.ipk.sha256" || {
|
||||
echo "❌ 下载 SHA256 文件失败"
|
||||
return 1
|
||||
}
|
||||
|
||||
wget --user-agent="Mozilla/5.0" -O "$ipk_file" "$HTTP_HOST/ui/glinjector_3.0.5-6_all.ipk" || {
|
||||
echo "❌ 下载 IPK 文件失败"
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "🔐 正在进行 SHA256 校验..."
|
||||
|
||||
cd "$(dirname "$ipk_file")"
|
||||
sha256sum -c "$sha_file" || {
|
||||
echo "❌ 校验失败:文件已损坏或未完整下载"
|
||||
rm -f "$ipk_file"
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "✅ 校验通过,开始安装..."
|
||||
|
||||
opkg update
|
||||
opkg install "$ipk_file"
|
||||
}
|
||||
|
||||
#高级卸载
|
||||
advanced_uninstall(){
|
||||
echo "📥 正在下载 高级卸载插件..."
|
||||
wget -O /tmp/advanced_uninstall.run $HTTP_HOST/luci-app-uninstall.run && chmod +x /tmp/advanced_uninstall.run
|
||||
sh /tmp/advanced_uninstall.run
|
||||
}
|
||||
|
||||
while true; do
|
||||
clear
|
||||
gl_name=$(get_router_name)
|
||||
result=$gl_name"一键iStoreOS风格化(新版)"
|
||||
result=$(echo "$result" | sed 's/ like iStoreOS//')
|
||||
echo "***********************************************************************"
|
||||
echo "* 一键安装工具箱(for gl-inet Router)"
|
||||
echo "* 20251118 by @wukongdaily "
|
||||
echo "**********************************************************************"
|
||||
echo "* 当前的路由器型号: "$gl_name | sed 's/ like iStoreOS//'
|
||||
echo
|
||||
echo "*******支持的机型列表****************************************************"
|
||||
green "*******GL-iNet MT-2500A"
|
||||
green "*******GL-iNet MT-3000 "
|
||||
green "*******GL-iNet MT-6000 "
|
||||
echo "******************下次调用 直接输入快捷键 g *****************************"
|
||||
echo
|
||||
light_magenta " 1. $result"
|
||||
echo
|
||||
echo " 2. 设置风扇开始工作的温度(仅限MT3000)"
|
||||
echo " 3. 安装Argon紫色主题"
|
||||
echo " 4. 安装文件管理器"
|
||||
light_magenta "5. 隐藏首页非必要UI元素"
|
||||
light_magenta "6. 安装个性化UI辅助插件(by VMatrices)"
|
||||
light_magenta "7. 安装高级卸载插件"
|
||||
echo
|
||||
echo " Q. 退出本程序"
|
||||
echo
|
||||
read -p "请选择一个选项: " choice
|
||||
|
||||
case $choice in
|
||||
|
||||
1)
|
||||
if [[ "$gl_name" == *3000* ]]; then
|
||||
# 设置风扇工作温度
|
||||
setup_cpu_fans
|
||||
fi
|
||||
#先安装istore商店
|
||||
do_istore
|
||||
#安装iStore风格
|
||||
install_istore_os_style
|
||||
#安装iStore首页风格
|
||||
update_luci_app_quickstart
|
||||
#基础必备设置
|
||||
setup_base_init
|
||||
;;
|
||||
2)
|
||||
case "$gl_name" in
|
||||
*3000*)
|
||||
set_glfan_temp
|
||||
;;
|
||||
*)
|
||||
echo "* 当前的路由器型号: "$gl_name | sed 's/ like iStoreOS//'
|
||||
echo "并非MT3000 它没有风扇 无需设置"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
3)
|
||||
do_install_argon_skin
|
||||
;;
|
||||
4)
|
||||
do_install_filemanager
|
||||
;;
|
||||
5)
|
||||
hide_ui_elements
|
||||
;;
|
||||
6)
|
||||
do_install_ui_helper
|
||||
;;
|
||||
7)
|
||||
advanced_uninstall
|
||||
;;
|
||||
q | Q)
|
||||
echo "退出"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "无效选项,请重新选择。"
|
||||
;;
|
||||
esac
|
||||
|
||||
read -p "按 Enter 键继续..."
|
||||
done
|
||||
Executable
+734
@@ -0,0 +1,734 @@
|
||||
#!/bin/sh
|
||||
# 定义颜色输出函数
|
||||
red() { echo -e "\033[31m\033[01m$1\033[0m"; }
|
||||
green() { echo -e "\033[32m\033[01m$1\033[0m"; }
|
||||
yellow() { echo -e "\033[33m\033[01m$1\033[0m"; }
|
||||
blue() { echo -e "\033[34m\033[01m$1\033[0m"; }
|
||||
light_magenta() { echo -e "\033[95m\033[01m$1\033[0m"; }
|
||||
light_yellow() { echo -e "\033[93m\033[01m$1\033[0m"; }
|
||||
cyan() { echo -e "\033[38;2;0;255;255m$1\033[0m"; }
|
||||
third_party_source="https://istore.linkease.com/repo/all/nas_luci"
|
||||
HTTP_HOST="https://mt3000.netlify.app"
|
||||
# 设置全局命令 g
|
||||
cp -f "$0" /usr/bin/g
|
||||
chmod +x /usr/bin/g
|
||||
|
||||
|
||||
setup_base_init() {
|
||||
|
||||
#添加出处信息
|
||||
add_author_info
|
||||
#添加安卓时间服务器
|
||||
add_dhcp_domain
|
||||
##设置时区
|
||||
uci set system.@system[0].zonename='Asia/Shanghai'
|
||||
uci set system.@system[0].timezone='CST-8'
|
||||
uci commit system
|
||||
/etc/init.d/system reload
|
||||
|
||||
## 设置防火墙wan 打开,方便主路由访问
|
||||
uci set firewall.@zone[1].input='ACCEPT'
|
||||
uci commit firewall
|
||||
|
||||
}
|
||||
|
||||
## 安装应用商店和主题
|
||||
install_istore_os_style() {
|
||||
##设置Argon 紫色主题
|
||||
do_install_argon_skin
|
||||
#增加首页终端图标
|
||||
opkg install ttyd
|
||||
#默认使用体积很小的文件传输:系统——文件传输
|
||||
do_install_filetransfer
|
||||
#默认安装必备工具SFTP 方便下载文件 比如finalshell等工具可以直接浏览路由器文件
|
||||
is-opkg install app-meta-sftp
|
||||
is-opkg install 'app-meta-ddnsto'
|
||||
# 安装磁盘管理
|
||||
is-opkg install 'app-meta-diskman'
|
||||
FILE_PATH="/etc/openwrt_release"
|
||||
NEW_DESCRIPTION="Openwrt like iStoreOS Style by wukongdaily"
|
||||
CONTENT=$(cat $FILE_PATH)
|
||||
UPDATED_CONTENT=$(echo "$CONTENT" | sed "s/DISTRIB_DESCRIPTION='[^']*'/DISTRIB_DESCRIPTION='$NEW_DESCRIPTION'/")
|
||||
echo "$UPDATED_CONTENT" >$FILE_PATH
|
||||
|
||||
}
|
||||
# 安装iStore 参考 https://github.com/linkease/istore
|
||||
do_istore() {
|
||||
echo "do_istore method==================>"
|
||||
ISTORE_REPO=https://istore.linkease.com/repo/all/store
|
||||
FCURL="curl --fail --show-error"
|
||||
|
||||
curl -V >/dev/null 2>&1 || {
|
||||
echo "prereq: install curl"
|
||||
opkg info curl | grep -Fqm1 curl || opkg update
|
||||
opkg install curl
|
||||
}
|
||||
|
||||
IPK=$($FCURL "$ISTORE_REPO/Packages.gz" | zcat | grep -m1 '^Filename: luci-app-store.*\.ipk$' | sed -n -e 's/^Filename: \(.\+\)$/\1/p')
|
||||
|
||||
[ -n "$IPK" ] || exit 1
|
||||
|
||||
$FCURL "$ISTORE_REPO/$IPK" | tar -xzO ./data.tar.gz | tar -xzO ./bin/is-opkg >/tmp/is-opkg
|
||||
|
||||
[ -s "/tmp/is-opkg" ] || exit 1
|
||||
|
||||
chmod 755 /tmp/is-opkg
|
||||
/tmp/is-opkg update
|
||||
# /tmp/is-opkg install taskd
|
||||
/tmp/is-opkg opkg install --force-reinstall luci-lib-taskd luci-lib-xterm
|
||||
/tmp/is-opkg opkg install --force-reinstall luci-app-store || exit $?
|
||||
[ -s "/etc/init.d/tasks" ] || /tmp/is-opkg opkg install --force-reinstall taskd
|
||||
[ -s "/usr/lib/lua/luci/cbi.lua" ] || /tmp/is-opkg opkg install luci-compat >/dev/null 2>&1
|
||||
|
||||
}
|
||||
|
||||
#设置风扇工作温度
|
||||
setup_cpu_fans() {
|
||||
#设定温度阀值,cpu高于48度,则风扇开始工作
|
||||
uci set glfan.@globals[0].temperature=50
|
||||
uci set glfan.@globals[0].warn_temperature=50
|
||||
uci set glfan.@globals[0].integration=4
|
||||
uci set glfan.@globals[0].differential=20
|
||||
uci commit glfan
|
||||
/etc/init.d/gl_fan restart
|
||||
}
|
||||
|
||||
# 判断系统是否为iStoreOS
|
||||
is_iStoreOS() {
|
||||
DISTRIB_ID=$(cat /etc/openwrt_release | grep "DISTRIB_ID" | cut -d "'" -f 2)
|
||||
# 检查DISTRIB_ID的值是否等于'iStoreOS'
|
||||
if [ "$DISTRIB_ID" = "iStoreOS" ]; then
|
||||
return 0 # true
|
||||
else
|
||||
return 1 # false
|
||||
fi
|
||||
}
|
||||
|
||||
## 去除opkg签名
|
||||
remove_check_signature_option() {
|
||||
local opkg_conf="/etc/opkg.conf"
|
||||
sed -i '/option check_signature/d' "$opkg_conf"
|
||||
}
|
||||
|
||||
## 添加opkg签名
|
||||
add_check_signature_option() {
|
||||
local opkg_conf="/etc/opkg.conf"
|
||||
echo "option check_signature 1" >>"$opkg_conf"
|
||||
}
|
||||
|
||||
#设置第三方软件源
|
||||
setup_software_source() {
|
||||
## 传入0和1 分别代表原始和第三方软件源
|
||||
if [ "$1" -eq 0 ]; then
|
||||
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
|
||||
##如果是iStoreOS系统,还原软件源之后,要添加签名
|
||||
if is_iStoreOS; then
|
||||
add_check_signature_option
|
||||
else
|
||||
echo
|
||||
fi
|
||||
# 还原软件源之后更新
|
||||
opkg update
|
||||
elif [ "$1" -eq 1 ]; then
|
||||
#传入1 代表设置第三方软件源 先要删掉签名
|
||||
remove_check_signature_option
|
||||
# 先删除再添加以免重复
|
||||
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
|
||||
echo "src/gz third_party_source $third_party_source" >>/etc/opkg/customfeeds.conf
|
||||
# 设置第三方源后要更新
|
||||
opkg update
|
||||
else
|
||||
echo "Invalid option. Please provide 0 or 1."
|
||||
fi
|
||||
}
|
||||
|
||||
# 添加主机名映射(解决安卓原生TV首次连不上wifi的问题)
|
||||
add_dhcp_domain() {
|
||||
local domain_name="time.android.com"
|
||||
local domain_ip="203.107.6.88"
|
||||
|
||||
# 检查是否存在相同的域名记录
|
||||
existing_records=$(uci show dhcp | grep "dhcp.@domain\[[0-9]\+\].name='$domain_name'")
|
||||
if [ -z "$existing_records" ]; then
|
||||
# 添加新的域名记录
|
||||
uci add dhcp domain
|
||||
uci set "dhcp.@domain[-1].name=$domain_name"
|
||||
uci set "dhcp.@domain[-1].ip=$domain_ip"
|
||||
uci commit dhcp
|
||||
else
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
#添加出处信息
|
||||
add_author_info() {
|
||||
uci set system.@system[0].description='wukongdaily'
|
||||
uci set system.@system[0].notes='文档说明:
|
||||
https://tvhelper.cpolar.cn/'
|
||||
uci commit system
|
||||
}
|
||||
|
||||
##获取软路由型号信息
|
||||
get_router_name() {
|
||||
model_info=$(cat /tmp/sysinfo/model)
|
||||
echo "$model_info"
|
||||
}
|
||||
|
||||
get_router_hostname() {
|
||||
hostname=$(uci get system.@system[0].hostname)
|
||||
echo "$hostname 路由器"
|
||||
}
|
||||
|
||||
add_custom_feed() {
|
||||
# 先清空配置
|
||||
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
|
||||
# Prompt the user to enter the feed URL
|
||||
echo "请输入自定义软件源的地址(通常是https开头 aarch64_cortex-a53 结尾):"
|
||||
read feed_url
|
||||
if [ -n "$feed_url" ]; then
|
||||
echo "src/gz custom_feed $feed_url" >>/etc/opkg/customfeeds.conf
|
||||
opkg update
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "已添加并更新列表."
|
||||
else
|
||||
echo "已添加但更新失败,请检查网络或重试."
|
||||
fi
|
||||
else
|
||||
echo "Error: Feed URL not provided. No changes were made."
|
||||
fi
|
||||
}
|
||||
|
||||
remove_custom_feed() {
|
||||
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
|
||||
opkg update
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "已删除并更新列表."
|
||||
else
|
||||
echo "已删除了自定义软件源但更新失败,请检查网络或重试."
|
||||
fi
|
||||
}
|
||||
|
||||
# 检查是否安装了 whiptail
|
||||
check_whiptail_installed() {
|
||||
if [ -e /usr/bin/whiptail ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
#定义一个通用的Dialog
|
||||
show_whiptail_dialog() {
|
||||
#判断是否具备whiptail dialog组件
|
||||
if check_whiptail_installed; then
|
||||
echo "whiptail has installed"
|
||||
else
|
||||
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
|
||||
opkg update
|
||||
opkg install whiptail
|
||||
fi
|
||||
local title="$1"
|
||||
local message="$2"
|
||||
local function_definition="$3"
|
||||
whiptail --title "$title" --yesno "$message" 15 60 --yes-button "是" --no-button "否"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "$function_definition"
|
||||
else
|
||||
echo "退出"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
# 执行重启操作
|
||||
do_reboot() {
|
||||
reboot
|
||||
}
|
||||
|
||||
#提示用户要重启
|
||||
show_reboot_tips() {
|
||||
reboot_code='do_reboot'
|
||||
show_whiptail_dialog "重启提醒" " $(get_router_hostname)\n 一键风格化运行完成.\n 为了更好的清理临时缓存,\n 您是否要重启路由器?" "$reboot_code"
|
||||
}
|
||||
|
||||
#自定义风扇开始工作的温度
|
||||
set_glfan_temp() {
|
||||
|
||||
is_integer() {
|
||||
if [[ $1 =~ ^[0-9]+$ ]]; then
|
||||
return 0 # 是整数
|
||||
else
|
||||
return 1 # 不是整数
|
||||
fi
|
||||
}
|
||||
echo "兼容带风扇机型的GL-iNet路由器"
|
||||
echo "请输入风扇开始工作的温度(建议40-70之间的整数):"
|
||||
read temp
|
||||
|
||||
if is_integer "$temp"; then
|
||||
uci set glfan.@globals[0].temperature="$temp"
|
||||
uci set glfan.@globals[0].warn_temperature="$temp"
|
||||
uci set glfan.@globals[0].integration=4
|
||||
uci set glfan.@globals[0].differential=20
|
||||
uci commit glfan
|
||||
/etc/init.d/gl_fan restart
|
||||
echo "设置成功!稍等片刻,请查看风扇转动情况"
|
||||
else
|
||||
echo "错误: 请输入整数."
|
||||
fi
|
||||
}
|
||||
|
||||
recovery_opkg_settings() {
|
||||
echo "# add your custom package feeds here" >/etc/opkg/customfeeds.conf
|
||||
router_name=$(get_router_name)
|
||||
case "$router_name" in
|
||||
*3000*)
|
||||
echo "Router name contains '3000'."
|
||||
mt3000_opkg="$HTTP_HOST/mt-3000/distfeeds.conf"
|
||||
wget -O /etc/opkg/distfeeds.conf ${mt3000_opkg}
|
||||
;;
|
||||
*2500*)
|
||||
echo "Router name contains '2500'."
|
||||
mt2500a_opkg="$HTTP_HOST/mt-2500a/distfeeds.conf"
|
||||
wget -O /etc/opkg/distfeeds.conf ${mt2500a_opkg}
|
||||
;;
|
||||
*6000*)
|
||||
update_opkg_config
|
||||
;;
|
||||
*)
|
||||
echo "Router name does not contain '3000' 6000 or '2500'."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
update_opkg_config() {
|
||||
kernel_version=$(uname -r)
|
||||
echo "MT-6000 kernel version: $kernel_version"
|
||||
case $kernel_version in
|
||||
5.4*)
|
||||
mt6000_opkg="$HTTP_HOST/mt-6000/distfeeds-5.4.conf"
|
||||
wget -O /etc/opkg/distfeeds.conf ${mt6000_opkg}
|
||||
# 更换5.4.238 内核之后 缺少的依赖
|
||||
|
||||
mkdir -p /tmp/mt6000
|
||||
wget --user-agent="Mozilla/5.0" -O /tmp/mt6000/script-utils.ipk "$HTTP_HOST/mt-6000/script-utils.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O /tmp/mt6000/mdadm.ipk "$HTTP_HOST/mt-6000/mdadm.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O /tmp/mt6000/lsblk.ipk "$HTTP_HOST/mt-6000/lsblk.ipk"
|
||||
opkg update
|
||||
if [ -f "/tmp/mt6000/lsblk.ipk" ]; then
|
||||
# 先卸载之前安装过的lsblk,确保使用的是正确的lsblk
|
||||
opkg remove lsblk
|
||||
fi
|
||||
opkg install /tmp/mt6000/*.ipk
|
||||
;;
|
||||
5.15*)
|
||||
mt6000_opkg="$HTTP_HOST/mt-6000/distfeeds.conf"
|
||||
wget -O /etc/opkg/distfeeds.conf ${mt6000_opkg}
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported kernel version: $kernel_version"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
do_luci_app_wireguard() {
|
||||
setup_software_source 0
|
||||
opkg install luci-app-wireguard
|
||||
opkg install luci-i18n-wireguard-zh-cn
|
||||
echo "请访问 http://"$(uci get network.lan.ipaddr)"/cgi-bin/luci/admin/status/wireguard 查看状态 "
|
||||
echo "也可以去接口中 查看是否增加了新的wireguard 协议的选项 "
|
||||
}
|
||||
update_luci_app_quickstart() {
|
||||
if [ -f "/bin/is-opkg" ]; then
|
||||
# 如果 /bin/is-opkg 存在,则执行 is-opkg update
|
||||
is-opkg update
|
||||
is-opkg install luci-i18n-quickstart-zh-cn --force-depends >/dev/null 2>&1
|
||||
opkg install iptables-mod-tproxy
|
||||
opkg install iptables-mod-socket
|
||||
opkg install iptables-mod-iprange
|
||||
green "正在更新到最新版iStoreOS首页风格 "
|
||||
TMPATH=/tmp/qstart
|
||||
mkdir -p ${TMPATH}
|
||||
app_aarch64='quickstart_0.11.7-1_aarch64_cortex-a53.ipk'
|
||||
app_ui='luci-app-quickstart_0.11.7-r1_all.ipk'
|
||||
app_lng='luci-i18n-quickstart-zh-cn_git-25.283.23675-635149e_all.ipk'
|
||||
wget $HTTP_HOST/newquickstart/$app_aarch64 -O ${TMPATH}/$app_aarch64
|
||||
wget $HTTP_HOST/newquickstart/$app_ui -O ${TMPATH}/$app_ui
|
||||
wget $HTTP_HOST/newquickstart/$app_lng -O ${TMPATH}/$app_lng
|
||||
opkg install ${TMPATH}/*.ipk
|
||||
rm -rf ${TMPATH}
|
||||
hide_ui_elements
|
||||
yellow "恭喜您!现在你的路由器已经变成iStoreOS风格啦!"
|
||||
green "现在您可以访问8080端口 查看是否生效 http://192.168.8.1:8080"
|
||||
green "更多up主项目和动态 请务必收藏我的导航站 https://tvhelper.cpolar.cn "
|
||||
green "赞助本项目作者 https://wkdaily.cpolar.cn/01 "
|
||||
addr_hostname=$(uci get system.@system[0].hostname)
|
||||
else
|
||||
red "请先执行第一项 一键iStoreOS风格化"
|
||||
fi
|
||||
}
|
||||
|
||||
# 安装体积非常小的文件传输软件 默认上传位置/tmp/upload/
|
||||
do_install_filetransfer() {
|
||||
mkdir -p /tmp/luci-app-filetransfer/
|
||||
cd /tmp/luci-app-filetransfer/
|
||||
wget --user-agent="Mozilla/5.0" -O luci-app-filetransfer_all.ipk "$HTTP_HOST/luci-app-filetransfer/luci-app-filetransfer_all.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O luci-lib-fs_1.0-14_all.ipk "$HTTP_HOST/luci-app-filetransfer/luci-lib-fs_1.0-14_all.ipk"
|
||||
opkg install *.ipk --force-depends
|
||||
}
|
||||
do_install_depends_ipk() {
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/luci-lua-runtime_all.ipk" "$HTTP_HOST/theme/luci-lua-runtime_all.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/libopenssl3.ipk" "$HTTP_HOST/theme/libopenssl3.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/luci-compat.ipk" "$HTTP_HOST/theme/luci-compat.ipk"
|
||||
opkg install "/tmp/luci-lua-runtime_all.ipk"
|
||||
opkg install "/tmp/libopenssl3.ipk"
|
||||
opkg install "/tmp/luci-compat.ipk"
|
||||
}
|
||||
#单独安装argon主题
|
||||
do_install_argon_skin() {
|
||||
echo "正在尝试安装argon主题......."
|
||||
#下载和安装argon的依赖
|
||||
do_install_depends_ipk
|
||||
# bug fix 由于2.3.1 最新版的luci-argon-theme 登录按钮没有中文匹配,而2.3版本字体不对。
|
||||
# 所以这里安装上一个版本2.2.9,考虑到主题皮肤并不需要长期更新,因此固定版本没问题
|
||||
opkg update
|
||||
opkg install luci-lib-ipkg
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/luci-theme-argon.ipk" "$HTTP_HOST/theme/luci-theme-argon-master_2.2.9.4_all.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/luci-app-argon-config.ipk" "$HTTP_HOST/theme/luci-app-argon-config_0.9_all.ipk"
|
||||
wget --user-agent="Mozilla/5.0" -O "/tmp/luci-i18n-argon-config-zh-cn.ipk" "$HTTP_HOST/theme/luci-i18n-argon-config-zh-cn.ipk"
|
||||
cd /tmp/
|
||||
opkg install luci-theme-argon.ipk luci-app-argon-config.ipk luci-i18n-argon-config-zh-cn.ipk
|
||||
# 检查上一个命令的返回值
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "argon主题 安装成功"
|
||||
# 设置主题和语言
|
||||
uci set luci.main.mediaurlbase='/luci-static/argon'
|
||||
uci set luci.main.lang='zh_cn'
|
||||
uci commit
|
||||
echo "重新登录web页面后, 查看新主题 "
|
||||
else
|
||||
echo "argon主题 安装失败! 建议再执行一次!再给我一个机会!事不过三!"
|
||||
fi
|
||||
}
|
||||
|
||||
#单独安装文件管理器
|
||||
do_install_filemanager() {
|
||||
echo "为避免bug,安装文件管理器之前,需要先iStore商店"
|
||||
do_istore
|
||||
echo "接下来 尝试安装文件管理器......."
|
||||
is-opkg install 'app-meta-linkease'
|
||||
echo "重新登录web页面,然后您可以访问: http://192.168.8.1/cgi-bin/luci/admin/services/linkease/file/?path=/root"
|
||||
}
|
||||
#更新脚本
|
||||
update_myself() {
|
||||
wget -O gl-inet.sh "$HTTP_HOST/gl-inet.sh" && chmod +x gl-inet.sh
|
||||
echo "脚本已更新并保存在当前目录 gl-inet.sh,现在将执行新脚本。"
|
||||
./gl-inet.sh
|
||||
exit 0
|
||||
}
|
||||
|
||||
#根据release地址和命名前缀获取apk地址
|
||||
get_docker_compose_url() {
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "需要提供GitHub releases页面的URL作为参数。"
|
||||
return 1
|
||||
fi
|
||||
local releases_url=$1
|
||||
# 使用curl获取重定向的URL
|
||||
latest_url=$(curl -Ls -o /dev/null -w "%{url_effective}" "$releases_url")
|
||||
# 使用sed从URL中提取tag值,并保留前导字符'v'
|
||||
tag=$(echo $latest_url | sed 's|.*/v|v|')
|
||||
# 检查是否成功获取到tag
|
||||
if [ -z "$tag" ]; then
|
||||
echo "未找到最新的release tag。"
|
||||
return 1
|
||||
fi
|
||||
# 拼接docker-compose下载链接
|
||||
local repo_path=$(echo "$releases_url" | sed -n 's|https://github.com/\(.*\)/releases/latest|\1|p')
|
||||
docker_compose_download_url="https://github.com/${repo_path}/releases/download/${tag}/docker-compose-linux-aarch64"
|
||||
echo "$docker_compose_download_url"
|
||||
}
|
||||
|
||||
# 下载并安装Docker Compose
|
||||
do_install_docker_compose() {
|
||||
# https://github.com/docker/compose/releases/download/v2.26.0/docker-compose-linux-aarch64
|
||||
# 检查/usr/bin/docker是否存在并且可执行
|
||||
if [ -f "/usr/bin/docker" ] && [ -x "/usr/bin/docker" ]; then
|
||||
echo "Docker is installed and has execute permissions."
|
||||
else
|
||||
red "警告 您还没有安装Docker"
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$gl_name" == *3000* ]]; then
|
||||
red "警告 docker-compose 组件的大小将近60MB,请谨慎安装"
|
||||
yellow "确定要继续安装吗(y|n)"
|
||||
read -r answer
|
||||
if [ "$answer" = "y" ] || [ -z "$answer" ]; then
|
||||
green "正在获取最新版docker-compose下载地址"
|
||||
else
|
||||
yellow "已退出docker-compose安装流程"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
local github_releases_url="https://github.com/docker/compose/releases/latest"
|
||||
local docker_compose_url=$(get_docker_compose_url "$github_releases_url")
|
||||
echo "最新版docker-compose 地址:$docker_compose_url"
|
||||
wget -O /usr/bin/docker-compose $docker_compose_url
|
||||
if [ $? -eq 0 ]; then
|
||||
green "docker-compose下载并安装成功,你可以使用啦"
|
||||
chmod +x /usr/bin/docker-compose
|
||||
else
|
||||
red "安装失败,请检查网络连接.或者手动下载到 /usr/bin/docker-compose 记得赋予执行权限"
|
||||
yellow "刚才使用的地址是:$docker_compose_url"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
#mt3000更换分区
|
||||
mt3000_overlay_changed() {
|
||||
wget -O mt3000.sh "$HTTP_HOST/mt-3000/mt3000.sh" && chmod +x mt3000.sh
|
||||
sh mt3000.sh
|
||||
}
|
||||
|
||||
# 防止误操作 隐藏首页无用的元素
|
||||
hide_ui_elements() {
|
||||
|
||||
TARGET="/www/luci-static/quickstart/style.css"
|
||||
MARKER="/* hide custom luci elements */"
|
||||
|
||||
# 如果没有追加过,就添加
|
||||
if ! grep -q "$MARKER" "$TARGET"; then
|
||||
cat <<EOF >>"$TARGET"
|
||||
|
||||
$MARKER
|
||||
/* 隐藏首页格式化按钮 */
|
||||
.value-data button {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏网络页的第 3 个 item */
|
||||
#main > div > div.network-container.align-c > div > div > div:nth-child(3) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏网络页的第 5 个 item */
|
||||
#main > div > div.network-container.align-c > div > div > div:nth-child(5) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏 feature-card.pink */
|
||||
#main > div > div.card-container > div.feature-card.pink {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
EOF
|
||||
echo "✅ 自定义元素已隐藏"
|
||||
else
|
||||
echo "⚠️ 无需重复操作"
|
||||
fi
|
||||
}
|
||||
|
||||
# 启用adguardhome
|
||||
toggle_adguardhome() {
|
||||
status=$(uci get adguardhome.config.enabled)
|
||||
|
||||
if [ "$status" -eq 1 ]; then
|
||||
echo "Disabling AdGuardHome..."
|
||||
uci set adguardhome.config.enabled='0' >/dev/null 2>&1
|
||||
uci commit adguardhome >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome disable >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome stop >/dev/null 2>&1
|
||||
green "AdGuardHome 已关闭"
|
||||
else
|
||||
echo "Enabling AdGuardHome..."
|
||||
uci set adguardhome.config.enabled='1' >/dev/null 2>&1
|
||||
uci commit adguardhome >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome enable >/dev/null 2>&1
|
||||
/etc/init.d/adguardhome start >/dev/null 2>&1
|
||||
green "AdGuardHome 已开启 访问 http://192.168.8.1:3000"
|
||||
fi
|
||||
}
|
||||
|
||||
# 安装[官方辅助UI]插件 by 论坛 iBelieve
|
||||
do_install_ui_helper() {
|
||||
|
||||
echo "⚠️ 请您确保当前固件版本大于 4.7.0,若低于此版本建议先升级。"
|
||||
read -p "👉 如果您已确认,请按 [回车] 继续;否则按 Ctrl+C 或输入任意内容后回车退出:" user_input
|
||||
|
||||
if [ -n "$user_input" ]; then
|
||||
echo "🚫 用户取消安装。"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local ipk_file="/tmp/glinjector_3.0.5-6_all.ipk"
|
||||
local sha_file="${ipk_file}.sha256"
|
||||
|
||||
echo "📥 正在下载 IPK 及 SHA256 校验文件..."
|
||||
wget -O "$sha_file" "$HTTP_HOST/ui/glinjector_3.0.5-6_all.ipk.sha256" || {
|
||||
echo "❌ 下载 SHA256 文件失败"
|
||||
return 1
|
||||
}
|
||||
|
||||
wget --user-agent="Mozilla/5.0" -O "$ipk_file" "$HTTP_HOST/ui/glinjector_3.0.5-6_all.ipk" || {
|
||||
echo "❌ 下载 IPK 文件失败"
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "🔐 正在进行 SHA256 校验..."
|
||||
|
||||
cd "$(dirname "$ipk_file")"
|
||||
sha256sum -c "$sha_file" || {
|
||||
echo "❌ 校验失败:文件已损坏或未完整下载"
|
||||
rm -f "$ipk_file"
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "✅ 校验通过,开始安装..."
|
||||
|
||||
opkg update
|
||||
opkg install "$ipk_file"
|
||||
}
|
||||
|
||||
#高级卸载
|
||||
advanced_uninstall(){
|
||||
echo "📥 正在下载 高级卸载插件..."
|
||||
wget -O /tmp/advanced_uninstall.run $HTTP_HOST/luci-app-uninstall.run && chmod +x /tmp/advanced_uninstall.run
|
||||
sh /tmp/advanced_uninstall.run
|
||||
}
|
||||
|
||||
while true; do
|
||||
clear
|
||||
gl_name=$(get_router_name)
|
||||
result=$gl_name"一键iStoreOS风格化(新版)"
|
||||
result=$(echo "$result" | sed 's/ like iStoreOS//')
|
||||
echo "***********************************************************************"
|
||||
echo "* 一键安装工具箱(for gl-inet Router)"
|
||||
echo "* 20251118 by @wukongdaily "
|
||||
echo "**********************************************************************"
|
||||
echo "* 当前的路由器型号: "$gl_name | sed 's/ like iStoreOS//'
|
||||
echo
|
||||
echo "*******支持的机型列表***************************************************"
|
||||
green "*******GL-iNet MT-2500A"
|
||||
green "*******GL-iNet MT-3000 "
|
||||
green "*******GL-iNet MT-6000 "
|
||||
echo "******************下次调用 直接输入快捷键 g *****************************"
|
||||
echo
|
||||
light_magenta " 1. $result"
|
||||
echo
|
||||
echo " 2. 设置自定义软件源"
|
||||
echo " 3. 删除自定义软件源"
|
||||
echo
|
||||
echo " 4. 设置风扇开始工作的温度(仅限MT3000)"
|
||||
echo " 5. 恢复原厂OPKG配置软件包"
|
||||
echo
|
||||
echo " 6. 启用/关闭原厂adguardhome"
|
||||
echo " 7. 安装luci-app-wireguard"
|
||||
echo " 8. 更新luci-app-quickstart"
|
||||
echo " 9. 安装Argon紫色主题"
|
||||
echo "10. 安装文件管理器"
|
||||
light_magenta "11. 安装Docker"
|
||||
light_magenta "12. 安装docker-compose"
|
||||
light_magenta "13. 更新脚本"
|
||||
cyan "14. MT3000一键更换分区"
|
||||
light_magenta "15. 隐藏首页非必要UI元素"
|
||||
light_magenta "16. 安装个性化UI辅助插件(by VMatrices)"
|
||||
light_magenta "17. 安装高级卸载插件"
|
||||
echo
|
||||
echo " Q. 退出本程序"
|
||||
echo
|
||||
read -p "请选择一个选项: " choice
|
||||
|
||||
case $choice in
|
||||
|
||||
1)
|
||||
if [[ "$gl_name" == *3000* ]]; then
|
||||
# 设置风扇工作温度
|
||||
setup_cpu_fans
|
||||
fi
|
||||
# 解决首页“已联网”的UI问题
|
||||
recovery_opkg_settings
|
||||
#先安装istore商店
|
||||
do_istore
|
||||
#安装iStore风格
|
||||
install_istore_os_style
|
||||
#安装iStore首页风格
|
||||
update_luci_app_quickstart
|
||||
#基础必备设置
|
||||
setup_base_init
|
||||
;;
|
||||
2)
|
||||
add_custom_feed
|
||||
;;
|
||||
3)
|
||||
remove_custom_feed
|
||||
;;
|
||||
4)
|
||||
case "$gl_name" in
|
||||
*3000*)
|
||||
set_glfan_temp
|
||||
;;
|
||||
*)
|
||||
echo "* 当前的路由器型号: "$gl_name | sed 's/ like iStoreOS//'
|
||||
echo "并非MT3000 它没有风扇 无需设置"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
5)
|
||||
recovery_opkg_settings
|
||||
;;
|
||||
6)
|
||||
toggle_adguardhome
|
||||
;;
|
||||
7)
|
||||
do_luci_app_wireguard
|
||||
;;
|
||||
8)
|
||||
update_luci_app_quickstart
|
||||
;;
|
||||
9)
|
||||
do_install_argon_skin
|
||||
;;
|
||||
10)
|
||||
do_install_filemanager
|
||||
;;
|
||||
11)
|
||||
yellow "注意!插入U盘之前请确认U盘数据已备份"
|
||||
red "确定要继续吗(y|n)"
|
||||
read -r answer
|
||||
if [ "$answer" = "y" ] || [ -z "$answer" ]; then
|
||||
wget -q -O do_docker.sh "$HTTP_HOST/docker/do_docker.sh" && chmod +x do_docker.sh
|
||||
./do_docker.sh
|
||||
else
|
||||
yellow "已退出Docker安装流程"
|
||||
fi
|
||||
;;
|
||||
12)
|
||||
do_install_docker_compose
|
||||
;;
|
||||
13)
|
||||
update_myself
|
||||
;;
|
||||
14)
|
||||
mt3000_overlay_changed
|
||||
;;
|
||||
15)
|
||||
hide_ui_elements
|
||||
;;
|
||||
16)
|
||||
do_install_ui_helper
|
||||
;;
|
||||
17)
|
||||
advanced_uninstall
|
||||
;;
|
||||
q | Q)
|
||||
echo "退出"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "无效选项,请重新选择。"
|
||||
;;
|
||||
esac
|
||||
|
||||
read -p "按 Enter 键继续..."
|
||||
done
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>mt3000备用脚本</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/vue.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">加载中...</div>
|
||||
|
||||
<script>
|
||||
window.$docsify = {
|
||||
name: 'mt3000备用脚本',
|
||||
repo: '',
|
||||
|
||||
// 自动跳转的首页内容(默认就是 README.md)
|
||||
loadSidebar: true, // 启用侧边栏
|
||||
loadNavbar: true, // 启用顶部导航栏
|
||||
subMaxLevel: 2, // 支持多级标题
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
# mt-2500a /etc/opkg/distfeeds.conf
|
||||
src/gz glinet_base https://fw.gl-inet.cn/releases/v21.02.3/kmod-4.2.1/aarch64_cortex-a53/mediatek/mt7981
|
||||
src/gz glinet_gli_pub https://fw.gl-inet.cn/releases/v21.02.3/packages-4.0/aarch64_cortex-a53/glinet
|
||||
src/gz glinet_gli_packages https://fw.gl-inet.cn/releases/v21.02.3/packages-4.0/aarch64_cortex-a53/packages
|
||||
@@ -0,0 +1,7 @@
|
||||
# mt-3000 luci-24 /etc/opkg/distfeeds.conf
|
||||
src/gz core https://fw.gl-inet.cn/releases/v24.x/24.10.2/mediatek/filogic
|
||||
src/gz base https://downloads.openwrt.org/releases/24.10.2/packages/aarch64_cortex-a53/base
|
||||
src/gz luci https://downloads.openwrt.org/releases/24.10.2/packages/aarch64_cortex-a53/luci
|
||||
src/gz packages https://downloads.openwrt.org/releases/24.10.2/packages/aarch64_cortex-a53/packages
|
||||
src/gz routing https://downloads.openwrt.org/releases/24.10.2/packages/aarch64_cortex-a53/routing
|
||||
src/gz telephony https://downloads.openwrt.org/releases/24.10.2/packages/aarch64_cortex-a53/telephony
|
||||
@@ -0,0 +1,4 @@
|
||||
# mt-3000 /etc/opkg/distfeeds.conf
|
||||
src/gz glinet_base https://fw.gl-inet.cn/releases/v21.02.3/kmod-4.2.1/aarch64_cortex-a53/mediatek/mt7981
|
||||
src/gz glinet_gli_pub https://fw.gl-inet.cn/releases/v21.02.3/packages-4.0/aarch64_cortex-a53/glinet
|
||||
src/gz glinet_gli_packages https://fw.gl-inet.cn/releases/v21.02.3/packages-4.0/aarch64_cortex-a53/packages
|
||||
@@ -0,0 +1,254 @@
|
||||
#!/bin/sh
|
||||
# 定义颜色输出函数
|
||||
red() { echo -e "\033[31m\033[01m$1\033[0m"; }
|
||||
green() { echo -e "\033[32m\033[01m$1\033[0m"; }
|
||||
greeninfo() { echo -e "\033[32m\033[01m[INFO] $1\033[0m"; }
|
||||
blueinfo() { echo -e "\033[32m\033[01m$1\033[0m"; }
|
||||
yellow() { echo -e "\033[33m\033[01m$1\033[0m"; }
|
||||
blue() { echo -e "\033[34m\033[01m$1\033[0m"; }
|
||||
light_magenta() { echo -e "\033[95m\033[01m$1\033[0m"; }
|
||||
light_yellow() { echo -e "\033[93m\033[01m$1\033[0m"; }
|
||||
purple() { echo -e "\033[38;5;141m$1\033[0m"; }
|
||||
cyan() { echo -e "\033[38;2;0;255;255m$1\033[0m"; }
|
||||
|
||||
install_depends_apps() {
|
||||
cyan "正在安装必备工具...."
|
||||
opkg update >/dev/null 2>&1
|
||||
for pkg in lsblk fdisk; do
|
||||
if opkg list-installed | grep -qw "$pkg"; then
|
||||
cyan "$pkg 已安装。"
|
||||
else
|
||||
if opkg install "$pkg" >/dev/null 2>&1; then
|
||||
green "$pkg 安装成功。"
|
||||
else
|
||||
red "$pkg 安装失败。"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# 卸载USB设备
|
||||
unmount_usb_device() {
|
||||
for mount in $(mount | grep "$1" | awk '{print $3}'); do
|
||||
yellow "正在尝试卸载U盘挂载点:$mount"
|
||||
umount $mount || {
|
||||
red "警告:无法卸载挂载点 $mount。可能有文件正在被访问或权限不足。"
|
||||
exit 1
|
||||
}
|
||||
blueinfo "U盘挂载点 $mount 卸载成功。"
|
||||
done
|
||||
}
|
||||
|
||||
create_and_format_partitions() {
|
||||
local device=$1
|
||||
# 使用fdisk -l获取设备的总容量(以字节为单位)并转换为GB
|
||||
local total_bytes=$(fdisk -l $device | grep "Disk $device:" | awk '{print $5}')
|
||||
local total_gb=$(echo "$total_bytes" | awk '{print int($1/(1024*1024*1024))}')
|
||||
|
||||
if [ -n "$CUSTOM_OPKG_SIZE" ]; then
|
||||
part1_gb=$CUSTOM_OPKG_SIZE
|
||||
yellow "U盘总容量约为 $total_gb GB,您设置的自定义软件包大小为 ${part1_gb}GB。"
|
||||
else
|
||||
# 计算10%的大小,以GB为单位
|
||||
part1_gb=$((total_gb / 10))
|
||||
yellow "U盘总容量约为 $total_gb GB,第一分区大小设置为U盘容量的10% 即 ${part1_gb}GB。"
|
||||
fi
|
||||
green "计划将第一分区分配给软件包 其大小为 ${part1_gb}GB"
|
||||
cyan "没错~你没有看错,让我们任性的告别 容 量 焦 虑!"
|
||||
# 创建分区并分配空间
|
||||
{
|
||||
echo g # 创建一个新的空DOS分区表
|
||||
echo n # 添加一个新分区
|
||||
echo p # 主分区
|
||||
echo 1 # 分区号1
|
||||
echo # 第一个可用扇区(默认)
|
||||
echo +${part1_gb}G # 为第一个分区分配计算出的GB数
|
||||
echo n # 添加第二个新分区
|
||||
echo p # 主分区
|
||||
echo 2 # 分区号2
|
||||
echo # 第一个可用扇区(默认,自动)
|
||||
echo # 最后一个扇区(默认,使用剩余空间)
|
||||
echo w # 写入并退出
|
||||
} | fdisk $device >/dev/null 2>&1
|
||||
|
||||
# 给系统一点时间来识别新分区
|
||||
sleep 5
|
||||
|
||||
# 格式化第一个分区为EXT4
|
||||
local new_partition1="${device}1"
|
||||
cyan "正在将 $new_partition1 格式化为EXT4文件系统..."
|
||||
mkfs.ext4 -F $new_partition1 >/dev/null 2>&1
|
||||
cyan "$new_partition1 已成功格式化为EXT4文件系统。"
|
||||
green "第2分区 ${device}2 暂不格式化,未来您可分配给docker使用"
|
||||
}
|
||||
|
||||
# 换区到U盘
|
||||
change_overlay_usb() {
|
||||
install_depends_apps
|
||||
blueinfo "现在开始查找USB设备分区 请稍后......"
|
||||
local USB_PARTITION=$(lsblk -dn -o NAME,TRAN | awk '$2=="usb" {print "/dev/"$1; exit}')
|
||||
if [ -z "$USB_PARTITION" ]; then
|
||||
red "未找到USB磁盘。"
|
||||
exit 1
|
||||
fi
|
||||
yellow "找到USB磁盘 $USB_PARTITION"
|
||||
# 清零磁盘开始部分以清除分区表和文件系统签名
|
||||
dd if=/dev/zero of=$USB_PARTITION bs=1M count=10
|
||||
sync
|
||||
# 卸载所有与该磁盘相关的挂载点
|
||||
unmount_usb_device "$USB_PARTITION"
|
||||
red "正在将U盘${USB_PARTITION}分为2个区 ..."
|
||||
create_and_format_partitions "$USB_PARTITION"
|
||||
|
||||
# U盘分区的挂载点
|
||||
MOUNT_POINT="/mnt/usb_overlay"
|
||||
# 临时目录用于复制数据
|
||||
TMP_DIR="/tmp/overlay_backup"
|
||||
# 创建挂载点目录
|
||||
mkdir -p $MOUNT_POINT
|
||||
# 挂载U盘分区
|
||||
cyan "重新挂载第一分区 ${USB_PARTITION}1 到 $MOUNT_POINT"
|
||||
mount ${USB_PARTITION}1 $MOUNT_POINT >/dev/null 2>&1
|
||||
# 创建临时目录用于备份overlay数据
|
||||
mkdir -p $TMP_DIR
|
||||
# 复制当前overlay到临时目录
|
||||
cp -a /overlay/. $TMP_DIR
|
||||
# 将临时目录的数据复制到U盘
|
||||
blueinfo "正在拷贝 当前系统文件到U盘"
|
||||
cp -a $TMP_DIR/. $MOUNT_POINT
|
||||
# 更新fstab配置,以便在启动时自动挂载U盘为overlay
|
||||
blueinfo "正在更新启动时的配置文件"
|
||||
uci set fstab.overlay=mount
|
||||
uci set fstab.overlay.uuid="$(blkid -o value -s UUID ${USB_PARTITION}1)"
|
||||
uci set fstab.overlay.target="/overlay"
|
||||
uci commit fstab
|
||||
# 清理临时目录
|
||||
rm -rf $TMP_DIR
|
||||
cp /etc/config/fstab $MOUNT_POINT/fstab.bak
|
||||
cyan "overlay更换分区完成 重启验证是否成功."
|
||||
red "是否立即重启?(y/n)"
|
||||
read -r answer
|
||||
if [ "$answer" = "y" ] || [ -z "$answer" ]; then
|
||||
red "正在重启..."
|
||||
reboot
|
||||
else
|
||||
yellow "您选择了不重启"
|
||||
fi
|
||||
}
|
||||
|
||||
check_overlay_size() {
|
||||
# 使用df命令获取/overlay分区的总大小(以1K块为单位)
|
||||
OVERLAY_SIZE=$(df /overlay | awk '/\/overlay/{print $2}')
|
||||
# 将1GB转换为1K块单位,即1GB = 1*1024*1024 1K块
|
||||
ONE_GB_IN_1K_BLOCKS=$((1024 * 1024))
|
||||
# 比较/overlay分区的大小是否大于1GB
|
||||
if [ "$OVERLAY_SIZE" -gt "$ONE_GB_IN_1K_BLOCKS" ]; then
|
||||
yellow "检测到您已经换区到U盘啦,可以继续"
|
||||
else
|
||||
echo "您还没有换区到U盘,请先执行选项1."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 安装 Docker 和 dockerd
|
||||
install_docker() {
|
||||
check_overlay_size
|
||||
green "正在更新 OPKG 软件包..."
|
||||
opkg update >/dev/null 2>&1
|
||||
cyan "正在安装 Docker 及相关服务...请耐心等待一会...大约需要1-2分钟\n"
|
||||
opkg install luci-app-dockerman >/dev/null 2>&1
|
||||
opkg install luci-i18n-dockerman-zh-cn >/dev/null 2>&1
|
||||
opkg install dockerd --force-depends >/dev/null 2>&1
|
||||
cyan "Docker 运行环境部署完成 重启后生效\n"
|
||||
red "正在重启..."
|
||||
reboot
|
||||
}
|
||||
|
||||
# 重新绑定
|
||||
rebind_usb_overlay() {
|
||||
cyan "正在重新绑定U盘设备...."
|
||||
if opkg list-installed | grep -qw "lsblk"; then
|
||||
echo
|
||||
else
|
||||
opkg update >/dev/null 2>&1
|
||||
if opkg install "lsblk" >/dev/null 2>&1; then
|
||||
echo
|
||||
else
|
||||
red "$pkg 安装失败。"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
local USB_DEVICE=$(lsblk -dn -o NAME,RM,TYPE | awk '$2=="1" && $3=="disk" {print "/dev/"$1; exit}')
|
||||
if [ -z "$USB_DEVICE" ]; then
|
||||
red "未找到USB磁盘。"
|
||||
exit 1
|
||||
fi
|
||||
uci set fstab.overlay=mount
|
||||
uci set fstab.overlay.uuid="$(blkid -o value -s UUID ${USB_DEVICE}1)"
|
||||
uci set fstab.overlay.target="/overlay"
|
||||
uci commit fstab
|
||||
green "重新绑定成功! 重启后生效"
|
||||
red "正在重启..."
|
||||
reboot
|
||||
}
|
||||
|
||||
#自定义软件包的大小
|
||||
#默认为U盘容量的10%
|
||||
custom_package_size() {
|
||||
while :; do
|
||||
echo "请输入想分配的软件包的大小(数字,单位:GB):"
|
||||
read size
|
||||
# 检查输入是否为数字
|
||||
if [[ $size =~ ^[0-9]+$ ]]; then
|
||||
CUSTOM_OPKG_SIZE=$size
|
||||
yellow "已设置软件包大小为:$CUSTOM_OPKG_SIZE GB"
|
||||
green "接下来,您可以执行第一项啦"
|
||||
break # 跳出循环
|
||||
else
|
||||
red "错误: 请输入一个有效的数字。"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
while true; do
|
||||
clear
|
||||
echo "***********************************************************************"
|
||||
green " MT-3000 软件包更换分区助手 "
|
||||
echo "**********************************************************************"
|
||||
echo
|
||||
cyan " 1. MT-3000 一键更换overlay分区到U盘"
|
||||
cyan " 2. MT-3000 安装Docker"
|
||||
cyan " 3. 自定义设置软件包大小(GB)"
|
||||
light_yellow " 4. 重新绑定U盘"
|
||||
echo
|
||||
echo " Q. 退出本程序"
|
||||
echo
|
||||
read -p "请选择一个选项: " choice
|
||||
echo
|
||||
|
||||
case $choice in
|
||||
|
||||
1)
|
||||
change_overlay_usb
|
||||
;;
|
||||
2)
|
||||
install_docker
|
||||
;;
|
||||
3)
|
||||
custom_package_size
|
||||
;;
|
||||
4)
|
||||
rebind_usb_overlay
|
||||
;;
|
||||
|
||||
q | Q)
|
||||
echo "退出"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "无效选项,请重新选择。"
|
||||
;;
|
||||
esac
|
||||
read -p "按 Enter 键继续..."
|
||||
done
|
||||
@@ -0,0 +1,4 @@
|
||||
# mt-6000-5.4.238 backup /etc/opkg/distfeeds.conf
|
||||
src/gz glinet_base https://fw.gl-inet.cn/releases/mt798x/kmod-4.5.7/aarch64_cortex-a53/mediatek/mt7986
|
||||
src/gz glinet_gli_pub https://fw.gl-inet.cn/releases/mt798x/packages-4.5/aarch64_cortex-a53/glinet
|
||||
src/gz glinet_gli_packages https://fw.gl-inet.cn/releases/mt798x/packages-4.5/aarch64_cortex-a53/packages
|
||||
@@ -0,0 +1,4 @@
|
||||
# mt-6000 backup /etc/opkg/distfeeds.conf
|
||||
src/gz glinet_base https://fw.gl-inet.cn/releases/v23.05.0/kmod-4.5/aarch64_cortex-a53/mediatek/mt7986
|
||||
src/gz glinet_gli_pub https://fw.gl-inet.cn/releases/v23.05.0/packages-4.5/aarch64_cortex-a53/glinet
|
||||
src/gz glinet_packages https://fw.gl-inet.cn/releases/v23.05.0/packages-4.5/aarch64_cortex-a53/packages
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
## 安装iStore 参考 https://github.com/linkease/istore
|
||||
opkg update
|
||||
ISTORE_REPO=https://istore.linkease.com/repo/all/store
|
||||
FCURL="curl --fail --show-error"
|
||||
|
||||
curl -V >/dev/null 2>&1 || {
|
||||
echo "prereq: install curl"
|
||||
opkg info curl | grep -Fqm1 curl || opkg update
|
||||
opkg install curl
|
||||
}
|
||||
|
||||
IPK=$($FCURL "$ISTORE_REPO/Packages.gz" | zcat | grep -m1 '^Filename: luci-app-store.*\.ipk$' | sed -n -e 's/^Filename: \(.\+\)$/\1/p')
|
||||
|
||||
[ -n "$IPK" ] || exit 1
|
||||
|
||||
$FCURL "$ISTORE_REPO/$IPK" | tar -xzO ./data.tar.gz | tar -xzO ./bin/is-opkg >/tmp/is-opkg
|
||||
|
||||
[ -s "/tmp/is-opkg" ] || exit 1
|
||||
|
||||
chmod 755 /tmp/is-opkg
|
||||
/tmp/is-opkg update
|
||||
# /tmp/is-opkg install taskd
|
||||
/tmp/is-opkg opkg install --force-reinstall luci-lib-taskd luci-lib-xterm
|
||||
/tmp/is-opkg opkg install --force-reinstall luci-app-store || exit $?
|
||||
[ -s "/etc/init.d/tasks" ] || /tmp/is-opkg opkg install --force-reinstall taskd
|
||||
[ -s "/usr/lib/lua/luci/cbi.lua" ] || /tmp/is-opkg opkg install luci-compat >/dev/null 2>&1
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
89736459007d5fc6fe1ca0ba7cab46fff81771d994c4b08f61a6ccc4bb9d9a12 glinjector_3.0.5-6_all.ipk
|
||||
Reference in New Issue
Block a user