Full Code of ahmad1abbadi/darkos for AI

main ee48c639429e cached
21 files
145.8 KB
39.9k tokens
100 symbols
1 requests
Download .txt
Repository: ahmad1abbadi/darkos
Branch: main
Commit: ee48c639429e
Files: 21
Total size: 145.8 KB

Directory structure:
gitextract_ci32frji/

├── LICENSE
├── README.md
├── boost_launcher
├── cpu_boost.py
├── currently version.txt
├── darkos
├── darkos.py
├── debug-darkos.py
├── installO.sh
├── installOS.sh
├── installglibc.py
├── logo
├── new-update.py
├── photo.py
├── pip_fixer
├── run-darkos.py
├── setting-darkos.py
├── shutdown.sh
├── terminal_utility/
│   ├── colors.properties
│   └── darkos-motd.sh
└── update-darkos.py

================================================
FILE CONTENTS
================================================

================================================
FILE: LICENSE
================================================
                    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>.


================================================
FILE: README.md
================================================
![logo](img/logo.png "logo")

**Darkos** is a project designed to run Windows x86_64 applications and games in [Termux](https://github.com/termux/termux-app) native GLIBC.
It utilizes [Box86](https://github.com/ptitSeb/box86)
and [Box64](https://github.com/ptitSeb/box86)
to run [Wine](https://www.winehq.org/) on android.

# Installation:
1. Install
[Termux](https://github.com/termux/termux-app),
[Termux-X11](https://github.com/ahmad1abbadi/extra/releases/download/apps/termux-x11.apk) and
[Input Bridge v0.1.9.9](https://github.com/ahmad1abbadi/extra/releases/download/apps/InputBridge_v0.1.9.9.apk) or [Input Bridge v0.0.7](https://github.com/ahmad1abbadi/extra/releases/download/apps/input+bridge+0.0.7.apk)
or 
[X input Bridge](https://github.com/ahmad1abbadi/extra/releases/download/apps/XinputBridge.apk)
for using game controller (Bluetooth/ usb) inside wine.

1. Open Termux and paste the following command:
```bash
curl -o install https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/installOS.sh && chmod +x install && ./install
```

3. **Darkos** will automatically start after installation is complete.
   Remember each time you open Termux, Darkos will auto-start.
   
   To exit **Darkos** and use Termux normally, press '1' within the first 4 seconds. Otherwise, Darkos will start and run Wine + Termux-X11.
   
# Features:
1. Native Gstreamer support, which is required for games like:
* resident evil 7
* devil may cry 5
* amid evil
2. Dedicated configuration app
3. Many games will work without altering box64 dynarec settings

  And many more, you can discover by your self.
  
# Configuration:

## Box64/Box86 Configuration + Dynarec
The configuration can be easily done from the Darkos configuration app. Simply modify the Box options, click "Apply," and then "Reboot" to apply the changes.

For more information about dynarec variables see [Box64 usage](https://github.com/ptitSeb/box64/blob/main/docs/USAGE.md) and [Box86 usage](https://github.com/ptitSeb/box86/blob/master/docs/USAGE.md)

## Update OS
This option updates Darkos to the latest version.

## Wine Manager 
Wine can be installed or uninstalled from the Darkos configuration embedded within Wine. Simply select the "Wine manager" option.

To select a Wine container, use the container dropdown menu from the Darkos configuration and then click "Change container."


## Debug Mode
This mode enables printing Wine and Box64 debug information to a log file located at /sdcard/darkos/darkos.log. You can share this file to our Telegram group.

## Toggle Mangohud
Mangohud is an on-screen display (OSD) that shows useful information like FPS, CPU usage, GPU load, and GPU temperature.

Currently, to see GPU load and temperature stats, you need to disable SELinux by running the following command in Termux(root is required):
```
su -c setenforce 0
```
To re-enable SELinux:

```
su -c setenforce 1
```

## GPU Driver Changer
This option allows you to change the GPU driver.

## Switch IB
This toggle lets you switch the input bridge between version 0.1.9.9 and version 0.0.7. Choose the version that works best for you.

## Kill Services
Use this toggle to kill services.exe without needing to open the task manager.

## Hit F5 key
This will open the task manager.

## DXVK changer 
This option lets you choose the DXVK version, allowing you to select the one that works best for a specific game.

## Install Tweaks
This option lets you install Wine tricks like apps, DLLs, and fonts.

## Personalize
You can change the theme, background, or resolution of the Wine desktop.

## Termux-X11 resolution 
The fallback resolution is only used when the X11 resolution cannot be detected automatically. The default fallback resolution is 800x600.

## Termux and termux-x11 preferences
### recommend setup for termux:
* `Allow apps to open new windows while running in the background`
* `Allow apps to display pop-up windows`

### recommend setup for termux-x11:
* `Display resolution mode` exact
* `Display resolution` 1280x720
* `Reseed Screen While Soft Keyboard is open` OFF
* `Fullscreen on device display` ON
* `Force Landscape orientation` ON
* `Hide display cutout` ON
* `Show additional keyboard` OFF
* `Prefer scancodes when possible` ON
* `Enable Accessibility service for intercepting
system shortcuts manually.` enable termux-x11 from android accessibility menu so you can use external keyboard (wired/wireless) without issues.
* `Enable Accessibility service for intercepting system shortcuts automatically.` ON

## Controls
For touch controls Input Bridge app is required.

## Support status
**Android 10 or higher is recommended.

### Device
* Most Android phones equipped with a Mali GPU can run DirectX 9 games using [Mesa VirGL](https://github.com/alexvorxx/Mesa-VirGL) . It is recommended to use a Snapdragon device with Adreno 6xx or Adreno 7xx for optimal performance and compatibility with Turnip and [DXVK](https://github.com/doitsujin/dxvk).

### Root
* Root is not required.

## Known issues
* termux app can show signal 9 when using wine or while compiling box64, in this case you have to disable android phantom process killer.
  
## Support Darkos
[buy me a coffee](https://www.buymeacoffee.com/AZabbadi)
#

## Darkos Developers 

[AZ](https://github.com/ahmad1abbadi) 

[Hisham](https://github.com/hisham2630)

[Md arif](https://github.com/sabamdarif)

[zhongerxll](https://github.com/zhongerxll) 

[Ilan12346-maya](https://github.com/Ilan12346-maya)
  
[GabiAle97](https://github.com/GabiAle97)

#

thanks to our testers:

GhostDz36, caoji080

#
Huge thanks to:

[airidosas252](https://github.com/airidosas252) for his turnip and wine builds.
#
Special thanks to ptitSeb, Maxython, glibc-runner, hardray, Tωaik, zhongerxll , hugo, .[jeezdisreez](https://github.com/Pipetto-crypto), olegos2 and others for help.

[Darkos telegram group](https://t.me/DARKOS4android)

## Third party applications

[glibc-packages](https://github.com/termux-pacman/glibc-packages)

[Box64](https://github.com/ptitSeb/box64)

[Box86](https://github.com/ptitSeb/box86)

[DXVK](https://github.com/doitsujin/dxvk)

[DXVK-ASYNC](https://github.com/Sporif/dxvk-async)

[DXVK-GPLASYNC](https://gitlab.com/Ph42oN/dxvk-gplasync)

[VKD3D](https://github.com/lutris/vkd3d)

[D8VK](https://github.com/AlpyneDreams/d8vk)

[Termux-app](https://github.com/termux/termux-app)

[Termux-x11](https://github.com/termux/termux-x11)

[Wine](https://wiki.winehq.org/Licensing)

[wine-ge-custom](https://github.com/GloriousEggroll/wine-ge-custom)

[Mesa](https://docs.mesa3d.org/license.html)

[Mangohud](https://github.com/flightlessmango/MangoHud)


================================================
FILE: boost_launcher
================================================
#!/bin/bash

su -c /data/data/com.termux/files/usr/bin/python /data/data/com.termux/files/usr/bin/cpu_boost.py

================================================
FILE: cpu_boost.py
================================================
import psutil
import time
import gc
from concurrent.futures import ThreadPoolExecutor
from blessings import Terminal
import concurrent.futures
import os
from threading import Lock
import multiprocessing
from multiprocessing import Process, Queue

R = "\033[1;31m"
G = "\033[1;32m"
Y = "\033[1;33m"
B = "\033[1;34m"
C = "\033[1;36m"
W = "\033[1;37m"
BOLD = "\033[1m"

# Initialize blessings terminal
term = Terminal()

def get_cpu_core_count():
    core_count = psutil.cpu_count(logical=False)
    return core_count

def get_cpu_info():
    cpu_info = {
        "CPU Count": psutil.cpu_count(logical=False),
        "Logical CPU Count": psutil.cpu_count(logical=True),
        "CPU Frequency": psutil.cpu_freq().current,
        "Max CPU Frequency": psutil.cpu_freq().max,
        "Memory Usage": psutil.virtual_memory().percent,
        "Available Memory": psutil.virtual_memory().available,
        "Total Memory": psutil.virtual_memory().total,
    }

    cpu_freqs = psutil.cpu_freq(percpu=True)
    for core, freq_info in enumerate(cpu_freqs):
        cpu_info[f"Core {core + 1} Frequency"] = freq_info.current
        cpu_info[f"Core {core + 1} Max Frequency"] = freq_info.max

    return cpu_info, cpu_freqs

def get_cpu_usage(process):
    return process.info['pid'], process.info['cpu_percent'], len(process.info['cpu_affinity'])

def get_file_descriptor_info(pid):
    try:
        files = psutil.Process(pid).open_files()
        file_names = [file.path for file in files]
        return file_names
    except (psutil.NoSuchProcess, psutil.AccessDenied) as e:
        print(f"{R} Error getting file descriptor info for PID {pid}: {e} {W}")
        return []

def get_shared_memory_info(pid):
    try:
        process = psutil.Process(pid)
        shared_memory_info = []

        for mmap in process.memory_maps(grouped=True):
            if mmap[0] == '[heap]':
                continue  # Skip heap memory
            if mmap[0].startswith('/dev/shm'):
                shared_memory_info.append({
                    'path': mmap[0],
                    'size': mmap[1].rss,  # Get the size from the RSS (Resident Set Size)
                })

        return shared_memory_info
    except (psutil.NoSuchProcess, psutil.AccessDenied) as e:
        print(f"{R} Error getting shared memory info for PID {pid}: {e} {W}")
        return []

def get_idle_cores():
    # Get the list of logical CPU cores
    logical_cores = list(range(psutil.cpu_count(logical=True)))

    # Get the list of currently busy cores
    busy_cores = set(psutil.cpu_percent(percpu=True, interval=0.1))

    # Find idle cores (not in busy_cores)
    idle_cores = [core for core in logical_cores if core not in busy_cores]

    return idle_cores

def get_core_score(core, current_cpu_load, cpu_freqs):
    # Calculate a score for the core based on current CPU load and frequency
    freq_score = cpu_freqs[core].current / max(cpu_freqs[core].max, 1)  # Normalize frequency
    load_score = 1 - current_cpu_load / 100  # Invert load for higher load to have a lower score
    return freq_score * load_score

def get_high_frequency_cores(cpu_freqs, num_cores=4):
    # Get the list of cores sorted by frequency in descending order
    sorted_cores = sorted(range(len(cpu_freqs)), key=lambda x: cpu_freqs[x].current, reverse=True)
    return sorted_cores[:num_cores]

def adjust_cpu_and_priority(process, num_cores_to_assign, cpu_freqs):
    try:
        # Get the current CPU load for the process
        current_cpu_load = process.cpu_percent(interval=0.1)

        # Remember the previous affinity
        previous_affinity = process.cpu_affinity()

        # Get idle cores
        idle_cores = get_idle_cores()

        # Get high-frequency cores
        high_frequency_cores = get_high_frequency_cores(cpu_freqs, num_cores_to_assign)

        # Prioritize high-frequency cores with low current CPU load
        sorted_cores = sorted(high_frequency_cores, key=lambda core: get_core_score(core, current_cpu_load, cpu_freqs), reverse=True)

        # Assign the first num_cores_to_assign cores to the process only if the affinity has changed
        if set(sorted_cores) != set(previous_affinity):
            process.cpu_affinity(sorted_cores)

            # Set the priority of the process to a higher value
            process.nice(-10)  # Adjust the nice value as needed

            print(f"{G} Adjusted CPU affinity and priority for PID {process.info['pid']} {W}")
        else:
            print(f"{C} No need to adjust CPU affinity for PID {process.info['pid']} {W}")
    except (psutil.NoSuchProcess, IndexError, psutil.AccessDenied) as e:
        print(f"{R} Error adjusting CPU affinity and priority: {e} {W}")

def optimize_memory_for_high_cpu_process(process, recommended_memory_gb=6):
    try:
        # Get detailed memory information
        mem_info = process.memory_full_info()

        # Convert recommended_memory_gb to kilobytes
        recommended_memory_kb = recommended_memory_gb * 1024 * 1024

        # Calculate dynamically adjusted release amount based on current memory usage
        release_amount_gb = max((mem_info.rss - recommended_memory_kb) / (1024 * 1024), 0)

        if release_amount_gb > 0:
            # Example: Release dynamically calculated amount of memory
            process.memory_info().rss -= int(release_amount_gb * 1024 * 1024)
            print(f"{G} Released {C} {release_amount_gb:.2f} GB {G} of memory for PID {C} {process.info['pid']} {W}")

            # Trigger garbage collection to handle remaining cleanup
            gc.collect()

        else:
            print(f"{G} No unnecessary memory to release for PID {C}{process.info['pid']} {W}")
    except (psutil.NoSuchProcess, psutil.AccessDenied) as e:
        print(f"{R} Error optimizing memory for process: {C}{e} {W}")

class ProcessInfo:
    def __init__(self, pid, cpu_usage, file_descriptors):
        self.pid = pid
        self.cpu_usage = cpu_usage
        self.file_descriptors = file_descriptors

class SharedMemory:
    def __init__(self, size):
        self.data = bytearray(size)
        self.lock = Lock()

    def set_value(self, offset, value):
        with self.lock:
            self.data[offset:offset+len(value)] = value.encode()

    def get_value(self, offset, size):
        with self.lock:
            return self.data[offset:offset+size].decode()

def get_c_process_file_info(process_to_check):
    # Replace with your platform-specific logic to identify C processes
    for process in psutil.process_iter():
        if process.info['pid'] == process_to_check.info['pid']:
            # Extract file information from the process (e.g., file descriptors, paths)
            file_info = get_file_descriptor_info(process.info['pid'])
            shared_memory_info = get_shared_memory_info(process.info['pid'])
            return file_info, shared_memory_info  # Replace with actual file information
    return None

def io_operation(shared_memory_segment, process_to_check, pid, result_queue):
    try:
        # Obtain file information and shared memory info from the specified process
        file_info, shared_memory_info = get_c_process_file_info(process_to_check)

        with shared_memory_segment.lock:
            # Assuming shared_memory_info is a dictionary containing relevant information
            serialized_process_info = pickle.dumps(ProcessInfo(process_to_check.info['pid'],
                                                              process_to_check.info['cpu_percent'],
                                                              file_info))
            
            # Assuming shared_memory_info contains necessary metadata, adjust the offsets accordingly
            shared_memory_segment.set_value(0, f"pid:{process_to_check.info['pid']}")
            shared_memory_segment.set_value(4, len(serialized_process_info).to_bytes(4, byteorder="big"))
            shared_memory_segment.set_value(8, serialized_process_info)

            # Continue with the rest of the function logic
            data = shared_memory_segment.read().decode()

            if data.startswith("pid:"):
                offset = 4
                pid_value = int(data[4:offset])
                offset += 4
                cpu_usage_size = int(data[offset:offset+4])
                offset += 4
                cpu_usage = data[offset:offset+cpu_usage_size]
                offset += cpu_usage_size
                file_descriptors_size = int(data[offset:offset+4])
                offset += 4
                file_descriptors = data[offset:offset+file_descriptors_size]
                process_info = pickle.loads(cpu_usage + file_descriptors)

                # Use pid_value as needed in the function
                # ...

                # I/O processing logic with process_info
                processed_data = "Processed result"

                # Put the processed data into the result_queue
                result_queue.put(processed_data)

            else:
                data = json.loads(data)
                file_paths = data["file_paths"]
                results = multiprocessing.Pool().map(read_file_async, file_paths)
                for result in results:
                    process_data(result)

    except Exception as e:
        logger.error(f"Error in I/O operation: {e}")

def cpu_memory():
    try:
        # Create a Queue for communication within the same process
        result_queue = Queue()

        with ThreadPoolExecutor() as executor:
            while True:
                cpu_info_future = executor.submit(get_cpu_info)
                processes = psutil.process_iter(['pid', 'name', 'cpu_percent', 'cpu_affinity'])
                cpu_usage_futures = list(executor.map(get_cpu_usage, processes))

                cpu_info, cpu_freqs = cpu_info_future.result()

                cpu_core_count = get_cpu_core_count()

                high_usage_process = max(processes, key=lambda process: process.info['cpu_percent'], default=None)

                if high_usage_process:
                    adjust_cpu_and_priority(high_usage_process, num_cores_to_assign, cpu_freqs)

                if high_usage_process and high_usage_process.info['cpu_percent'] > 50:
                    optimize_memory_for_high_cpu_process(high_usage_process, recommended_memory_gb=5)

                    # Check if the process has more than 10 files for I/O parallelization

                    shared_memory.set_value(0, pid.to_bytes(4, byteorder="big"))
                    shared_memory.set_value(4, len(serialized_process_info).to_bytes(4, byteorder="big"))
                    shared_memory.set_value(8, serialized_process_info)

                    # Call io_operation with the result_queue and high_usage_process
                    io_operation(shared_memory, high_usage_process, pid, result_queue)

                    # Retrieve the processed data from the result_queue
                    processed_data = result_queue.get()

                    # Get file information for the high CPU process
                    file_info = get_file_descriptor_info(high_usage_process.info['pid'])
                    num_files = len(file_info)
                    print(f"{G} Number of files in use by PID {C} {high_usage_process.info['pid']}: {num_files} {W}")

                low_usage_processes = [process for process in processes
                                       if process.info['cpu_percent'] < 5 and process.info['create_time'] < time.time() - 10]

                for process in low_usage_processes:
                    idle_cores = get_idle_cores()
                    low_scoring_cores = get_high_frequency_cores(cpu_freqs, num_cores_to_assign)
                    sorted_cores = sorted(low_scoring_cores,
                                          key=lambda core: get_core_score(core, 0, cpu_freqs),
                                          reverse=False)
                    process.cpu_affinity(sorted_cores)

                    print(f"{G}Assigned low-scoring cores for PID {C}{process.info['pid']} {W}")

                with term.fullscreen():
                    print(term.clear)
                    print(f"{R}[{W}-{R}]{G}{BOLD} CPU Info: {W}")
                    for key, value in cpu_info.items():
                        print(f"{G}{key}: {C}{value} {W}")

                    print(f"{R}[{W}-{R}]{G}{BOLD} \nCPU Usage: {W}")
                    for process_pid, process_usage, process_core_count in cpu_usage_futures:
                        print(f"{G}PID {process_pid}: {C}{process_usage}% {G}(Using {C}{process_core_count} {G}cores) {W}")
                        num_files = len(get_file_descriptor_info(process_pid))
                        print(f"{R}[{W}-{R}]{G}{BOLD} Number of files for PID {process_pid}: {C}{num_files} {W}")

                    print(f"{R}[{W}-{R}]{G}{BOLD} \nMemory Info: {W}")
                    print(f"{G} Memory Usage: {C}{cpu_info['Memory Usage']}% {W}")
                    print(f"{G} Available Memory: {C}{cpu_info['Available Memory']} bytes {W}")
                    print(f"{G} Total Memory: {C}{cpu_info['Total Memory']} bytes {W}")

                time.sleep(0.5)
    except KeyboardInterrupt:
        pass

if __name__ == "__main__":
    cpu_memory()



================================================
FILE: currently version.txt
================================================
0.971


================================================
FILE: darkos
================================================
#!/bin/bash
R="$(printf '\033[1;31m')"                           
G="$(printf '\033[1;32m')"
Y="$(printf '\033[1;33m')"
B="$(printf '\033[1;34m')"
C="$(printf '\033[1;36m')"                                       
W="$(printf '\033[1;37m')"
BOLD="$(printf '\033[1m')"

clear
python3 $PREFIX/bin/photo.py $@
echo "${G}${BOLD} PRESS 1 TO ENTER SAFE MODE ....... "${W}
read -t 2 -n1 -s key
pkill -9 pulseaudio 
if [[ "$key" == "1" ]]; then
    echo "${G}${BOLD} Safe MODE DARKOS.....STARTING"${W}
    termux-x11 :0 &>/dev/null &
   # pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 &>/dev/null
  
   if [[ -f "/system/lib64/libskcodec.so" ]] ; then
  LD_PRELOAD="/system/lib64/libskcodec.so" pulseaudio --start --exit-idle-time=-1 &
  sleep 1
  pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1 

else
   pulseaudio --start --exit-idle-time=-1 &
   sleep 1
   pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1
fi

    python3 $PREFIX/bin/darkos.py $@
    exit 0
elif [[ "$key" == " " ]]; then
    echo "${G}${BOLD} Booting DARKOS 🖤 "${W}
fi

old_version="0.971"
new_version=$(curl -s https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/currently%20version.txt)

if ping -q -c 1 -W 1 google.com >/dev/null; then
    echo "${G}${BOLD} Welcome 🤗"${W}
    if awk 'BEGIN{exit !('$old_version' < '$new_version')}'; then
        echo ""
        echo "${G}${BOLD} update available ⏫....to version : ${C}${BOLD}$new_version"${W}
        sleep 3
else
        echo "${G}${BOLD} installed version : ${C}${BOLD}$old_version"${W}
        sleep 1
    fi
else
    echo "${G}${BOLD} no internet connection 😔🛜"${W}
fi

if [[ -v LD_PRELOAD ]]; then
    unset LD_PRELOAD
fi
echo ""
echo "${G}${BOLD} Booting DARKOS 🖤"${W}

termux-x11 :0 &>/dev/null &
#pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 &>/dev/null
if [[ -f "/system/lib64/libskcodec.so" ]] ; then
  LD_PRELOAD="/system/lib64/libskcodec.so" pulseaudio --start --exit-idle-time=-1 &
  sleep 1
  pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1 

else
   pulseaudio --start --exit-idle-time=-1 &
   sleep 1
   pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1
fi

custom_darkos="$PREFIX/glibc/opt/darkos/custom_theme.txt"

if [ -f "$custom_darkos" ]; then
    export DISPLAY=:0
    startxfce4 &>/dev/null &
    python3 $PREFIX/glibc/opt/scripts/custom_style.py $@
else
    python3 $PREFIX/bin/run-darkos.py $@
fi


================================================
FILE: darkos.py
================================================
import os
import re
import subprocess
import time
import threading
import shutil
import sys, urllib.request, urllib.error
import zipfile
import tarfile
from tqdm import tqdm

R = "\033[1;31m"
G = "\033[1;32m"
Y = "\033[1;33m"
B = "\033[1;34m"
C = "\033[1;36m"
W = "\033[1;37m"
BOLD = "\033[1m"

current_version = "0.971"
url = 'https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/currently%20version.txt'

def extract_archive(file_path, extract_to):
    if not os.path.exists(file_path):
        print(f"{R}File does not exist: {file_path}{W}")
        return

    if file_path.endswith('.zip'):
        with zipfile.ZipFile(file_path, 'r') as zip_ref:
            file_size = sum((file.file_size for file in zip_ref.infolist()))
            with tqdm(total=file_size, unit='B', unit_scale=True, desc=f'{G}Extracting{C}', bar_format='{l_bar}{bar}| {n_fmt}/{total_fmt} [{rate_fmt}{postfix}]') as pbar:
                for file in zip_ref.infolist():
                    zip_ref.extract(file, extract_to)
                    pbar.update(file.file_size)

    elif file_path.endswith('.tar.gz') or file_path.endswith('.tgz') or file_path.endswith('.tar'):
        with tarfile.open(file_path, 'r') as tar_ref:
            file_size = sum((file.size for file in tar_ref.getmembers()))
            with tqdm(total=file_size, unit='B', unit_scale=True, desc=f'{G}Extracting{C}', bar_format='{l_bar}{bar}| {n_fmt}/{total_fmt} [{rate_fmt}{postfix}]') as pbar:
                for file in tar_ref.getmembers():
                    tar_ref.extract(file, extract_to)
                    pbar.update(file.size)

    elif file_path.endswith('.tar.xz') or file_path.endswith('.txz'):
        with tarfile.open(file_path, 'r:xz') as tar_ref:
            file_size = sum((file.size for file in tar_ref.getmembers()))
            with tqdm(total=file_size, unit='B', unit_scale=True, desc=f'{G}Extracting{C}', bar_format='{l_bar}{bar}| {n_fmt}/{total_fmt} [{rate_fmt}{postfix}]') as pbar:
                for file in tar_ref.getmembers():
                    tar_ref.extract(file, extract_to)
                    pbar.update(file.size)

    else:
        print(f"{R}Unsupported file format{W}")
        return

    try:
        os.remove(file_path)
    except Exception as e:
        print(f"{R}Error deleting archive file: {str(e)}{W}")

def colored_input(prompt):
    print(f"{R}[{W}-{R}]{G}{BOLD} {prompt} {W}", end="")
    user_input = input()
    return user_input

def start_darkos():
    os.system("clear")
    if "LD_PRELOAD" in os.environ:
        del os.environ["LD_PRELOAD"]
    print(f"{R}[{W}-{R}]{G}{BOLD} Starting {W}")
    os.system("termux-x11 :0 &>/dev/null &")
    os.system('pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 &>/dev/null')
def wine_container():
    os.system("clear")
    photo()
    print(f"{R}[{W}-{R}]{G}{BOLD} Select Wine container: {W}")
    
    wine_paths = {
        "1": "/data/data/com.termux/files/usr/glibc/opt/wine/1/wine/bin",
        "2": "/data/data/com.termux/files/usr/glibc/opt/wine/2/wine/bin",
        "3": "/data/data/com.termux/files/usr/glibc/opt/wine/3/wine/bin"
    }
    
    for key, path in wine_paths.items():
        if os.path.exists(path):
            if key == "1":
                print(f"{Y}{BOLD} wine 1 {W}")
            if key == "2":
                print(f"{Y} 2) wine 2 {W}")
            if key == "3":
                print(f"{Y} 3) wine 3 {W}")
    
    print(f"{Y} Else) Back to the main menu 👑 {W}")
    print("")
    
    prefix_path = colored_input("Enter your selection:")
    
    if prefix_path not in wine_paths.keys():
        print(f"{R}Incorrect or empty option! {W}")
        time.sleep(1)
        main_menu()
    else:
        conf_path = f"/data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/os.conf"
        wine_prefix = f"/data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/.wine"
        os.system("chmod +x $PREFIX/glibc/bin/box86")
        os.system("chmod +x $PREFIX/glibc/bin/box64")
        os.system(f"chmod +x /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wine")
        os.system(f"chmod +x /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wineserver")
        os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wine $PREFIX/glibc/bin/wine")
        if not os.path.exists(f"/data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wine64"):
            os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wine $PREFIX/glibc/bin/wine64")
            os.system(f"chmod +x /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wine64")
            os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wine $PREFIX/glibc/opt/wine/{prefix_path}/wine/bin/wine64")
        else:
            os.system(f"chmod +x /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wine64")
            os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wine64 $PREFIX/glibc/bin/wine64")
        os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wineserver $PREFIX/glibc/bin/wineserver")
        os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wineboot $PREFIX/glibc/bin/wineboot")
        os.system(f"ln -sf /data/data/com.termux/files/us/glibc/opt/wine/{prefix_path}/wine/bin/winecfg $PREFIX/glibc/bin/winecfg")
        #os.system("ln -sf /var/lib/dbus/machine-id /etc/machine-id")
        os.environ.pop('LD_PRELOAD', None)
        ### AZ DARK 
        if os.path.exists(conf_path):
            exec(open(conf_path).read())
        if not os.path.exists(wine_prefix):
            print(f"{R}[{W}-{R}]{G}{BOLD} Creating wine prefix 💫 {W}")
            os.system(f'WINEDLLOVERRIDES="mscoree=disabled" box64 wine64 wineboot &>/dev/null')
            os.system(f'cp -r $PREFIX/glibc/opt/Startxmenu/* "{wine_prefix}/drive_c/ProgramData/Microsoft/Windows/Start Menu"')
            os.system(f'rm "{wine_prefix}/dosdevices/z:"')
            os.system(f'ln -s /sdcard/Download "{wine_prefix}/dosdevices/o:" &>/dev/null')
            os.system(f'ln -s /sdcard/darkos "{wine_prefix}/dosdevices/e:" &>/dev/null')
            os.system(f'ln -s /data/data/com.termux/files "{wine_prefix}/dosdevices/z:"')
            print(f"{G} Installing DXVK+Zink... {W}")
            os.system(f'box64 wine "$PREFIX/glibc/opt/apps/Install OS stuff.bat" &>/dev/null')
            print(f"{R}[{W}-{R}]{G}{BOLD} Done! {W}")
            #os.system("clear") 
            print(f"{R}[{W}-{R}]{G}{BOLD} prefix done enjoy 🤪 {W}")
            time.sleep(3)
            os.system("box64 wineserver -k &>/dev/null")
            start_container()
    start_container()
def recreate_32bit():
    os.system("clear")
    photo()
    print(f"{R}[{W}-{R}]{G}{BOLD} select wine : {W}")
    
    wine_paths = {
        "1": "/data/data/com.termux/files/usr/glibc/opt/wine/1/wine/bin",
        "2": "/data/data/com.termux/files/usr/glibc/opt/wine/2/wine/bin",
        "3": "/data/data/com.termux/files/usr/glibc/opt/wine/3/wine/bin"
    }
    
    for key, path in wine_paths.items():
        if os.path.exists(path):
            if key == "1":
                print(f"{Y} 1) wine 1 {W}")
            if key == "2":
                print(f"{Y} 2) wine 2 {W}")
            if key == "3":
                print(f"{Y} 3) wine 3 {W}")
    
    print(f"{Y} Else) Back to the settings menu {W}")
    print("")
    
    prefix_path = colored_input("Enter your selection:")
    
    if prefix_path not in wine_paths.keys():
        change_setting()
    else:
        conf_path = f"/data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/os.conf"
        wine_prefix = f"/data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/.wine"
        os.system("chmod +x $PREFIX/glibc/bin/box86")
        os.system("chmod +x $PREFIX/glibc/bin/box64")
        os.system(f"chmod +x /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wine")
        os.system(f"chmod +x /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wineserver")
        os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wine $PREFIX/glibc/bin/wine")
        os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wine64 $PREFIX/glibc/bin/wine64")
        os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wineserver $PREFIX/glibc/bin/wineserver")
        os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wineboot $PREFIX/glibc/bin/wineboot")
        os.system(f"ln -sf /data/data/com.termux/files/us/glibc/opt/wine/{prefix_path}/wine/bin/winecfg $PREFIX/glibc/bin/winecfg")
        os.environ.pop('LD_PRELOAD', None)
        ### AZ DARK 
        exec(open(conf_path).read())
        def prefix_gstreamer():
            os.environ['WINEPREFIX'] = wine_prefix
            print(f"{R}[{W}-{R}]{G}{BOLD} Fixing wine prefix .... {W}")
            os.system(f'WINEDLLOVERRIDES="mscoree=disabled" box64 wine64 wineboot &>/dev/null')
            os.system(f'cp -r $PREFIX/glibc/opt/Startxmenu/* "{wine_prefix}/drive_c/ProgramData/Microsoft/Windows/Start Menu"')
            os.system(f'rm "{wine_prefix}/dosdevices/z:"')
            os.system(f'ln -s /sdcard/Download "{wine_prefix}/dosdevices/o:" &>/dev/null')
            os.system(f'ln -s /sdcard/darkos "{wine_prefix}/dosdevices/e:" &>/dev/null')
            os.system(f'ln -s /data/data/com.termux/files "{wine_prefix}/dosdevices/z:"')
            print(f"{R}[{W}-{R}]{C}{BOLD} please wait .. {W}")
            os.system(f'box64 wine "$PREFIX/glibc/opt/apps/Install OS stuff.bat" &>/dev/null')
            print(f"{R}[{W}-{R}]{G}{BOLD} done...please restart OS {W}")
            time.sleep(1)
            os.system("box64 wineserver -k &>/dev/null")
            main_menu()
        if os.path.exists(wine_prefix):
            shutil.rmtree(wine_prefix)
            time.sleep(1)
            prefix_gstreamer()
        if not os.path.exists(wine_prefix):
            prefix_gstreamer()
def photo():
    os.system("python3 $PREFIX/bin/photo.py")
def check_network_connection():
    try:
        urllib.request.urlopen("http://www.google.com", timeout=5)
        return True
    except urllib.error.URLError:
        return False
def main():
    if not check_network_connection():
        print(f"{R}[{W}-{R}]{R}{BOLD} No network connection available. {W}")
        return
    try:
        response = urllib.request.urlopen(url)
        latest_version = response.read().decode('utf-8').strip()
        if latest_version < current_version:
            os.system("curl -o install https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/installO.sh && chmod +x install && ./install")
        if latest_version > current_version:
            print(f"{R}[{W}-{R}]{C}{BOLD} update available....please update DARKOS {W}")
    except urllib.error.HTTPError as e:
        if e.code == 404:
            print("🙅‍♂️🛜", e)
        else:
            print(f"{R} something went wrong please send this error to developer {W}")

def mangohud_vulkan():
    os.system("apt reinstall vulkan-icd-loader-glibc")
    print(f"{R}[{W}-{R}]{Y}{BOLD} working...... please wait {W}")
    os.system("grun -s ldconfig")
def winetricks():
    os.system("clear")
    photo()
    print(f"{R}[{W}-{R}]{G}{BOLD} winetricks menu : {W}")
    print("")
    print(f"{Y} 1) winetricks gui 🖥️ {W}")
    print("")
    print(f"{Y} 2) winetricks verbs 🧑‍💻 {W}")
    print("")
    print(f"{Y} Else) Back to the main menu 👑 {W}")
    print("")
    choise = input()
    conf_path = f"/data/data/com.termux/files/usr/glibc/opt/wine/os.conf"
    if choise != "1" and choise != "2":
        print(f"{R}[{W}-{R}]{G}{BOLD} backing to main menu {W}")
        time.sleep(2)
        main_menu()
    elif choise == "1":
        exec(open(conf_path).read())
        exec(open('/sdcard/darkos/darkos_dynarec.conf').read())
        exec(open('/sdcard/darkos/darkos_custom.conf').read())
        os.system("clear")
        photo()
        print(f"{R}[{W}-{R}]{G}{BOLD} loading...... winetrick {W}")
        print(f"{R}[{W}-{R}]{Y}{BOLD} winetricks working just wait its take 1 minute to launch menu {W}")
        print(f"{R}[{W}-{R}]{G}{BOLD} if you want to close it and back to main menu press control+C {W}")
        os.system("am start -n com.termux.x11/com.termux.x11.MainActivity &>/dev/null")
        os.system("LD_PRELOAD= WINESERVER=$PREFIX/glibc/bin/wineserver WINE=$PREFIX/glibc/bin/wine64 $PREFIX/glibc/bin/box64 $PREFIX/glibc/bin/bash86 $PREFIX/glibc/bin/winetricks &>/dev/null")
        main_menu()
    elif choise == "2":
        exec(open(conf_path).read())
        exec(open('/sdcard/darkos/darkos_dynarec.conf').read())
        exec(open('/sdcard/darkos/darkos_custom.conf').read())
        os.system("clear")
        photo()
        print(f"{R}[{W}-{R}]{G}{BOLD} winetrick verbs ready to use on chosen container... {W}")
        print("")
        print(f"{R}[{W}-{R}]{G}{BOLD} input verbs: {W}")
        winetrick_verbs = input()
        os.system(f"LD_PRELOAD= WINESERVER=$PREFIX/glibc/bin/wineserver WINE=$PREFIX/glibc/bin/wine64 $PREFIX/glibc/bin/box64 $PREFIX/glibc/bin/bash86 $PREFIX/glibc/bin/winetricks {winetrick_verbs} ")
        print("")
        print(f"{R}[{W}-{R}]{G}{BOLD} winetrick packages installed successfully...👍 {W}")
        print(f"{R}[{W}-{R}]{G}{BOLD} backing to main menu..... 🔁 {W}")
        time.sleep(4)
        main_menu()
def start_container():
    start_darkos()
    exec(open('/sdcard/darkos/darkos_dynarec.conf').read())
    os.system("chmod +x $PREFIX/glibc/bin/box86")
    os.system("chmod +x $PREFIX/glibc/bin/box64")
    xrandr_output = os.popen('xrandr').read()
    current_resolution_match = re.search(r'current\s+(\d+) x (\d+)', xrandr_output)

    if current_resolution_match:
        current_resolution = f"{current_resolution_match.group(1)}x{current_resolution_match.group(2)}"
    else:
        current_resolution = "800x600"
    res = current_resolution
    os.system("taskset -c 4-7 box64 wine64 explorer /desktop=shell," + res + " $PREFIX/glibc/opt/apps/run.exe &>/dev/null &")
    os.system("am start -n com.termux.x11/com.termux.x11.MainActivity &>/dev/null")
    os.system("clear")
    os.system("python3 $PREFIX/bin/photo.py")
    print(f"{Y}exit 1️⃣ {W}")
    user_input = colored_input("Enter 1 to stop: ")
    if user_input == "1":
        os.system("box64 wineserver -k")
        print(f"{Y} Exiting 👋 {W}")
        os.system('pkill -f "app_process / com.termux.x11"')
        os.system('pkill -f pulseaudio')
        print(f"{G} see you later {W}")
        main_menu()
    main_menu()
        
def uninstall_wine():
    os.system("clear")
    photo()
    print(f"{R}[{W}-{R}]{G}{BOLD} Are you sure you want to delete the wine version? {W}")
    print("")
    if os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/1/wine/bin"):
        print(f"{Y}1) Delete wine 1 {W}")
    if os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/2/wine/bin"):
        print(f"{Y} 2) Delete wine 2 {W}")
    if os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/3/wine/bin"):
        print(f"{Y} 3) Delete wine 3 {W}")
    print(f"{Y} else) main menu ⬅️ {W}")
    print("")
    choice = input()
    if choice != "1" and choice != "2" and choice != "3":
        print(f"{R} Incorrect or empty option! {W}")
        main_menu()
    elif choice == "1" and os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/3/wine/bin"):
        print(f"{R}[{W}-{R}]{G} Deleting wine 1, please wait... {W}")
        print("")
        uninstall_wine9()
    elif choice == "2" and os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/2/wine/bin"):
        print(f"{R}[{W}-{R}]{G} Deleting wine 2, please wait... {W}")
        print("")
        uninstall_wine8()
    elif choice == "3" and os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/1/wine/bin"):
        print(f"{R}[{W}-{R}]{G} Deleting wine 3, please wait... {W}")
        print("")
        uninstall_wine7()
    main_menu()
def uninstall_wine9():
    if os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/1/wine/bin"):
        os.system("rm -r /data/data/com.termux/files/usr/glibc/opt/wine/1/wine")
        if os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/1/.wine"):
            shutil.rmtree('/data/data/com.termux/files/usr/glibc/opt/wine/1/.wine')
def recreate_prefix_wineAZ():
    print(f"{R}[{W}-{R}]{G}{BOLD} select version of wine you want to recreate_prefix: {W}")
    print("")
    if os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/1/.wine"):
        print(f"{Y} 1) remove prefix on container 1 {W}")
    if os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/2/.wine"):
        print(f"{Y} 2) remove prefix on container 2 {W}")
    if os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/3/.wine"):
        print(f"{Y} 3) remove prefix on container 3 {W}")
    if os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/4/.wine"):
        print(f"{Y} 4) remove prefix on container 4 {W}")
    if os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/5/.wine"):
        print(f"{Y} 5) remove prefix on container 5 {W}")
    print("")
    print(f"{Y} else) back to settings menu {W}")
    print("")
    user_input = input()
    if user_input not in ["1", "2", "3", "4", "5"]:
        change_setting()
    elif user_input == "1":
         shutil.rmtree('/data/data/com.termux/files/usr/glibc/opt/wine/1/.wine')
         print(f"{G} Done {W}")
    elif user_input == "2":
         shutil.rmtree('/data/data/com.termux/files/usr/glibc/opt/wine/2/.wine')
         print(f"{G} Done {W}")
    elif user_input == "3":
         shutil.rmtree('/data/data/com.termux/files/usr/glibc/opt/wine/3/.wine')
         print(f"{G} Done {W}")
    elif user_input == "4":
         shutil.rmtree('/data/data/com.termux/files/usr/glibc/opt/wine/4/.wine')
         print(f"{G} Done {W}")
    elif user_input == "5":
         shutil.rmtree('/data/data/com.termux/files/usr/glibc/opt/wine/5/.wine')
         print(f"{G} Done {W}")
    main_menu()
def xinput_support():
    print(f"{R}[{W}-{R}]{G}{BOLD} Select the version of Wine you want to add xinput support for: {W}")
    print("")
    for i in range(1, 6):
        wine_path = f"/data/data/com.termux/files/usr/glibc/opt/wine/{i}/.wine"
        if os.path.exists(wine_path):
            print(f"{Y} {i}) Add xinput support on container {i} {W}")
    print("")
    print(f"{Y} Else) Back to the settings menu {W}")
    print("")
    user_input = colored_input("Enter your choice: ")
    if user_input not in ["1", "2", "3", "4", "5"]:
        # Handle invalid input
        change_setting()
    else:
        wine_container = int(user_input)
        wine_lib64_path = f"/data/data/com.termux/files/usr/glibc/opt/wine/{wine_container}/wine/lib64"
        wine_lib_path = f"/data/data/com.termux/files/usr/glibc/opt/wine/{wine_container}/wine/lib/wine"
        if os.path.exists(wine_lib64_path):
            os.system(f"tar -xJf $PREFIX/glibc/opt/darkos/XinputBridge_ge.tar.xz -C /data/data/com.termux/files/usr/glibc/opt/wine/{wine_container}/wine/ &>/dev/null")
        else:
            os.system(f"tar -xJf $PREFIX/glibc/opt/darkos/XinputBridge.tar.xz -C {wine_lib_path} &>/dev/null")
        print(f"{R}[{W}-{R}]{G}{BOLD} xinput support added to Wine in container {C}{wine_container} {W}")
        time.sleep(2)
        change_setting()
def check_config_wine():
    config_folder = "/sdcard/darkos"
    exec(open('/sdcard/darkos/darkos_dynarec.conf').read())
def Compile():
    os.system("apt install cmake-glibc make-glibc python-glibc")
    os.system("pkg install -y git; unset LD_PRELOAD; export GLIBC_PREFIX=/data/data/com.termux/files/usr/glibc; export PATH=$GLIBC_PREFIX/bin:$PATH; cd ~/; git clone https://github.com/ptitSeb/box64; cd ~/box64; sed -i 's/\/usr/\/data\/data\/com.termux\/files\/usr\/glibc/g' CMakeLists.txt; sed -i 's/\/etc/\/data\/data\/com.termux\/files\/usr\/glibc\/etc/g' CMakeLists.txt; mkdir build; cd build; cmake --install-prefix $PREFIX/glibc .. -DARM_DYNAREC=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBAD_SIGNAL=ON -DSD845=ON; make -j8; make install")
def install_wine9():
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/wine-default.tar.xz")
    extract_archive('wine-default.tar.xz','/data/data/com.termux/files/usr/glibc/opt/wine/1/')
def auto_start():
    os.system("clear")
    photo()
    print(f"{R}[{W}-{R}]{G}{BOLD} select what you refer: {W}")
    print("")
    print(f"{Y} 1) turn-on auto start os 👍 {W}")
    print("")
    print(f"{Y} 2) turn-off auto start os 👎 {W}")
    print("")
    print(f"{Y} else) back to settings menu {W}")
    choice = input()

    if choice != "1" and choice != "2":
        change_setting()
    elif choice == "1":
        command = "darkos"
        shell_name = get_shell_name()
        if shell_name:
            activate_auto_start(command, shell_name)
        else:
            print(f"{R}Unable to determine current shell.{W}")
    elif choice == "2":
        command = "darkos"
        shell_name = get_shell_name()
        if shell_name:
            deactivate_auto_start(command, shell_name)
        else:
            print(f"{R}Unable to determine current shell.{W}")

def get_shell_name():
    shell_path = os.getenv('SHELL')
    if shell_path:
        return os.path.basename(shell_path)
    return None

def activate_auto_start(command, shell_name):
    shellrc_files = {
        'bash': '.bashrc',
        'zsh': '.zshrc',
    }
    shellrc_path = os.path.expanduser(f'~/{shellrc_files.get(shell_name, ".bashrc")}')
    command_exists = False
    if os.path.exists(shellrc_path):
        with open(shellrc_path, 'r') as f:
            for line in f:
                if command in line:
                    command_exists = True
                    print(f"{G}Auto start os already activated in {C}{shell_name} {G}shell.{W}")
                    time.sleep(2)
                    change_setting()
    if not command_exists:
        with open(shellrc_path, 'a') as f:
            f.write(command + '\n')
        print(f"{G}Auto start os activated successfully in {C}{shell_name} {G}shell.{W}")
        time.sleep(2)
        change_setting()

def deactivate_auto_start(command, shell_name):
    shellrc_files = {
        'bash': '.bashrc',
        'zsh': '.zshrc',
        'fish': 'config.fish'
    }
    shellrc_path = os.path.expanduser(f'~/{shellrc_files.get(shell_name, ".bashrc")}')
    if os.path.exists(shellrc_path):
        with open(shellrc_path, 'r') as f:
            lines = f.readlines()
        with open(shellrc_path, 'w') as f:
            for line in lines:
                if command not in line:
                    f.write(line)
        print(f"{G}Auto start os deactivated successfully in {C}{shell_name} {G}shell.{W}")
        time.sleep(2)
        change_setting()
def styles():
    os.system("clear")
    photo()
    print(f"{R}[{W}-{R}]{G}{BOLD} are you sure adding style support ? 🏞️ {W}")
    print("")
    print(f"{Y} 1) YES {W}")
    print("")
    print(f"{Y} 2) NO {W}")
    print("")
    choice = input()
    if choice == "1":
        os.system("chmod +x $PREFIX/glibc/opt/scripts/install_xfce4.sh")
        os.system("bash $PREFIX/glibc/opt/scripts/install_xfce4.sh")
    elif choice == "2":
        change_setting()
def change_setting():
    os.system("clear")
    photo()
    print(f"{R}[{W}-{R}]{G}{BOLD} SETTINGS ⚙️ {W}")
    print(f"{Y} 1) Update OS 👑 {W}")
    print(f"{Y} 2) Wine manager 🍷 {W}")
    print(f"{Y} 3) Change box86-box64 version 📥 {W}")
    print(f"{Y} 4) Delete prefix 🪡 {W}")
    print(f"{Y} 5) Change auto start setting 🖱️ {W}")
    print(f"{Y} 6) Debug mode 🔧 {W}")
    print(f"{Y} 7) Fix prefix for non wow64 wine ♻️ {W}")
    print(f"{Y} 8) Boost cpu 🔥 (needed root in some devices) {W}")
    print(f"{Y} 9) Add Styles Support For Dark Os 🎭 {W}")
    print(f"{Y} 10) winetricks ⛑️ {W}")
    print(f"{Y} 11) Add virgl support {W}")
    print(f"{Y} else) Back 🔙 {W}")
    print("")
    choice = input()
    if choice != "1" and choice != "2" and choice != "3" and choice != "4" and choice != "5" and choice != "6" and choice != "7" and choice != "8" and choice != "9" and choice != "10" and choice != "dev" and choice != "11":
        print(f"{G} ........... {W}")
        main_menu()
    elif choice == "3":
        box_version()
    elif choice == "11":
        os.system("clear")
        photo()
        print(f"{R}[{W}-{R}]{G}{BOLD} installing vrigl server please wait {W}")
        os.system("apt install tur-repo")
        print("")
        time.sleep(2)
        os.system("apt install virglrenderer-android virglrenderer-mesa-zink -y")
        print(f"{R}[{W}-{R}]{G}{BOLD} vrigl server install successfuly {W}")  
        print("")
        print(f"{R}[{W}-{R}]{G}{BOLD} congratulations virgl now supported {W}") 
        print("")      
        time.sleep(2)
        change_setting()
    elif choice == "dev":
        os.system("clear")
        print(f"{G}{BOLD} share log file on our Telegram group {W}")
        print(f"{G} dev mode {W}")
        os.system("BOX86_LOG=1 BOX86_SHOWSEGV=1 BOX86_DYNAREC_LOG=1 BOX86_DYNAREC_MISSING=1 BOX86_DLSYM_ERROR=1 BOX64_LOG=1 BOX64_SHOWSEGV=1 BOX64_DYNAREC_LOG=1 BOX64_DYNAREC_MISSING=1 WINEDEBUG=warn+all BOX64_DLSYM_ERROR=1 WINEDEBUG=+err taskset -c 4-7 box64 wine64 explorer /desktop=shell,800x600 $PREFIX/glibc/opt/apps/pc.ex >/sdcard/darkos.log")
    elif choice == "1":
        print("")
        print(f"{G} Shutdown OS.... {W}")
        print("")
        print(f"{Y} checking 🔎..... {W}")
        time.sleep(1)
        response = urllib.request.urlopen(url)
        latest_version = response.read().decode('utf-8').strip()
        try:
            if latest_version > current_version:
                print(f"{R}[{W}-{R}]{C}{BOLD} update available..... updating......📥 {W}")
                os.system("python3 $PREFIX/bin/update-darkos.py")
                time.sleep(3)
                change_setting()
        except urllib.error.HTTPError as e:
            if e.code == 404:
                os.system("clear")
                print(f"{R} no internet connection 😵 backing to the settings {W}")
                time.sleep(3)
                change_setting()
        else:
            print(f"{R}[{W}-{R}]{G}{BOLD} no update available {W}")
            time.sleep(3)
            change_setting()
    elif choice == "2":
        os.system("python3 $PREFIX/bin/setting-darkos.py")
    elif choice == "6":
        os.system("python3 $PREFIX/bin/debug-darkos.py")
    elif choice == "9":
        print("")
        styles()
    elif choice == "r":
        print(f"{R}[{W}-{R}]{G} to contact developer via telegram channel.... {C}(https://t.me/DARKOS4android) {W}")
        back = input("🔙 = 1")
        if back == "1":
            change_setting()
    elif choice == "4":
        recreate_prefix_wineAZ()
    elif choice == "5":
        auto_start()
    elif choice == "7":
        recreate_32bit()
    elif choice == "10":
        winetricks()
    elif choice == "8":
        os.system("clear")
        photo()
        pip_fixer_file = "/data/data/com.termux/files/usr/bin/pip_fixer"
        boost_launcher_file = "/data/data/com.termux/files/usr/bin/boost_launcher"
        if not os.path.exists(pip_fixer_file):
            os.system("wget https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/pip_fixer &>/dev/null")
            os.system("chmod +x pip_fixer")
            os.system("mv pip_fixer $PREFIX/bin/")
        if not os.path.exists(boost_launcher_file):
            os.system("wget https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/boost_launcher &>/dev/null")
            os.system("chmod +x boost_launcher")
            os.system("mv boost_launcher  $PREFIX/bin/")
        print(f"{Y} loading......... {W}")
        reload()
        print(f"{R}[{W}-{R}]{G}{BOLD} installing python packages {W}")
        os.system('pkg install python vulkan-tools python-pip coreutils -y &> /dev/null')
        print("")
        print(f"{R}[{W}-{R}]{G}{BOLD} fixing pip install {W}")
        os.system('pip_fixer')
        print("")
        os.system('pip install aiofiles psutil blessings &> /dev/null')
        print(f"{R}[{W}-{R}]{G} python packages.... 100% {W}")
        print("")
        print(f"{R}[{W}-{R}]{G}{BOLD} starting boost 💥 {W}")
        new_sesson()
        time.sleep(3)
        print("")
        print(f"{R}[{W}-{R}]{G} check the new session for more info 👀 {W}")
        time.sleep(5)
        change_setting()
def box_version():
    os.system("clear")
    photo()
    print(f"{R}[{W}-{R}]{G}{BOLD} select box version: {W}")
    print("")
    print(f"{Y} 1) SAFE-BOX {W}")
    print(f"{Y} 2) Compile and update BOX64 {W}")
    print(f"{Y} 3) BOX86 FOR none-wow64 Wine version {W}")
    print(f"{Y} else) CANCEL AND BACK {W}")
    print("")
    choice = input()
    file_path64 = "/data/data/com.termux/files/usr/glibc/bin/box64"
    file_path86 = "/data/data/com.termux/files/usr/glibc/bin/box86"
    if choice not in ["1", "2", "3"]:
        change_setting()
    elif choice == "1":
        if os.path.exists(file_path64):
            os.remove(file_path64)
        if os.path.exists(file_path86):
            os.remove(file_path86)
        os.system("tar -xJf $PREFIX/glibc/opt/box/safe-box.tar.xz -C $PREFIX/glibc/bin/")
        os.system("chmod +x $PREFIX/glibc/bin/box86")
        os.system("chmod +x $PREFIX/glibc/bin/box64") 
        change_setting()
    elif choice == "2":
        if os.path.exists(file_path64):
            os.remove(file_path64)
        print(f"{R}[{W}-{R}]{G}{BOLD} compiling.... {W}")
        os.system("apt install cmake-glibc make-glibc python-glibc -y &>/dev/null")
        Compile()
        os.system("mv //data/data/com.termux/files/home/box64/build/box64 $PREFIX/glibc/bin/")
        os.system("chmod +x $PREFIX/glibc/bin/box64")
        shutil.rmtree('/data/data/com.termux/files/home/box64')
        print(f"{G}{BOLD} done {W}")
        time.sleep(2)
        change_setting()
    elif choice == "3":
        os.system("wget https://github.com/ahmad1abbadi/darkos/releases/download/beta/box.tar.xz")
        if os.path.exists(file_path64):
            os.remove(file_path64)
        if os.path.exists(file_path86):
            os.remove(file_path86)
        os.system("tar -xJf box.tar.xz -C $PREFIX/glibc/bin/")
        os.system("chmod +x $PREFIX/glibc/bin/box86")
        os.system("chmod +x $PREFIX/glibc/bin/box64")
        change_setting()
def reload():
    file_path = os.path.expanduser("~/.termux/termux.properties")
    with open(file_path, "r") as file:
        lines = file.readlines()
    with open(file_path, "w") as file:
        for line in lines:
            if line.startswith("# allow-external-apps = true"):
                line = line.replace("# ", "")
            file.write(line)
            #print(f"File updated: {file_path}")
    os.system("termux-reload-settings")
def new_sesson():
    os.system("am startservice --user 0 -n com.termux/com.termux.app.RunCommandService \
    -a com.termux.RUN_COMMAND \
    --es com.termux.RUN_COMMAND_PATH '/data/data/com.termux/files/usr/bin/bash' \
    --esa com.termux.RUN_COMMAND_ARGUMENTS '/data/data/com.termux/files/usr/bin/boost_launcher' \
    --es com.termux.RUN_COMMAND_WORKDIR '/data/data/com.termux/files/home' \
    --ez com.termux.RUN_COMMAND_BACKGROUND 'false' \
    --es com.termux.RUN_COMMAND_SESSION_ACTION '1' &> /dev/null ")
def main_menu():
    os.system("clear")
    photo()
    print(f"{R}[{W}-{R}]{G}{BOLD} welcome to darkos safe mode {W}")
    print("")
    print(f"{R}[{W}-{R}]{G}{BOLD} Select what you need to do: {W}")
    print(f"{Y} 1) START DARK OS IN SAFE MODE 🚑 {W}")
    print(f"{Y} 2) SETTINGS ⚙️ {W}")
    print(f"{Y} 3) EXIT SAFE MODE 🚪 {W}")
    print(f"{Y} 4) KILL DARK OS AND EXIT TO TERMINAL 😭 {W}")
    print("")
    main()
    choice = input()
    if choice != "1" and choice != "2" and choice != "3" and choice != "4":
        print(f"{R} wrong {W}")
        main_menu()
    elif choice == "1":
        wine_container()
    elif choice == "2":
        change_setting()
    elif choice == "3":
        print("")
        os.system("clear")
        photo()
        print("")
        print(f"{R}[{W}-{R}]{G}{BOLD} Restarting..... {W}")
        time.sleep(1)
        print("")
        subprocess.run(["bash", "darkos"])
    elif choice == "4":
        print("")
        os.system("clear")
        photo()
        print("")
        print(f"{R}[{W}-{R}]{C}{BOLD} good bye 😭 {W}")
        os.system('pkill -f "app_process / com.termux.x11"')
        os.system('pkill -f pulseaudio')
        os._exit(0)
start_darkos()
main_menu()


================================================
FILE: debug-darkos.py
================================================
import os
import re
import subprocess
import time
import threading

R = "\033[1;31m"
G = "\033[1;32m"
Y = "\033[1;33m"
B = "\033[1;34m"
C = "\033[1;36m"
W = "\033[1;37m"
BOLD = "\033[1m"

exec(open('/data/data/com.termux/files/usr/glibc/opt/wine/os.conf').read())
exec(open('/sdcard/darkos/darkos_dynarec.conf').read())
exec(open('/sdcard/darkos/darkos_dynarec_box86.conf').read())
exec(open('/sdcard/darkos/darkos_custom.conf').read())
os.environ["BOX64_TRACE_FILE"]="/sdcard/darkos/trace/trace-%pid.txt"
os.system("BOX64_LOG=1 BOX64_SHOWSEGV=1 BOX64_DYNAREC_LOG=1 BOX64_DYNAREC_MISSING=1 WINEDEBUG=warn+all BOX64_DLSYM_ERROR=1 WINEDEBUG=+err taskset -c 4-7 box64 wine64 explorer /desktop=shell,800x600 $PREFIX/glibc/opt/apps/DARKOS_configuration.exe >/sdcard/darkos/darkos.log 2>&1 &")
os.system("am start -n com.termux.x11/com.termux.x11.MainActivity &>/dev/null")
os.system("clear")
os.system("python3 $PREFIX/bin/photo.py")

def colored_input(prompt):
    print(f"{R}[{W}-{R}]{G}{BOLD} {prompt} {W}", end="")
    user_input = input()
    return user_input

def recreate_prefix():
    os.system("clear")
    os.system("python3 $PREFIX/bin/photo.py")
    print(f"{R}[{W}-{R}]{G}{BOLD} select wine to recreate: {W}")
    
    wine_paths = {
        "1": "/data/data/com.termux/files/usr/glibc/opt/wine/1/wine/bin",
        "2": "/data/data/com.termux/files/usr/glibc/opt/wine/2/wine/bin",
        "3": "/data/data/com.termux/files/usr/glibc/opt/wine/3/wine/bin"
    }
    
    for key, path in wine_paths.items():
        if os.path.exists(path):
            if key == "1":
                print(f"{Y} 1) wine 1 {W}")
            if key == "2":
                print(f"{Y} 2) wine 2 {W}")
            if key == "3":
                print(f"{Y} 3) wine 3 {W}")
    
    print(f"{Y} Else) Back to the settings menu {W}")
    print("")
    
    prefix_path = colored_input("Enter your selection:")
    
    if prefix_path not in wine_paths.keys():
      print(f"{R} no prefix found backing to debug menu {W}")
      time.sleep(1)
      reboot()
    else:
      conf_path = f"/data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/os.conf"
      wine_prefix = f"/data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/.wine"
      os.system("chmod +x $PREFIX/glibc/bin/box86")
      os.system("chmod +x $PREFIX/glibc/bin/box64")
      os.system(f"chmod +x /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wine")
      os.system(f"chmod +x /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wine64")
      os.system(f"chmod +x /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wineserver")
      os.system("patchelf --force-rpath --set-rpath $PREFIX/glibc/lib --set-interpreter $PREFIX/glibc/lib/ld-linux-aarch64.so.1 $PREFIX/glibc/bin/box64")
      os.system("patchelf --force-rpath --set-rpath $PREFIX/glibc/lib32 --set-interpreter $PREFIX/glibc/lib32/ld-linux-armhf.so.3 $PREFIX/glibc/bin/box86")
      os.system("rm -rf $PREFIX/glibc/bin/wine $PREFIX/glibc/bin/wine64 $PREFIX/glibc/bin/wineserver")
      os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wine $PREFIX/glibc/bin/wine")
      os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wine64 $PREFIX/glibc/bin/wine64")
      os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wineserver $PREFIX/glibc/bin/wineserver")
      os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{prefix_path}/wine/bin/wineboot $PREFIX/glibc/bin/wineboot")
      os.system(f"ln -sf /data/data/com.termux/files/us/glibc/opt/wine/{prefix_path}/wine/bin/winecfg $PREFIX/glibc/bin/winecfg")
      os.environ.pop('LD_PRELOAD', None)
      def prefix_gstreamer():
        print(f"{R}[{W}-{R}]{G}{BOLD} Creating wine prefix 💫 {W}")
        os.environ.pop('BOX86_DYNAREC_BIGBLOCK', None)
        os.environ.pop('BOX64_DYNAREC_BIGBLOCK', None)
        os.environ.pop('WINEESYNC', None)
        os.environ.pop('WINEESYNC_TERMUX', None)
        os.environ.pop('BOX86_DYNAREC_CALLRET', None)
        os.environ.pop('BOX64_DYNAREC_CALLRET', None)
        os.system(f'WINEDLLOVERRIDES="mscoree=disabled,winegstreamer=disable" box64 wine64 wineboot &>/dev/null')
        os.system(f'cp -r $PREFIX/glibc/opt/Startxmenu/* "{wine_prefix}/drive_c/ProgramData/Microsoft/Windows/Start Menu"')
        os.system(f'rm "{wine_prefix}/dosdevices/z:"')
        os.system(f'ln -s /sdcard/Download "{wine_prefix}/dosdevices/o:" &>/dev/null')
        os.system(f'ln -s /sdcard/darkos "{wine_prefix}/dosdevices/e:" &>/dev/null')
        os.system(f'ln -s /data/data/com.termux/files "{wine_prefix}/dosdevices/z:"')
        print(f"{R}[{W}-{R}]{G}{BOLD} Installing DXVK+Zink... {W}")
        os.system(f'box64 wine "$PREFIX/glibc/opt/apps/Install OS stuff.bat" &>/dev/null')
        print(f"{G} Done! {W}") 
        print(f"{R}[{W}-{R}]{G}{BOLD} prefix done enjoy 🤪 {W}")
        time.sleep(1)
        os.system("box64 wineserver -k &>/dev/null")
        print(f"{R}[{W}-{R}]{G}{BOLD} os will start on debug mode see log file if there any issues {W}")
        time.sleep(2)
        os.system("BOX86_LOG=2 BOX86_SHOWSEGV=1 BOX86_DYNAREC_LOG=1 BOX86_DYNAREC_MISSING=1 BOX86_DLSYM_ERROR=1 BOX64_LOG=3 BOX64_SHOWSEGV=1 BOX64_DYNAREC_LOG=1 BOX64_DYNAREC_MISSING=1 BOX64_DLSYM_ERROR=1 taskset -c 4-7 box64 wine explorer /desktop=shell,800x600 $PREFIX/glibc/opt/apps/pc.ex >/sdcard/darkos.log 2>&1 &")
        os.system("am start -n com.termux.x11/com.termux.x11.MainActivity &>/dev/null")
        os.system("clear")
        os.system("python3 $PREFIX/bin/photo.py")
        print(f"{Y} exit 1️⃣ {W}")
        user_input = colored_input("Enter 1 to stop: ")
        if user_input == "1":
          os.system("box64 wineserver -k")
          print(f"{G} Exiting 👋 {w}")
          os.system('pkill -f "app_process / com.termux.x11"')
          os.system('pkill -f pulseaudio')
          reboot()
        if os.path.exists(wine_prefix):
          shutil.rmtree(wine_prefix)
          time.sleep(1)
          prefix_gstreamer()
      if not os.path.exists(wine_prefix):
        prefix_gstreamer()
def reboot():
  os.system("clear")
  os.system("python3 $PREFIX/bin/photo.py")
  print(f"{R}[{W}-{R}]{G}{BOLD} you are in debug mode... choose what you need to do : {W}")
  print(f"{R}[{W}-{R}]{C}{BOLD} note :- this option available just in safe mode. {W}")
  print("")
  print(f"{Y} 1) reboot debug in 32bit mode using box64 and box68 {W}")
  print(f"{Y} 2) recreate prefix {W}")
  print(f"{Y} 3) restart os {W}")
  print(f"{Y} 4) kill all proceeds and exit {W}")
  choice = input()
  if choice != "1" and choice != "2" and choice != "3" and choice != "4":
    reboot()
  elif choice == "1":
    exec(open('/data/data/com.termux/files/usr/glibc/opt/wine/os.conf').read())
    exec(open('/sdcard/darkos/darkos_dynarec.conf').read())
    exec(open('/sdcard/darkos/darkos_custom.conf').read())
    os.system("BOX64_LOG=1 BOX64_SHOWSEGV=1 BOX64_DYNAREC_LOG=1 BOX64_DYNAREC_MISSING=1 WINEDEBUG=warn+all BOX64_DLSYM_ERROR=1 WINEDEBUG=+err taskset -c 4-7 box64 wine explorer /desktop=shell,800x600 $PREFIX/glibc/opt/apps/DARKOS_configuration.exe >/sdcard/darkos/darkos.log 2>&1 &")
    os.system("am start -n com.termux.x11/com.termux.x11.MainActivity &>/dev/null")
    reboot()
  elif choice == "2":
    recreate_prefix()
  elif choice == "3":
      print("")
      os.system("box64 wineserver -k &>/dev/null")
      print(f"{R}[{W}-{R}]{G}{BOLD} Rebooting......... {W}")
      os.system('pkill -f "app_process / com.termux.x11"')
      os.system('pkill -f pulseaudio')
      time.sleep(1)
      subprocess.run(["bash", "darkos"])
  elif choice == "4":
      os.system("box64 wineserver -k")
      os.system('pkill -f "app_process / com.termux.x11"')
      os.system('pkill -f pulseaudio')
      print(f"{R}[{W}-{R}]{C}{BOLD} shutdown........ {W}")
      time.sleep(1)
      os.system("am startservice -a com.termux.service_stop com.termux/.app.TermuxService")
reboot()        
      
    


================================================
FILE: installO.sh
================================================
#!/bin/bash
echo 123


================================================
FILE: installOS.sh
================================================
#!/data/data/com.termux/files/usr/bin/bash
R="$(printf '\033[1;31m')"                           
G="$(printf '\033[1;32m')"
Y="$(printf '\033[1;33m')"
B="$(printf '\033[1;34m')"
C="$(printf '\033[1;36m')"                                       
W="$(printf '\033[1;37m')"
BOLD="$(printf '\033[1m')"

package_install_and_check() {
	packs_list=($@)
	for package_name in "${packs_list[@]}"; do
    echo "${R}[${W}-${R}]${G}${BOLD} Installing package: ${C}$package_name "${W}
    pkg install "$package_name" -y &>/dev/null
	if [ $? -ne 0 ]; then
    apt --fix-broken install -y
	dpkg --Configuring -a
    fi
	if dpkg -s "$package_name" >/dev/null 2>&1; then
    echo "${R}[${W}-${R}]${G} $package_name installed successfully "${W}
	else
	if
    type -p "$package_name" &>/dev/null || [ -e "$PREFIX/bin/$package_name"* ] || [ -e "$PREFIX/bin/"*"$package_name" ]; then
        echo "${R}[${W}-${R}]${C} $package_name ${G}installed successfully "${W}
	fi
    fi
done

}

pip_install_and_check() {
    pip_list=($@)
    for pip_name in "${pip_list[@]}"; do
        echo -e "${R}[${W}-${R}]${G}${BOLD} Installing module: ${C}$pip_name ${W}"
        pip install "$pip_name" &>/dev/null

        # Check if the installation was successful
        if [ $? -ne 0 ]; then
            echo -e "${R}[${W}-${R}]${R}${BOLD} Error installing: ${C}$pip_name ${W}"
        else
            if python3 -c "import $pip_name" &>/dev/null; then
                echo -e "${R}[${W}-${R}]${G} $pip_name installed successfully ${W}"
            else
                echo -e "${R}[${W}-${R}]${R}${BOLD} $pip_name installation failed ${W}"
            fi
	fi
    done
}

clear
echo -e "${G}${BOLD}Updating termux packages list please wait\n"${W}
apt update &>/dev/null
yes 2>/dev/null | apt-get --only-upgrade install termux-tools &>/dev/null
unlink "$PREFIX/etc/termux/chosen_mirrors" &>/dev/null
ln -s "$PREFIX/etc/termux/mirrors/all" "$PREFIX/etc/termux/chosen_mirrors" &>/dev/null
echo -e "${G}${BOLD}Selecting best termux packages mirror please wait\n"${W}
TERMUX_APP_PACKAGE_MANAGER=apt pkg --check-mirror update
clear
echo -e "${G}${BOLD}Upgrading termux packages...this might take some time\n"${W}
yes 2>/dev/null | apt-get full-upgrade &>/dev/null
echo -e "${C}${BOLD}please allow storage permission"${W}
while true; do
	termux-setup-storage
	sleep 4
    if [[ -d ~/storage ]]; then
        break
    else
        echo -e "${R}${BOLD}Storage permission denied\n"${W}
    fi
    sleep 2
done
echo -e "${G}${BOLD}be patient\n"${W}
package_install_and_check "python3 python-pip"
pip_install_and_check "tqdm"
curl -o installglibc.py https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/installglibc.py && python3 installglibc.py
exit

================================================
FILE: installglibc.py
================================================
import os, shutil, time
import subprocess
import zipfile
import tarfile
from tqdm import tqdm

R = "\033[1;31m"
G = "\033[1;32m"
Y = "\033[1;33m"
B = "\033[1;34m"
C = "\033[1;36m"
W = "\033[1;37m"
BOLD = "\033[1m"

def extract_archive(file_path, extract_to):
    if not os.path.exists(file_path):
        print(f"{R}File does not exist: {file_path}{W}")
        return

    if file_path.endswith('.zip'):
        with zipfile.ZipFile(file_path, 'r') as zip_ref:
            file_size = sum((file.file_size for file in zip_ref.infolist()))
            with tqdm(total=file_size, unit='B', unit_scale=True, desc=f'{G}Extracting{C}', bar_format='{l_bar}{bar}| {n_fmt}/{total_fmt} [{rate_fmt}{postfix}]') as pbar:
                for file in zip_ref.infolist():
                    zip_ref.extract(file, extract_to)
                    pbar.update(file.file_size)

    elif file_path.endswith('.tar.gz') or file_path.endswith('.tgz') or file_path.endswith('.tar'):
        with tarfile.open(file_path, 'r') as tar_ref:
            file_size = sum((file.size for file in tar_ref.getmembers()))
            with tqdm(total=file_size, unit='B', unit_scale=True, desc=f'{G}Extracting{C}', bar_format='{l_bar}{bar}| {n_fmt}/{total_fmt} [{rate_fmt}{postfix}]') as pbar:
                for file in tar_ref.getmembers():
                    tar_ref.extract(file, extract_to)
                    pbar.update(file.size)

    elif file_path.endswith('.tar.xz') or file_path.endswith('.txz'):
        with tarfile.open(file_path, 'r:xz') as tar_ref:
            file_size = sum((file.size for file in tar_ref.getmembers()))
            with tqdm(total=file_size, unit='B', unit_scale=True, desc=f'{G}Extracting{C}', bar_format='{l_bar}{bar}| {n_fmt}/{total_fmt} [{rate_fmt}{postfix}]') as pbar:
                for file in tar_ref.getmembers():
                    tar_ref.extract(file, extract_to)
                    pbar.update(file.size)

    else:
        print(f"{R}Unsupported file format{W}")
        return

    try:
        os.remove(file_path)
    except Exception as e:
        print(f"{R}Error deleting archive file: {str(e)}{W}")

def package_install_and_check(*packs_list):
    for package_name in packs_list:
        print(f"{R}[{W}-{R}]{G}{BOLD} Installing package: {C}{package_name} {W}")
        result = subprocess.run(["pkg", "install", package_name, "-y"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
        if result.returncode != 0:
            subprocess.run(["apt", "--fix-broken", "install", "-y", "--no-install-recommends"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
            subprocess.run(["dpkg", "--configure", "-a"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
        
        if subprocess.run(["dpkg", "-s", package_name], stdout=subprocess.PIPE, stderr=subprocess.PIPE).returncode == 0:
            print(f"{R}[{W}-{R}]{G}{BOLD} {package_name} installed successfully {W}")
        else:
            which_output = shutil.which(package_name)
            if which_output:
                print(f"{R}[{W}-{R}]{G} {package_name} installed successfully {W}")
            else:
                print(f"{R}[{W}-{R}]{G} {package_name} installation failed {W}")
                
def check_and_backup(file_paths):

    home_dir = os.path.expanduser("~")
    full_path = os.path.join(home_dir, file_paths)

    if os.path.exists(full_path):
        backup_path = f"{full_path}.bak"
        os.rename(full_path, backup_path)

def start_darkos():
    os.system("clear")
    if "LD_PRELOAD" in os.environ:
        del os.environ["LD_PRELOAD"]
    print(f"{R}[{W}-{R}]{G}{BOLD} Starting {W}")
    os.system("termux-x11 :0 &>/dev/null &")
    os.system('pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 &>/dev/null')
    
def termux_pkg():
    print(f"{R}[{W}-{R}]{G}{BOLD} This takes a few minutes it depends on your internet connection {W}")
    package_install_and_check("glibc-repo", "x11-repo")
    print(f"{R}[{W}-{R}]{G}{BOLD} glibc-repo + x11-repo installed {W}")
    package_install_and_check("pulseaudio", "patchelf", "xkeyboard-config", "freetype", "fontconfig", "termux-x11-nightly", "termux-am", "zenity", "which", "alsa-lib-glibc", "bash", "curl", "sed", "cabextract")
    package_install_and_check("wget", "make", "libpng", "xorg-xrandr", "cmake", "unzip", "p7zip", "patchelf", "tur-repo", "tur-repo", "traceroute", "samba", "virglrenderer-android", "virglrenderer-mesa-zink", "zenity")
    print("")
def install_glibc_AZ():
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/glibc-darkos.tar.xz")
    os.system("tar -xJf glibc-darkos.tar.xz -C $PREFIX/")
def update():
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/update.tar.xz")
    extract_archive('update.tar.xz','/data/data/com.termux/files/home/')
def alsa():
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/alsa.tar.xz")
    extract_archive('alsa.tar.xz','/data/data/com.termux/files/')

def mangohud():
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/mangohud.tar.xz")
    os.system("tar -xJvf mangohud.tar.xz -C $PREFIX/glibc &>/dev/null")
    os.remove("mangohud.tar.xz")
def install_AZ():
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/AZ.tar.xz")
    extract_archive('AZ.tar.xz','/data/data/com.termux/files/usr/glibc/')
def install_box():
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/box.tar.xz")
    extract_archive('box.tar.xz','/data/data/com.termux/files/usr/glibc/bin')
def install_conf():
    folder_path = "/sdcard/darkos"
    if os.path.exists(folder_path):
        shutil.rmtree(folder_path)
    os.mkdir(folder_path)
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/darkos.tar.xz")
    extract_archive('darkos.tar.xz','/sdcard/')

def edit_bashrc():
    command = "darkos"
    shell_rc_path = None
    current_shell = os.environ.get('SHELL', '').split('/')[-1]
    shell_config_files = {
        'bash': '.bashrc',
        'zsh': '.zshrc',
    }
    
    if current_shell in shell_config_files:
        shell_rc_path = os.path.expanduser(f'~/{shell_config_files[current_shell]}')

    if shell_rc_path:
        command_exists = False
        if os.path.exists(shell_rc_path):
            with open(shell_rc_path, 'r') as f:
                for line in f:
                    if command in line:
                        command_exists = True
                        print(f"Command '{command}' already exists in {current_shell} config file.")
                        print("Welcome back again ☺️")
                        break
        if not command_exists:
            with open(shell_rc_path, 'a') as f:
                f.write(command + '\n')
            #print(f"Command '{command}' added to {current_shell} config file.")
    else:
        print("Current shell is not supported or cannot be determined.")
def create_prefix():
    conf_path = f"/data/data/com.termux/files/usr/glibc/opt/wine/1/os.conf"
    wine_prefix = f"/data/data/com.termux/files/usr/glibc/opt/wine/1/.wine"
    os.system("ln -s $PREFIX/glibc/opt/wine/1/wine/bin/wine $PREFIX/glibc/bin/wine &>/dev/null")
    os.system("ln -s $PREFIX/glibc/opt/wine/1/wine/bin/wine64 $PREFIX/glibc/bin/wine64 &>/dev/null")
    os.system("ln -s $PREFIX/glibc/opt/wine/1/wine/bin/wineserver $PREFIX/glibc/bin/wineserver &>/dev/null")
    os.system("ln -s $PREFIX/glibc/opt/wine/1/wine/bin/wineboot $PREFIX/glibc/bin/wineboot &>/dev/null")
    os.system("ln -s $PREFIX/glibc/opt/wine/1/wine/bin/winecfg $PREFIX/glibc/bin/winecfg &>/dev/null")
    os.system("chmod +x $PREFIX/glibc/bin/box86")
    os.system("chmod +x $PREFIX/glibc/bin/box64")
    os.system("chmod +x /data/data/com.termux/files/usr/glibc/opt/wine/1/wine/bin/wine")
    os.system("chmod +x /data/data/com.termux/files/usr/glibc/opt/wine/1/wine/bin/wine64")
    os.system("chmod +x /data/data/com.termux/files/usr/glibc/opt/wine/1/wine/bin/wineserver")
    exec(open(conf_path).read())
    os.environ.pop('LD_PRELOAD', None)
    print(f"{R}[{W}-{R}]{G}{BOLD} Creating wine prefix 💫 {W}")
    os.system(f"tar -xJf $PREFIX/glibc/opt/darkos/XinputBridge.tar.xz -C /data/data/com.termux/files/usr/glibc/opt/wine/1/wine/lib/wine/ &>/dev/null")
    os.system(f'WINEUSERNAME="DARKOS" WINEDLLOVERRIDES="mscoree=disabled" box64 wine64 wineboot &>/dev/null')
    os.system(f'cp -r $PREFIX/glibc/opt/Startxmenu/* "{wine_prefix}/drive_c/ProgramData/Microsoft/Windows/Start Menu"')
    os.system(f'rm "{wine_prefix}/dosdevices/z:"')
    os.system(f'ln -s /sdcard/Download "{wine_prefix}/dosdevices/o:" &>/dev/null')
    os.system(f'ln -s /data/data/com.termux/files/usr/glibc/opt/G_drive "{wine_prefix}/dosdevices/g:" &>/dev/null')
    os.system(f'ln -s /sdcard/darkos "{wine_prefix}/dosdevices/e:" &>/dev/null')
    os.system(f'ln -s /data/data/com.termux/files "{wine_prefix}/dosdevices/z:"')
    print(f"{R}[{W}-{R}]{G}{BOLD} Installing OS stuff... {W}")
    os.system(f'box64 wine "$PREFIX/glibc/opt/apps/Install OS stuff.bat" &>/dev/null')
    print(f"{R}[{W}-{R}]{G}{BOLD} Done! {W}")
    print(f"{R}[{W}-{R}]{G}{BOLD} prefix done enjoy 🤪 {W}")
    time.sleep(3)
    os.system("box64 wineserver -k &>/dev/null")
    print(f'{R}[{W}-{R}]{G}{BOLD} done {W}')
    print("")
    print(f"{R}[{W}-{R}]{G}{BOLD} Starting DARK OS {W}")
    time.sleep(2)
    os.system("python3 $PREFIX/bin/run-darkos.py")
def install_mono():
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/mono.tar.xz")
    extract_archive('mono.tar.xz','/data/data/com.termux/files/home/')
def install_wine9():
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/wine-default.tar.xz")
    extract_archive('wine-default.tar.xz','/data/data/com.termux/files/usr/glibc/opt/wine/1/')
    os.system("apt reinstall vulkan-icd-loader-glibc -y &>/dev/null")
def scripts():
    os.system("wget https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/update-darkos.py &>/dev/null")
    os.system("wget https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/debug-darkos.py &>/dev/null")
    os.system("wget https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/setting-darkos.py &>/dev/null")
    os.system("wget https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/photo.py &>/dev/null")
    os.system("wget https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/darkos &>/dev/null")
    os.system("wget https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/run-darkos.py &>/dev/null")
    os.system("wget https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/darkos.py &>/dev/null")
    os.system("wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks &>/dev/null")
    os.system("wget https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/cpu_boost.py &>/dev/null")
    os.system("wget https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/boost_launcher &>/dev/null")
    os.system("wget https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/pip_fixer &>/dev/null")
    os.system("chmod +x darkos")
    os.system("chmod +x winetricks")
    os.system("chmod +x boost_launcher")
    os.system("chmod +x pip_fixer")
    os.system("chmod +x $PREFIX/glibc/opt/scripts/termux-x11.sh")
    os.system("mv darkos update-darkos.py darkos.py winetricks setting-darkos.py debug-darkos.py run-darkos.py cpu_boost.py photo.py boost_launcher pip_fixer $PREFIX/bin/")
    check_and_backup(".termux/colors.properties")
    os.system("wget -O $HOME/.termux/colors.properties https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/terminal_utility/colors.properties &>/dev/null")
    check_and_backup(os.getenv("PREFIX") + "/etc/motd-playstore")
    check_and_backup(os.getenv("PREFIX") + "/ect/motd")
    os.system("wget -O $PREFIX/etc/darkos-motd.sh https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/terminal_utility/darkos-motd.sh &>/dev/null")
    os.system(f'echo "bash {os.getenv("PREFIX")}/etc/darkos-motd.sh" >> {os.getenv("PREFIX")}/etc/termux-login.sh')
    check_and_backup(".termux/font.ttf")
    os.system("wget -O $HOME/.termux/font.ttf https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/terminal_utility/ubuntu-mono.ttf &>/dev/null")
def remove():
    os.system("rm glibc-darkos.tar.xz install installglibc.py")
    os.system("clear")
os.system("clear")
print(f"{R}[{W}-{R}]{G}{BOLD} DarkOS installation is begining 😉 {W}")
print("")
edit_bashrc()
print("")
print(f"{R}[{W}-{R}]{G}{BOLD} please wait ....... {W}")
termux_pkg()
print(" 👣")
install_glibc_AZ()
print(" 👣 👣 ")
mangohud()
print(" 👣 👣 👣")
install_conf()
print(" 👣 👣 👣 👣")
install_AZ()
print(" 👣 👣 👣 👣 👣")
install_mono()
print(" 👣 👣 👣 👣 👣 👣")
install_wine9()
print(" 👣 👣 👣 👣 👣 👣 👣")
install_box()
print(" 👣 👣 👣 👣 👣 👣 👣 👣")
update()
print(" 👣 👣 👣 👣 👣 👣 👣 👣 👣 ")
alsa()
print(" 👣 👣 👣 👣 👣 👣 👣 👣 👣 👣")
scripts()
print(" 👣 👣 👣 👣 👣 👣 👣 👣 👣 👣👣")
remove()
print(f"{R}[{W}-{R}]{G}{BOLD}   Installation finished successfully {W}")
print("")
start_darkos()
create_prefix()


================================================
FILE: logo
================================================
#!/bin/bash

vlc --fullscreen --x11-display=:0.0 --quiet --play-and-exit $PREFIX/glibc/opt/darkos/logo.mp4 && exit


================================================
FILE: new-update.py
================================================
import os, time, shutil, sys, subprocess, urllib.request, urllib.error, fnmatch

R = "\033[1;31m"
G = "\033[1;32m"
Y = "\033[1;33m"
B = "\033[1;34m"
C = "\033[1;36m"
W = "\033[1;37m"
BOLD = "\033[1m"

file_path = "/data/data/com.termux/files/usr/glibc/opt/box/V2.8( 5 june).tar.xz"
file_path2 = "/data/data/com.termux/files/usr/glibc/opt/box/V2.8( 3 july).tar.xz"
file_path3 = "/data/data/com.termux/files/usr/glibc/opt/box/V2.7( 3 mar).tar.xz"
file_path4 = "/data/data/com.termux/files/usr/glibc/opt/box/V2.7( 14 feb).tar.xz"
def update_remove():
  if os.path.exists(file_path):
          os.remove(file_path)
  if os.path.exists(file_path2):
          os.remove(file_path2)
  if os.path.exists(file_path3):
          os.remove(file_path3)
  if os.path.exists(file_path4):
          os.remove(file_path4)
def pg():
  os.system("apt install traceroute samba -y")
def mangohud():
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/mangohud.tar.xz")
    os.system("tar -xJvf mangohud.tar.xz -C $PREFIX/glibc &>/dev/null")
    os.remove("mangohud.tar.xz")
def update():
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/update.tar.xz")
    os.system("tar -xJf update.tar.xz")
    os.remove("update.tar.xz")    
def update_files():
  os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/files.tar.xz")
  os.system("tar -xJf files.tar.xz -C /data/data/com.termux/files/")
  os.remove("files.tar.xz")
    
current_version = "0.971"
update_remove()
update_files()
pg()
print(current_version)
print(f"{Y}update complete")
time.sleep(2)
exit()


================================================
FILE: photo.py
================================================
print("\033[36m")
print("""
  .+"+.+"+.+"+.+"+.+"+.+"+.+"+.+"+.+"+.+"+.+"+.+"+. 
 (     (              (         )    )   (         )
  )    )\ )    (      )\ )   ( /( ( /(   )\ )     ( 
 (    (()/(    )\    (()/(   )\()))\()) (()/(      )
  )    /(_))((((_)(   /(_))|((_)\((_)\   /(_))    ( 
 (    (_))_  )\ _ )\ (_))  |_ ((_) ((_) (_))       )
  )    |   \ (_)_\(_)| _ \ | |/ / / _ \ / __|     ( 
 (     | |) | / _ \  |   /   ' < | (_) |\__ \      )
  )    |___/ /_/ \_\ |_|_\  _|\_\ \___/ |___/     ( 
 (                                                 )
  "+.+"+.+"+.+"+.+"+.+"+.+"+.+"+.+"+.+"+.+"+.+"+.+" 
""")
print("\033[0m")

================================================
FILE: pip_fixer
================================================
#!/bin/bash

_file="$(find $PREFIX/lib/python3.11 -name "_sysconfigdata*.py")"
rm -rf $PREFIX/lib/python3.11/_pycache_
cp $_file "$_file".backup
sed -i 's|-fno-openmp-implicit-rpath||g' "$_file"

================================================
FILE: run-darkos.py
================================================
import os
import re
import subprocess
import time
import threading
import shutil
import sys, urllib.request, urllib.error


R = "\033[1;31m"
G = "\033[1;32m"
Y = "\033[1;33m"
B = "\033[1;34m"
C = "\033[1;36m"
W = "\033[1;37m"
BOLD = "\033[1m"

def extract_and_delete_tar_files():
    search_paths = [
        "/data/data/com.termux/files/usr/glibc/opt/temp/box",
        "/data/data/com.termux/files/usr/glibc/opt/wine/5",
        "/data/data/com.termux/files/usr/glibc/opt/wine/4",
        "/data/data/com.termux/files/usr/glibc/opt/wine/2",
        "/data/data/com.termux/files/usr/glibc/opt/wine/3"
    ]
    for path in search_paths:
        for filename in os.listdir(path):
            if filename.endswith(".tar"):
                tar_file = os.path.join(path, filename)
                if os.path.exists(os.path.join(path, ".wine")):
                    shutil.rmtree(os.path.join(path, ".wine"))
                if os.path.exists(os.path.join(path, "wine")):
                    shutil.rmtree(os.path.join(path, "wine"))
                subprocess.run(["tar", "-xf", tar_file, "-C", path])
                os.remove(tar_file)
                if os.path.exists(os.path.join(path, "box64")):
                    destination_path = "/data/data/com.termux/files/usr/glibc/bin/box64"
                    if os.path.exists(destination_path):
                        os.remove(destination_path)
                    shutil.move(os.path.join(path, "box64"), destination_path)
                    time.sleep(1)
def load_conf():
    conf_paths = [
        "/data/data/com.termux/files/usr/glibc/opt/wine/os.conf",
        "/data/data/com.termux/files/usr/glibc/opt/darkos/res.conf",
        "/data/data/com.termux/files/usr/glibc/opt/darkos/language.conf",
        "/sdcard/darkos/darkos_dynarec.conf",
        "/sdcard/darkos/darkos_dynarec_box86.conf",
        "/sdcard/darkos/darkos_custom.conf",
        "/data/data/com.termux/files/usr/glibc/opt/scripts/hud-settings.conf"
    ]
    for conf_path in conf_paths:
        exec(open(conf_path).read(), globals())
    os.system("chmod +x $PREFIX/glibc/bin/box86")
    os.system("chmod +x $PREFIX/glibc/bin/box64")
def create_wine_prefix():
    if not os.path.exists(f"/data/data/com.termux/files/usr/glibc/opt/wine/{container}/wine/bin/wine64"):
        os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{container}/wine/bin/wine $PREFIX/glibc/bin/wine64")
        os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/{container}/wine/bin/wine $PREFIX/glibc/opt/wine/{container}/wine/bin/wine64")
    print(f"{R}[{W}-{R}]{G}{BOLD} Creating wine prefix 💫 {W}")
    os.system(f'WINEDLLOVERRIDES="mscoree=disabled" taskset -c 4-7 box64 wine64 wineboot -u &>/dev/null')
    os.system(f'cp -r $PREFIX/glibc/opt/Startxmenu/* "{wine_prefix}/drive_c/ProgramData/Microsoft/Windows/Start Menu"')
    os.system(f'rm "{wine_prefix}/dosdevices/z:"')
    os.system(f'ln -s /sdcard/Download "{wine_prefix}/dosdevices/o:" &>/dev/null')
    os.system(f'ln -s /data/data/com.termux/files/usr/glibc/opt/G_drive "{wine_prefix}/dosdevices/g:" &>/dev/null')
    os.system(f'ln -s /sdcard/darkos "{wine_prefix}/dosdevices/e:" &>/dev/null')
    os.system(f'ln -s /data/data/com.termux/files "{wine_prefix}/dosdevices/z:"')
    print(f"{R}[{W}-{R}]{G}{BOLD} Installing OS stuff... {W}")
    os.system(f'box64 wine64 "$PREFIX/glibc/opt/apps/Install OS stuff.bat" &>/dev/null')
    if os.path.exists(f"/data/data/com.termux/files/usr/glibc/opt/wine/{container}/add-ons.bat"):
        os.system(f'box64 wine64 "$PREFIX/glibc/opt/wine/{container}/wine/add-ons.bat" &>/dev/null')
        print("add-ons installed")
        os.remove(f"/data/data/com.termux/files/usr/glibc/opt/wine/{container}/add-ons.bat")
    print(f"{R}[{W}-{R}]{G}{BOLD} Done! {W}")
    print(f"{G}{BOLD} prefix done enjoy 🤪 {W}")
    time.sleep(1)
    os.system("box64 wineserver -k &>/dev/null")
    print(f"{G}{BOLD} rebooting..... {W}")
    time.sleep(1)
    subprocess.run(["bash", "darkos"])
    exit()
def start_wine():
    os.system("$PREFIX/glibc/opt/scripts/termux-x11.sh displayResolutionMode:custom &>/dev/null &")
    os.system(f"$PREFIX/glibc/opt/scripts/termux-x11.sh displayResolutionCustom:{res} &>/dev/null &")
    os.system("box64 wine64 explorer /desktop=shell," + res + " $PREFIX/glibc/opt/apps/DARKOS_configuration.exe &>/dev/null &")
    os.system("am start -n com.termux.x11/com.termux.x11.MainActivity &>/dev/null")
    os.system("clear")
    os.system("python3 $PREFIX/bin/photo.py")
    print("")
    print(f" {R}{BOLD}D{G}{BOLD}A{Y}{BOLD}R{B}{W}{BOLD}K{R}{BOLD} O{C}{BOLD}S{G}{BOLD} is running...... {W}")
    print("")
    print(f"{G}{BOLD} Please choose an option: ")
    print("")
    print(f"{G}{BOLD} (1) for {C}SHUTDOWN{W}")
    print("")
    print(f"{G}{BOLD} (2) for exit to the {C}terminal{W}")
    print("")
    print(f"{G}{BOLD} Simply press any other key to {C}REBOOT{W}")
    print("")
def restart_wine():
    while True:
        file_path = "/data/data/com.termux/files/usr/glibc/opt/darkos/file.reboot"
        while os.path.exists(file_path):
            time.sleep(1) 
        os.system("box64 wineserver -k &>/dev/null")
        print(f"{G}{BOLD} Restarting WINE {W}")
        os.system("pkill -9 '.exe$'")
        os.system(f"touch {file_path}")
        restart_program() 
def update_wine():
    while True:
        file_path = "/data/data/com.termux/files/usr/glibc/opt/darkos/file.update"
        while os.path.exists(file_path):
            time.sleep(1)
        os.system("box64 wineserver -k &>/dev/null")
        print(f"{G}{BOLD} Restarting WINE {W}")
        os.system(f"touch {file_path}")
        os.system("python3 $PREFIX/bin/update-darkos.py")
        exit()
        
def stop_virgl():
    while True:
        file_path = "/data/data/com.termux/files/usr/glibc/opt/darkos/file.stop-virgl"
        while os.path.exists(file_path):
            time.sleep(1)
        os.system(f"touch {file_path}")
        os.system("killall virgl_test_server")
        os.system("ln -sf /data/data/com.termux/files/usr/glibc/lib/libGL.so.1.7.0 /data/data/com.termux/files/usr/glibc/lib/libGL.so.1")
        unset_path = "/data/data/com.termux/files/usr/glibc/opt/scripts/unset.conf"
        exec(open(unset_path).read(), globals())
def start_virgl():
    while True:
        file_path = "/data/data/com.termux/files/usr/glibc/opt/darkos/file.start-virgl"
        while os.path.exists(file_path):
            time.sleep(1)
        os.system(f"touch {file_path}")
        unset_path = "/data/data/com.termux/files/usr/glibc/opt/scripts/unset.conf"
        exec(open(unset_path).read(), globals())
        time.sleep(2)
        virgl_path = "/data/data/com.termux/files/usr/glibc/opt/scripts/virgl-settings.conf"
        exec(open(virgl_path).read(), globals())
def reload_style():
    while True:
        file_path = "/data/data/com.termux/files/usr/glibc/opt/darkos/file.style"
        while os.path.exists(file_path):
            time.sleep(1)
        os.system(f"touch {file_path}")  
        os.system("python3 $PREFIX/glibc/opt/scripts/theme-changer.py")
def shutdown_wine():
    while True:
        file_path = "/data/data/com.termux/files/usr/glibc/opt/darkos/file.shutdown"
        while os.path.exists(file_path):
            time.sleep(1) 
        os.system(f"touch {file_path}")
        stop_darkos()
def debug_wine():
    while True:
        file_path = "/data/data/com.termux/files/usr/glibc/opt/darkos/file.debug"
        while os.path.exists(file_path):
            time.sleep(1) 
        os.system("box64 wineserver -k &>/dev/null")
        print(f"{G}{BOLD} Restarting WINE {W}")
        os.system(f"touch {file_path}")
        os.system("python3 $PREFIX/bin/debug-darkos.py")
        exit()
def settings_wine():
    while True:
        file_path = "/data/data/com.termux/files/usr/glibc/opt/darkos/file.setting"
        while os.path.exists(file_path):
            time.sleep(1) 
        os.system("box64 wineserver -k &>/dev/null")
        print(f"{G}{BOLD} Restarting WINE {W}")
        os.system(f"touch {file_path}")
        os.system("chmod +x /data/data/com.termux/files/usr/bin/install.sh")
        os.system("am start -n com.termux/.app.TermuxActivity &>/dev/null")
        subprocess.run(["bash", "install.sh"])
        time.sleep(1)
        restart_program() 
def input_action():
    while True:
        stop = input()
        if stop != "1" and stop != "2":
            print("")
            print(f"{G}{BOLD} Rebooting......... {W}")
            os.system("box64 wineserver -k &>/dev/null")
            time.sleep(1)
            restart_program() 
        elif stop == "1":
            stop_darkos()
        elif stop == "2":
            os.system("box64 wineserver -k")
            os.system('pkill -f "app_process / com.termux.x11"')
            os.system('pkill -f pulseaudio')
            print(f"{G}{BOLD} exiting to the terminal goodbye {W}")
            time.sleep(2)
            os._exit(0)
def restart_program():
    extract_and_delete_tar_files()                
    load_conf()
    if not os.path.exists(wine_prefix):
        create_wine_prefix()
        extract_and_delete_tar_files()                
        load_conf()
    start_wine()
def stop_darkos():
    os.system("box64 wineserver -k")
    os.system('pkill -f "app_process / com.termux.x11"')
    os.system('pkill -f pulseaudio')
    print(f"{G}{BOLD} shutdown........ {W}")
    os.system("am startservice -a com.termux.service_stop com.termux/.app.TermuxService")
    os.system("pkill -f com.termux.x11")
    subprocess.run(['am', 'broadcast', '-a', 'com.termux.x11.ACTION_STOP', '-p', 'com.termux.x11'])
    os._exit(0)

restart_program()

thread1 = threading.Thread(target=restart_wine)
thread2 = threading.Thread(target=input_action)
thread3 = threading.Thread(target=update_wine)
thread4 = threading.Thread(target=settings_wine)
thread5 = threading.Thread(target=debug_wine)
thread6 = threading.Thread(target=shutdown_wine)
thread7 = threading.Thread(target=start_virgl)
thread8 = threading.Thread(target=stop_virgl)
thread9 = threading.Thread(target=reload_style)

thread1.start()
thread2.start()
thread3.start()
thread4.start()
thread5.start()
thread6.start()
thread7.start()
thread8.start()
thread9.start()


thread1.join()
thread2.join()
thread3.join()
thread4.join()
thread5.join()
thread6.join()
thread7.join()
thread8.join()
thread9.join()


================================================
FILE: setting-darkos.py
================================================
import os, time, shutil, sys, subprocess, urllib.request, urllib.error
import tarfile
import socket
import fnmatch
import zipfile
import tarfile
from tqdm import tqdm

R = "\033[1;31m"
G = "\033[1;32m"
Y = "\033[1;33m"
B = "\033[1;34m"
C = "\033[1;36m"
W = "\033[1;37m"
BOLD = "\033[1m" 

tar_xz_file_path ='/sdcard/darkos/airidosas252builds/wine.tar.xz'
target_folders = ['bin', 'lib', 'lib64', 'share']
destination_dir = '/data/data/com.termux/files/usr/glibc/opt/wine/3/wine'
root_dir = "/data/data/com.termux/files/usr/glibc/opt/temp"
os.system("am start -n com.termux/.HomeActivity")

def extract_archive(file_path, extract_to):
    if not os.path.exists(file_path):
        print(f"{R}File does not exist: {file_path}{W}")
        return

    if file_path.endswith('.zip'):
        with zipfile.ZipFile(file_path, 'r') as zip_ref:
            file_size = sum((file.file_size for file in zip_ref.infolist()))
            with tqdm(total=file_size, unit='B', unit_scale=True, desc=f'{G}Extracting{C}', bar_format='{l_bar}{bar}| {n_fmt}/{total_fmt} [{rate_fmt}{postfix}]') as pbar:
                for file in zip_ref.infolist():
                    zip_ref.extract(file, extract_to)
                    pbar.update(file.file_size)

    elif file_path.endswith('.tar.gz') or file_path.endswith('.tgz') or file_path.endswith('.tar'):
        with tarfile.open(file_path, 'r') as tar_ref:
            file_size = sum((file.size for file in tar_ref.getmembers()))
            with tqdm(total=file_size, unit='B', unit_scale=True, desc=f'{G}Extracting{C}', bar_format='{l_bar}{bar}| {n_fmt}/{total_fmt} [{rate_fmt}{postfix}]') as pbar:
                for file in tar_ref.getmembers():
                    tar_ref.extract(file, extract_to)
                    pbar.update(file.size)

    elif file_path.endswith('.tar.xz') or file_path.endswith('.txz'):
        with tarfile.open(file_path, 'r:xz') as tar_ref:
            file_size = sum((file.size for file in tar_ref.getmembers()))
            with tqdm(total=file_size, unit='B', unit_scale=True, desc=f'{G}Extracting{C}', bar_format='{l_bar}{bar}| {n_fmt}/{total_fmt} [{rate_fmt}{postfix}]') as pbar:
                for file in tar_ref.getmembers():
                    tar_ref.extract(file, extract_to)
                    pbar.update(file.size)

    else:
        print(f"{R}Unsupported file format{W}")
        return

def remove():
    folder_path = '/data/data/com.termux/files/home'
    for filename in os.listdir(folder_path):
        if fnmatch.fnmatch(filename, '*.tar.xz*'):
            file_path = os.path.join(folder_path, filename)
            os.remove(file_path)
            print(f'{C}{filename} {G}has been deleted.{W}')
def uninstall_wine9():
    if os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/1/wine/bin"):
        os.system("rm -r /data/data/com.termux/files/usr/glibc/opt/wine/1/wine")
        if os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/1/.wine"):
            shutil.rmtree('/data/data/com.termux/files/usr/glibc/opt/wine/1/.wine')
    if os.path.exists("/sdcard/darkos"):
        os.system("rm -r /sdcard/darkos")
def install_wine9():
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/AZ.tar.xz")
    extract_archive('AZ.tar.xz','/data/data/com.termux/files/usr/glibc/')
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/wine-default.tar.xz")
    extract_archive('wine-default.tar.xz','/data/data/com.termux/files/usr/glibc/opt/wine/1/')
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/darkos.tar.xz")
    extract_archive('darkos.tar.xz','/sdcard/')
    os.system("wget -q --show-progress https://github.com/ahmad1abbadi/darkos/releases/download/beta/update.tar.xz")
    extract_archive('update.tar.xz','/data/data/com.termux/files/home/')
    os.system("rm $PREFIX/bin/darkos.py")
    os.system("rm $PREFIX/bin/update-darkos.py")
    os.system("rm $PREFIX/bin/run-darkos.py")
    os.system("rm $PREFIX/bin/debug-darkos.py")
    os.system("rm $PREFIX/bin/setting-darkos.py")
    os.system("rm $PREFIX/bin/darkos")
    os.system("wget -O run-darkos.py https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/run-darkos.py")
    os.system("wget -O darkos.py https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/darkos.py")
    os.system("wget -O darkos https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/darkos")
    os.system("wget -O debug-darkos.py https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/debug-darkos.py")
    os.system("wget -O setting-darkos.py https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/setting-darkos.py")
    os.system("wget -O update-darkos.py https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/update-darkos.py")
    os.system("chmod +x darkos")
    os.system("mv update-darkos.py darkos.py run-darkos.py debug-darkos.py setting-darkos.py darkos $PREFIX/bin/")
    remove()
    print("")
    print(f"{G} DARKOS files repaired successfully {W}")
def internet_connected():
    try:
        socket.create_connection(("8.8.8.8", 53), timeout=1)
        return True
    except OSError:
        pass
    return False
def wine_manager():
  os.system("clear")
  photo()
  print(f"{R}[{W}-{R}]{G}{BOLD} Wine Manager ⚙️ {W}")
  print(f"{Y} 1) install wine manually in container 3 📥 {W}")
  print(f"{Y} 2) uninstall wine 📤 {W}")
  print(f"{Y} 3) Repair DARKOS files 🔧 {W}")
  print(f"{Y} 4) back to main menu 🔙  {W}")
  print("")
  choice = input()
  if choice != "1" and choice != "2" and choice != "3" and choice != "4" and choice != "dev":
    print("wrong")
    wine_manager()
  elif choice == "1":
    wine_select()
  elif choice == "dev":
    os.system("clear")
    conf_path = "/data/data/com.termux/files/usr/glibc/opt/wine/os.conf"
    print(f"{G}{BOLD} share log on our Telegram group {W}")
    print(f"{G}{BOLD} to exit dev mode {C} kill termux {G}or press {C}Ctrl + C {W}")
    exec(open(conf_path).read())
    exec(open('/sdcard/darkos/darkos_dynarec.conf').read())
    os.system("BOX86_LOG=1 BOX86_SHOWSEGV=1 BOX86_DYNAREC_LOG=1 BOX86_DYNAREC_MISSING=1 BOX86_DLSYM_ERROR=1 BOX64_LOG=1 BOX64_SHOWSEGV=1 BOX64_DYNAREC_LOG=1 BOX64_DYNAREC_MISSING=1 WINEDEBUG=warn+all BOX64_DLSYM_ERROR=1 WINEDEBUG=+err taskset -c 4-7 box64 wine explorer /desktop=shell,800x600 $PREFIX/glibc/opt/apps/pc.ex >/sdcard/darkos.log")
  elif choice == "2":
      uninstall_wine()
  elif choice == "3":
      print(f"{Y} Do you really want to repair Wine files ? This will delete all your files inside the drive C in container 1 {W}")
      print(f"{C} yes = y {W}")
      print(f"{C} no = n {W}")
      stop = input()
      if stop != "y" and choice != "n":
          print(f"{R} wrong choice going back to main menu {W}")
          time.sleep(1)
          wine_manager()
      elif stop == "y":
          if internet_connected():
               uninstall_wine9()
               time.sleep(1)
               install_wine9()
               print(f"{G} done.... {W}")
               time.sleep(1)
               wine_manager()
          else:
               print(f"{R} No internet connection available. Aborting operation. {W}")
               time.sleep(1)
               wine_manager()
      elif stop == "n":
          wine_manager()
  elif choice == "4":
      os.system("python3 $PREFIX/bin/darkos.py")
      os.system("exit")
def photo():
  os.system("python3 $PREFIX/bin/photo.py")
def uninstall_wine():
    os.system("clear")
    photo()
    print(f"{Y} Are you sure you want to delete the wine version? {W}")
    print("")
    
    for i in range(2, 6):
        if os.path.exists(f"/data/data/com.termux/files/usr/glibc/opt/wine/{i}/wine/bin"):
            print(f"{Y} {i - 1}) Delete wine on container {C}{i} {W}")
            
    print(f"{Y} else) setting menu ⬅️ {W}")
    print("")
    
    choice = input()
    
    if choice != "1" and choice != "2" and choice != "3" and choice != "4":
        print(f"{G} backing {W}")
        wine_manager()
    else:
        container_number = int(choice) + 1
        if os.path.exists(f"/data/data/com.termux/files/usr/glibc/opt/wine/{container_number}/wine/bin"):
            print(f"{G}{BOLD} Deleting wine, please wait.... {W}")
            print("")
            os.system(f"rm -r /data/data/com.termux/files/usr/glibc/opt/wine/{container_number}/wine")
            os.system("rm -r /data/data/com.termux/files/usr/glibc/opt/wine/os.conf")
            os.system("cp /data/data/com.termux/files/usr/glibc/opt/wine/1/os.conf /data/data/com.termux/files/usr/glibc/opt/wine")
        wine_manager()
def install_wine3():
    if os.path.exists("/sdcard/darkos/airidosas252builds/wine.tar.xz"):
        os.remove("/sdcard/darkos/airidosas252builds/wine.tar.xz")
    conf_path = f"/data/data/com.termux/files/usr/glibc/opt/wine/3/os.conf"
    wine_prefix = f"/data/data/com.termux/files/usr/glibc/opt/wine/3/.wine"
    exec(open(conf_path).read())
    print(f"{R}[{W}-{R}]{G}{BOLD} Creating wine prefix 💫 {W}")
    if not os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/3/wine/bin/wine64"):
        os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/3/wine/bin/wine $PREFIX/glibc/bin/wine64")
        os.system(f"ln -sf /data/data/com.termux/files/usr/glibc/opt/wine/3/wine/bin/wine $PREFIX/glibc/opt/wine/3/wine/bin/wine64")
    os.system(f'WINEDLLOVERRIDES="mscoree=disabled" box64 wine64 wineboot  >/sdcard/darkos/boot64_log.txt 2>&1')
    os.system(f'cp -r $PREFIX/glibc/opt/Startxmenu/* "{wine_prefix}/drive_c/ProgramData/Microsoft/Windows/Start Menu"')
    os.system(f'rm "{wine_prefix}/dosdevices/z:"')
    os.system(f'ln -s /sdcard/Download "{wine_prefix}/dosdevices/o:" &>/dev/null')
    os.system(f'ln -s /sdcard/darkos "{wine_prefix}/dosdevices/e:" &>/dev/null')
    os.system(f'ln -s /data/data/com.termux/files "{wine_prefix}/dosdevices/z:"')
    print(f"{R}[{W}-{R}]{G}{BOLD} Installing DXVK+Zink... {W}")
    os.system(f'box64 wine64 "$PREFIX/glibc/opt/apps/Install OS stuff.bat" &>/dev/null')
    print(f"{G}{BOLD} Done! {W}")
    print(f"{G}{BOLD} prefix done enjoy 🤪 {W}")
    print("to select installed wine please choose container 3 ")
    time.sleep(3)
    os.system("box64 wineserver -k &>/dev/null")
    time.sleep(1)
    wine_manager()
def wine_select():
    os.system("clear")
    photo()
    print(f"{C}{BOLD} welcome to installation airidosas bulid of wine . {Y} \nplease make sure you have wine setup file in this path {G}/sdcard/darkos/airidosas252builds/wine.tar.xz {W}")
    print("")
    if os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/3/wine/bin"):
        print(f"{R} error ...there is a wine installed in container 3 {W}")
    if not os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/3/wine/bin"):
        print("")
        print(f"{Y} 1) install airidosas252builds wine on container 3. {W}")
        print("")
        print(f"{G} please make sure you have renamed file to {C}wine.tar.xz {W}")
        print("")
    print(f"{Y} else) back to wine manger menu ⬅️ {W}")
    print("")
    choice = input()
    if choice != "1":
        print(f"{G} back to wine manger.... {W}")
        wine_manager()
    elif choice == "1":
        print(f"{G} installing airidosas252builds wine please wait..... {W}")
        print("")
        if not os.path.exists("/data/data/com.termux/files/usr/glibc/opt/wine/3/wine/bin"):
            if os.path.exists("/sdcard/darkos/airidosas252builds/wine.tar.xz"):
                extract_archive('/sdcard/darkos/airidosas252builds/wine.tar.xz','/data/data/com.termux/files/usr/glibc/opt/temp/')
            search_and_move_folders(root_dir, target_folders, destination_dir)
        install_wine3()
        time.sleep(1)
    wine_manager()
def search_and_move_folders(root_dir, target_folders, destination_dir):
    for root, dirs, files in os.walk(root_dir):
        for folder in dirs:
            if folder in target_folders:
                source_path = os.path.join(root, folder)
                destination_path = os.path.join(destination_dir, folder)
                if not os.path.exists(destination_path):
                    shutil.move(source_path, destination_path)
wine_manager()



================================================
FILE: shutdown.sh
================================================
#!/data/data/com.termux/files/usr/bin/bash

export PATH=/data/data/com.termux/files/usr/bin
unset LD_LIBRARY_PATH

sleep 1
box64 wineserver -k &>/dev/null
pkill -f "app_process / com.termux.x11"
pkill -f pulseaudio
sleep 1

exit 


================================================
FILE: terminal_utility/colors.properties
================================================
foreground=   #81B5AC
background=   #031A16
cursor=  #81B5AC

color0=       #031A16
color1=       #3E9688
color2=       #883E96
color3=       #3E4C96
color4=       #96883E
color5=       #4C963E
color6=       #963E4C
color7=       #81B5AC

color8=       #2B685E
color9=       #3E9688
color10=      #883E96
color11=      #3E4C96
color12=      #96883E
color13=      #4C963E
color14=      #963E4C
color15=      #D2E7E4

color16=      #3E7996
color17=      #3E965B
color18=      #0B342D
color19=      #184E45
color20=      #5F9C92
color21=      #A7CEC8

================================================
FILE: terminal_utility/darkos-motd.sh
================================================
#!/data/data/com.termux/files/usr/bin
W="\e[0;39m"
G="\e[1;32m"
C="\e[1;36m"
Y='\033[1;33m'
R="\e[1;31m"
BOLD='\033[1m'

if [[ -d /system/app/ && -d /system/priv-app ]]; then
    DISTRO="Android $(getprop ro.build.version.release)"
    MODEL="$(getprop ro.product.brand) $(getprop ro.product.model)"
fi
cpu=$(</sys/class/thermal/thermal_zone0/temp)
TEMP=$(echo $cpu | cut -c 1-2)
PROCESSOR_NAME=$(cat /proc/cpuinfo | grep Hardware | cut -d ' ' -f 2)
PROCESSOR_COUNT=$(grep -ioP 'processor\t:' /proc/cpuinfo | wc -l)

[[ "$TEMP" -lt "60" ]] && FG=${G}
[[ "$TEMP" -gt "60" ]] && FG=${Y}                      
[[ "$TEMP" -gt "75" ]] && FG=${R}

clear

LOGO="
██████╗░░█████╗░██████╗░██╗░░██╗   ░█████╗░░██████╗
██╔══██╗██╔══██╗██╔══██╗██║░██╔╝   ██╔══██╗██╔════╝
██║░░██║███████║██████╔╝█████═╝░   ██║░░██║╚█████╗░
██║░░██║██╔══██║██╔══██╗██╔═██╗░   ██║░░██║░╚═══██╗
██████╔╝██║░░██║██║░░██║██║░╚██╗   ╚█████╔╝██████╔╝
╚═════╝░╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░╚═╝   ░╚════╝░╚═════╝░
"

# get free memory
IFS=" " read USED AVAIL TOTAL <<<$(free -htm | grep "Mem" | awk {'print $3,$7,$2'})
printf "      %+25s ${G}${LOGO}${W}"
echo -e "
${W}${BOLD}System Info:
$C OS         :$W$BOLD Dark OS
$C Distro     : $W$DISTRO
$C Host       : $W$MODEL
$C Kernel     : $W$(uname -sr)
$C CPU        : $W$PROCESSOR_NAME ($G$PROCESSOR_COUNT$W vCPU)
$C Memory     : $G$USED$W used, $G$AVAIL$W avail, $G$TOTAL$W total$W
$C Temperature: $G${TEMP}°c$W"

max_usage=95
bar_width=45

# disk usage: ignore zfs, squashfs & tmpfs
mapfile -t dfs < <(df -H -t sdcardfs -t fuse -t fuse.rclone | tail -n+2)
printf "\n${BOLD}Disk Usage:${W}\n"

for line in "${dfs[@]}"; do
    # get disk usage
    usage=$(echo "$line" | awk '{print $5}' | sed 's/%//')
    used_width=$((($usage*$bar_width)/100))
    # color is green if usage < max_usage, else red
    if [ "${usage}" -ge "${max_usage}" ]; then
        color=$R
    else
        color=$G
    fi
    # print green/red bar until used_width
    bar="[${color}"
    for ((i=0; i<$used_width; i++)); do
        bar+="#"
    done
    # print dimmmed bar until end
    bar+="${white}${dim}"
    for ((i=$used_width; i<$bar_width; i++)); do
        bar+="-"
    done
    bar+="${undim}]"
    # print usage line & bar
    echo "${line}" | awk '{ printf("%-30s used %+1s of %+4s\n", $6, $3, $2); }' | sed -e 's/^/  /'
    echo -e "${bar}" | sed -e 's/^/  /'
done


================================================
FILE: update-darkos.py
================================================
import os, time, shutil, sys, subprocess, urllib.request, urllib.error, fnmatch

R = "\033[1;31m"
G = "\033[1;32m"
Y = "\033[1;33m"
B = "\033[1;34m"
C = "\033[1;36m"
W = "\033[1;37m"
BOLD = "\033[1m"

current_version = "0.971"
url = 'https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/currently%20version.txt'
def remove():
    folder_path = '/data/data/com.termux/files/home'
    for filename in os.listdir(folder_path):
        if fnmatch.fnmatch(filename, '*.tar.xz*'):
            file_path = os.path.join(folder_path, filename)
            os.remove(file_path)
            print(f'{filename} has been deleted.')
os.system("am start -n com.termux/.HomeActivity")
os.system("clear")
os.system("python3 $PREFIX/bin/photo.py")
time.sleep(2)   
print("")
print(f"{R}[{W}-{R}]{G}{BOLD} Shutdown OS.... {W}")
print("")
print(f"{R}[{W}-{R}]{G}{BOLD} checking 🔎..... {W}")
time.sleep(1)
response = urllib.request.urlopen(url)
latest_version = response.read().decode('utf-8').strip()
try:
  if latest_version > current_version:
    print(f"{R}[{W}-{R}]{G}{BOLD} update available..... {C}updating......📥 {W}")
    os.system("rm $PREFIX/bin/darkos.py")
    os.system("rm $PREFIX/bin/update-darkos.py")
    os.system("rm $PREFIX/bin/run-darkos.py")
    os.system("rm $PREFIX/bin/debug-darkos.py")
    os.system("rm $PREFIX/bin/setting-darkos.py")
    os.system("rm $PREFIX/bin/darkos")
    os.system("wget -O run-darkos.py https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/run-darkos.py")
    os.system("wget -O darkos.py https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/darkos.py")
    os.system("wget -O darkos https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/darkos")
    os.system("wget -O debug-darkos.py https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/debug-darkos.py")
    os.system("wget -O setting-darkos.py https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/setting-darkos.py")
    os.system("wget -O update-darkos.py https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/update-darkos.py")
    os.system("wget -O new-update.py https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/new-update.py")
    os.system("chmod +x darkos")
    os.system("mv update-darkos.py darkos.py run-darkos.py debug-darkos.py setting-darkos.py darkos $PREFIX/bin/")
    os.system("python3 new-update.py")
    time.sleep(2)
    remove()
    os.system("rm new-update.py")
    print(f"{R}[{W}-{R}]{G}{BOLD} update completed 🎉 {W}")
    print(f"{G}{BOLD} rebooting.... {W}")
    time.sleep(3)
except urllib.error.HTTPError as e:
  if e.code == 404:
    print(f"{R} no internet connection 😵 {C}rebooting..... {W}")
    time.sleep(2)
  else:
    os.system("rm $PREFIX/bin/darkos.py")
    os.system("wget -O darkos.py https://raw.githubusercontent.com/ahmad1abbadi/darkos/main/darkos.py")
    os.system("mv darkos.py")
    print(f"{C} no update available {W}")
    time.sleep(3)
os.system("python3 $PREFIX/bin/run-darkos.py")
Download .txt
gitextract_ci32frji/

├── LICENSE
├── README.md
├── boost_launcher
├── cpu_boost.py
├── currently version.txt
├── darkos
├── darkos.py
├── debug-darkos.py
├── installO.sh
├── installOS.sh
├── installglibc.py
├── logo
├── new-update.py
├── photo.py
├── pip_fixer
├── run-darkos.py
├── setting-darkos.py
├── shutdown.sh
├── terminal_utility/
│   ├── colors.properties
│   └── darkos-motd.sh
└── update-darkos.py
Download .txt
SYMBOL INDEX (100 symbols across 8 files)

FILE: cpu_boost.py
  function get_cpu_core_count (line 23) | def get_cpu_core_count():
  function get_cpu_info (line 27) | def get_cpu_info():
  function get_cpu_usage (line 45) | def get_cpu_usage(process):
  function get_file_descriptor_info (line 48) | def get_file_descriptor_info(pid):
  function get_shared_memory_info (line 57) | def get_shared_memory_info(pid):
  function get_idle_cores (line 76) | def get_idle_cores():
  function get_core_score (line 88) | def get_core_score(core, current_cpu_load, cpu_freqs):
  function get_high_frequency_cores (line 94) | def get_high_frequency_cores(cpu_freqs, num_cores=4):
  function adjust_cpu_and_priority (line 99) | def adjust_cpu_and_priority(process, num_cores_to_assign, cpu_freqs):
  function optimize_memory_for_high_cpu_process (line 129) | def optimize_memory_for_high_cpu_process(process, recommended_memory_gb=6):
  class ProcessInfo (line 153) | class ProcessInfo:
    method __init__ (line 154) | def __init__(self, pid, cpu_usage, file_descriptors):
  class SharedMemory (line 159) | class SharedMemory:
    method __init__ (line 160) | def __init__(self, size):
    method set_value (line 164) | def set_value(self, offset, value):
    method get_value (line 168) | def get_value(self, offset, size):
  function get_c_process_file_info (line 172) | def get_c_process_file_info(process_to_check):
  function io_operation (line 182) | def io_operation(shared_memory_segment, process_to_check, pid, result_qu...
  function cpu_memory (line 233) | def cpu_memory():

FILE: darkos.py
  function extract_archive (line 23) | def extract_archive(file_path, extract_to):
  function colored_input (line 61) | def colored_input(prompt):
  function start_darkos (line 66) | def start_darkos():
  function wine_container (line 73) | def wine_container():
  function recreate_32bit (line 142) | def recreate_32bit():
  function photo (line 205) | def photo():
  function check_network_connection (line 207) | def check_network_connection():
  function main (line 213) | def main():
  function mangohud_vulkan (line 230) | def mangohud_vulkan():
  function winetricks (line 234) | def winetricks():
  function start_container (line 279) | def start_container():
  function uninstall_wine (line 307) | def uninstall_wine():
  function uninstall_wine9 (line 337) | def uninstall_wine9():
  function recreate_prefix_wineAZ (line 342) | def recreate_prefix_wineAZ():
  function xinput_support (line 377) | def xinput_support():
  function check_config_wine (line 402) | def check_config_wine():
  function Compile (line 405) | def Compile():
  function install_wine9 (line 408) | def install_wine9():
  function auto_start (line 411) | def auto_start():
  function get_shell_name (line 440) | def get_shell_name():
  function activate_auto_start (line 446) | def activate_auto_start(command, shell_name):
  function deactivate_auto_start (line 468) | def deactivate_auto_start(command, shell_name):
  function styles (line 485) | def styles():
  function change_setting (line 500) | def change_setting():
  function box_version (line 617) | def box_version():
  function reload (line 663) | def reload():
  function new_sesson (line 674) | def new_sesson():
  function main_menu (line 682) | def main_menu():

FILE: debug-darkos.py
  function colored_input (line 25) | def colored_input(prompt):
  function recreate_prefix (line 30) | def recreate_prefix():
  function reboot (line 116) | def reboot():

FILE: installglibc.py
  function extract_archive (line 15) | def extract_archive(file_path, extract_to):
  function package_install_and_check (line 53) | def package_install_and_check(*packs_list):
  function check_and_backup (line 70) | def check_and_backup(file_paths):
  function start_darkos (line 79) | def start_darkos():
  function termux_pkg (line 87) | def termux_pkg():
  function install_glibc_AZ (line 94) | def install_glibc_AZ():
  function update (line 97) | def update():
  function alsa (line 100) | def alsa():
  function mangohud (line 104) | def mangohud():
  function install_AZ (line 108) | def install_AZ():
  function install_box (line 111) | def install_box():
  function install_conf (line 114) | def install_conf():
  function edit_bashrc (line 122) | def edit_bashrc():
  function create_prefix (line 150) | def create_prefix():
  function install_mono (line 185) | def install_mono():
  function install_wine9 (line 188) | def install_wine9():
  function scripts (line 192) | def scripts():
  function remove (line 218) | def remove():

FILE: new-update.py
  function update_remove (line 15) | def update_remove():
  function pg (line 24) | def pg():
  function mangohud (line 26) | def mangohud():
  function update (line 30) | def update():
  function update_files (line 34) | def update_files():

FILE: run-darkos.py
  function extract_and_delete_tar_files (line 18) | def extract_and_delete_tar_files():
  function load_conf (line 42) | def load_conf():
  function create_wine_prefix (line 56) | def create_wine_prefix():
  function start_wine (line 82) | def start_wine():
  function restart_wine (line 100) | def restart_wine():
  function update_wine (line 110) | def update_wine():
  function stop_virgl (line 121) | def stop_virgl():
  function start_virgl (line 131) | def start_virgl():
  function reload_style (line 142) | def reload_style():
  function shutdown_wine (line 149) | def shutdown_wine():
  function debug_wine (line 156) | def debug_wine():
  function settings_wine (line 166) | def settings_wine():
  function input_action (line 179) | def input_action():
  function restart_program (line 197) | def restart_program():
  function stop_darkos (line 205) | def stop_darkos():

FILE: setting-darkos.py
  function extract_archive (line 23) | def extract_archive(file_path, extract_to):
  function remove (line 56) | def remove():
  function uninstall_wine9 (line 63) | def uninstall_wine9():
  function install_wine9 (line 70) | def install_wine9():
  function internet_connected (line 96) | def internet_connected():
  function wine_manager (line 103) | def wine_manager():
  function photo (line 154) | def photo():
  function uninstall_wine (line 156) | def uninstall_wine():
  function install_wine3 (line 183) | def install_wine3():
  function wine_select (line 208) | def wine_select():
  function search_and_move_folders (line 237) | def search_and_move_folders(root_dir, target_folders, destination_dir):

FILE: update-darkos.py
  function remove (line 13) | def remove():
Condensed preview — 21 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (160K chars).
[
  {
    "path": "LICENSE",
    "chars": 35823,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\r\n                       Version 3, 29 June 2007\r\n\r\n Copyright (C) 2007 Fr"
  },
  {
    "path": "README.md",
    "chars": 6808,
    "preview": "![logo](img/logo.png \"logo\")\r\n\r\n**Darkos** is a project designed to run Windows x86_64 applications and games in [Termux"
  },
  {
    "path": "boost_launcher",
    "chars": 110,
    "preview": "#!/bin/bash\n\nsu -c /data/data/com.termux/files/usr/bin/python /data/data/com.termux/files/usr/bin/cpu_boost.py"
  },
  {
    "path": "cpu_boost.py",
    "chars": 13569,
    "preview": "import psutil\r\nimport time\r\nimport gc\r\nfrom concurrent.futures import ThreadPoolExecutor\r\nfrom blessings import Terminal"
  },
  {
    "path": "currently version.txt",
    "chars": 7,
    "preview": "0.971\r\n"
  },
  {
    "path": "darkos",
    "chars": 2626,
    "preview": "#!/bin/bash\nR=\"$(printf '\\033[1;31m')\"                           \nG=\"$(printf '\\033[1;32m')\"\nY=\"$(printf '\\033[1;33m')\"\n"
  },
  {
    "path": "darkos.py",
    "chars": 33815,
    "preview": "import os\r\nimport re\r\nimport subprocess\r\nimport time\r\nimport threading\r\nimport shutil\r\nimport sys, urllib.request, urlli"
  },
  {
    "path": "debug-darkos.py",
    "chars": 8233,
    "preview": "import os\r\nimport re\r\nimport subprocess\r\nimport time\r\nimport threading\r\n\r\nR = \"\\033[1;31m\"\r\nG = \"\\033[1;32m\"\r\nY = \"\\033["
  },
  {
    "path": "installO.sh",
    "chars": 23,
    "preview": "#!/bin/bash\r\necho 123\r\n"
  },
  {
    "path": "installOS.sh",
    "chars": 2712,
    "preview": "#!/data/data/com.termux/files/usr/bin/bash\nR=\"$(printf '\\033[1;31m')\"                           \nG=\"$(printf '\\033[1;32m"
  },
  {
    "path": "installglibc.py",
    "chars": 13606,
    "preview": "import os, shutil, time\r\nimport subprocess\r\nimport zipfile\r\nimport tarfile\r\nfrom tqdm import tqdm\r\n\r\nR = \"\\033[1;31m\"\r\nG"
  },
  {
    "path": "logo",
    "chars": 115,
    "preview": "#!/bin/bash\n\nvlc --fullscreen --x11-display=:0.0 --quiet --play-and-exit $PREFIX/glibc/opt/darkos/logo.mp4 && exit\n"
  },
  {
    "path": "new-update.py",
    "chars": 1680,
    "preview": "import os, time, shutil, sys, subprocess, urllib.request, urllib.error, fnmatch\n\nR = \"\\033[1;31m\"\nG = \"\\033[1;32m\"\nY = \""
  },
  {
    "path": "photo.py",
    "chars": 646,
    "preview": "print(\"\\033[36m\")\r\nprint(\"\"\"\r\n  .+\"+.+\"+.+\"+.+\"+.+\"+.+\"+.+\"+.+\"+.+\"+.+\"+.+\"+.+\"+. \r\n (     (              (         )   "
  },
  {
    "path": "pip_fixer",
    "chars": 194,
    "preview": "#!/bin/bash\n\n_file=\"$(find $PREFIX/lib/python3.11 -name \"_sysconfigdata*.py\")\"\nrm -rf $PREFIX/lib/python3.11/_pycache_\nc"
  },
  {
    "path": "run-darkos.py",
    "chars": 10657,
    "preview": "import os\r\nimport re\r\nimport subprocess\r\nimport time\r\nimport threading\r\nimport shutil\r\nimport sys, urllib.request, urlli"
  },
  {
    "path": "setting-darkos.py",
    "chars": 12530,
    "preview": "import os, time, shutil, sys, subprocess, urllib.request, urllib.error\r\nimport tarfile\r\nimport socket\r\nimport fnmatch\r\ni"
  },
  {
    "path": "shutdown.sh",
    "chars": 242,
    "preview": "#!/data/data/com.termux/files/usr/bin/bash\r\n\r\nexport PATH=/data/data/com.termux/files/usr/bin\r\nunset LD_LIBRARY_PATH\r\n\r\n"
  },
  {
    "path": "terminal_utility/colors.properties",
    "chars": 547,
    "preview": "foreground=   #81B5AC\nbackground=   #031A16\ncursor=  #81B5AC\n\ncolor0=       #031A16\ncolor1=       #3E9688\ncolor2=       "
  },
  {
    "path": "terminal_utility/darkos-motd.sh",
    "chars": 2359,
    "preview": "#!/data/data/com.termux/files/usr/bin\nW=\"\\e[0;39m\"\nG=\"\\e[1;32m\"\nC=\"\\e[1;36m\"\nY='\\033[1;33m'\nR=\"\\e[1;31m\"\nBOLD='\\033[1m'\n"
  },
  {
    "path": "update-darkos.py",
    "chars": 3033,
    "preview": "import os, time, shutil, sys, subprocess, urllib.request, urllib.error, fnmatch\r\n\r\nR = \"\\033[1;31m\"\r\nG = \"\\033[1;32m\"\r\nY"
  }
]

About this extraction

This page contains the full source code of the ahmad1abbadi/darkos GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 21 files (145.8 KB), approximately 39.9k tokens, and a symbol index with 100 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!