Repository: LSPosed/MagiskOnWSALocal Branch: main Commit: 10659d90b613 Files: 39 Total size: 149.6 KB Directory structure: gitextract_qh07k2ps/ ├── .gitattributes ├── .github/ │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.yml │ │ ├── config.yml │ │ └── feature_request.yml │ ├── pull_request_template.md │ └── workflows/ │ ├── issue_moderator.yml │ ├── lock-closed-issues.yml │ ├── lock.yml │ ├── ps2check.yml │ └── shellcheck.yml ├── .gitignore ├── LICENSE ├── bin/ │ ├── arm64/ │ │ └── lspinit │ └── x64/ │ └── lspinit ├── docs/ │ ├── Custom-GApps.md │ ├── KernelSU.md │ └── README.md ├── installer/ │ ├── Install.ps1 │ ├── MakePri.ps1 │ └── Run.bat ├── scripts/ │ ├── build.sh │ ├── extractMagisk.py │ ├── extractWSA.py │ ├── gapps_debug.sh │ ├── generateGappsLink.py │ ├── generateKernelSULink.py │ ├── generateMagiskLink.py │ ├── generateWSALinks.py │ ├── init.lsp.magisk.rc │ ├── install_deps.sh │ ├── magisk_debug.sh │ ├── post-fs-data.sh │ ├── requirements.txt │ └── run.sh └── xml/ ├── FE3FileUrl.xml ├── GetCookie.xml ├── WUIDRequest.xml └── priconfig.xml ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitattributes ================================================ *.py text eol=lf *.sh text eol=lf *.exe binary *.apk binary *.so binary *.xml text eol=crlf *.bat text eol=crlf *.ps1 text eol=crlf ================================================ FILE: .github/FUNDING.yml ================================================ github: [yujincheng08] ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.yml ================================================ name: Bug report/反馈 Bug description: Report errors or unexpected behavior./反馈错误或异常行为。 labels: [bug] title: "[Bug] Short description." body: - type: markdown attributes: value: | Thanks for reporting issues of MagiskOnWSALocal! To make it easier for us to help you please enter detailed information below. 感谢给 MagiskOnWSALocal 汇报问题! 为了使我们更好地帮助你,请提供以下信息。 为了防止重复汇报,标题请务必使用英文。 - type: textarea attributes: label: Steps to reproduce/复现步骤 value: | 1. 2. 3. validations: required: true - type: textarea attributes: label: Expected behaviour/预期行为 placeholder: Tell us what should happen/正常情况下应该发生什么 validations: required: true - type: textarea attributes: label: Actual behaviour/实际行为 placeholder: Tell us what happens instead/实际上发生了什么 validations: required: true - type: input attributes: label: MagiskOnWSALocal commit full SHA/MagiskOnWSALocal 提交的完整哈希 description: Don't use 'latest'. Copy and paste full commit SHA, otherwise your issue will be closed./不要填用“最新”。复制并粘贴完整 commit SHA,不然 issue 会被关闭。 validations: required: true - type: textarea attributes: label: Linux distribution info/Linux 发行版信息 validations: required: true - type: input attributes: label: Windows version/Windows 版本 placeholder: 10.0.22000.978 validations: required: true - type: textarea attributes: label: Build Parameters/构建参数 description: The script prints the build information each time you start a build. It looks like this, please copy and paste it./每次开始构建时脚本都会打印构建信息,它看起来是这样的,请复制并粘贴上来。 placeholder: | COMMAND_LINE=--arch x64 --release-type retail --magisk-ver stable --gapps-brand MindTheGapps --gapps-variant pico --root-sol magisk INFO: Architecture: x64 INFO: Release Type: retail INFO: Magisk Version: stable INFO: GApps Brand: MindTheGapps INFO: GApps Variant: pico INFO: Root Solution: magisk Build: RELEASE_TYPE=Retail validations: required: true - type: checkboxes id: latest attributes: label: Version requirement/版本要求 options: - label: I am using latest commit of MagiskOnWSALocal/我正在使用最新 commit 的版本 required: true - type: textarea attributes: label: Logs/日志 description: Please copy and paste the error or submit a screenshot. Without log, the issue will be closed. /请复制粘贴错误或提交截图。无日志提交会被关闭。 value: |
[//]: <> (Don't modify above) ``` # Replace this line with the log / 将此行用日志替换 ``` [//]: <> (Don't modify below)
validations: required: true ================================================ FILE: .github/ISSUE_TEMPLATE/config.yml ================================================ blank_issues_enabled: false contact_links: - name: Ask a question/提问 url: https://github.com/LSPosed/MagiskOnWSALocal/discussions/new?category=Q-A about: Please ask and answer questions here./如果有任何疑问请在这里提问 ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.yml ================================================ --- name: Feature request/新特性请求 description: Suggest an idea./提出建议 labels: [enhancement] title: "[Feature Request] Short description." body: - type: textarea attributes: label: Is your feature request related to a problem?/你的请求是否与某个问题相关? placeholder: A clear and concise description of what the problem is./请清晰准确表述该问题。 validations: required: true - type: textarea attributes: label: Describe the solution you'd like/描述你想要的解决方案 placeholder: A clear and concise description of what you want to happen./请清晰准确描述新特性的预期行为 validations: required: true - type: textarea attributes: label: Additional context/其他信息 placeholder: Add any other context or screenshots about the feature request here./其他关于新特性的信息或者截图 validations: required: false ================================================ FILE: .github/pull_request_template.md ================================================ Checklist - [ ] Referenced all related issues in the PR body (e.g. "Closes #xyz") - [ ] Have tested the modifications ================================================ FILE: .github/workflows/issue_moderator.yml ================================================ name: Issue moderator on: issues: types: [opened] pull_request: types: [opened, edited] jobs: autoclose: runs-on: ubuntu-latest steps: - name: Check issue uses: tachiyomiorg/issue-moderator-action@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} auto-close-rules: | [ { "type": "title", "regex": ".*Short description.*", "message": "You did not fill out the description in the title" } ] auto-close-ignore-label: do-not-autoclose - name: Check PR uses: sumally/github-check-tasklist-action@v1 ================================================ FILE: .github/workflows/lock-closed-issues.yml ================================================ name: Lock closed issue on: issues: types: [closed] jobs: lock: runs-on: ubuntu-latest steps: - uses: OSDKDev/lock-issues@v1 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" ================================================ FILE: .github/workflows/lock.yml ================================================ name: 'Lock Threads' on: issues: types: [closed] pull_request: types: [closed] workflow_dispatch: permissions: issues: write pull-requests: write concurrency: group: lock jobs: action: runs-on: ubuntu-latest steps: - uses: dessant/lock-threads@v4 with: exclude-any-issue-labels: 'do-not-autoclose' exclude-any-pr-labels: 'do-not-autoclose' include-any-pr-labels: 'spam' ================================================ FILE: .github/workflows/ps2check.yml ================================================ name: PSScript checker on: push: paths: - '**.ps1' - '.github/workflows/ps2check.yml' pull_request: paths: - '**.ps1' - '.github/workflows/ps2check.yml' workflow_dispatch: jobs: shellcheck: runs-on: windows-latest steps: - name : Checkout uses: actions/checkout@v3 - name: Run PSScriptAnalyzer uses: microsoft/psscriptanalyzer-action@v1.0 with: path: .\installer recurse: true includeDefaultRules: true enableExit: true ================================================ FILE: .github/workflows/shellcheck.yml ================================================ name: Shell checker on: push: paths: - '**.sh' - '.github/workflows/shellcheck.yml' pull_request: paths: - '**.sh' - '.github/workflows/shellcheck.yml' workflow_dispatch: jobs: shellcheck: runs-on: ubuntu-latest steps: - name : Checkout uses: actions/checkout@v3 - name: Run ShellCheck id: check uses: ludeeus/action-shellcheck@master with: scandir: './scripts' ================================================ FILE: .gitignore ================================================ download output python3-env token ================================================ FILE: LICENSE ================================================ GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are 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. 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. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. 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 Affero 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. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. 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 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 work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero 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 Affero 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 Affero 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 Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero 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 Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. 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 AGPL, see . ================================================ FILE: docs/Custom-GApps.md ================================================ # How to install custom GApps 1. Build WSA without gapps to let the script download needed files `./build.sh --gapps-brand none` 1. - For OpenGApps Place custom OpenGApps to `download` folder and rename to `OpenGApps-{arch}-{variant}.zip` (e.g. `OpenGApps-x64-pico.zip`) - For MindTheGapps Place custom MindTheGapps to `download` folder and rename to `MindTheGapps-{arch}.zip` (e.g. `MindTheGapps-x64.zip`) 1. Build WSA offline `./build.sh --offline --gapps-brand {brand} --gapps-variant {variant}` ================================================ FILE: docs/KernelSU.md ================================================ # Install KernelSU ## Install Manager 1. Download KernelSU Manager from [![Build Manager](https://github.com/tiann/KernelSU/actions/workflows/build-manager.yml/badge.svg?event=push)](https://github.com/tiann/KernelSU/actions/workflows/build-manager.yml?query=event%3Apush+is%3Acompleted+branch%3Amain) (Download the artifact named `manager`). 1. Unzip the downloaded zip package and get the manager apk named `KernelSU_vx.x.x-xx-.....apk`. 1. Use the command `adb install .apk` to install the manager. ## Install Kernel 1. Download pre-build kernel from [![Build Kernel - WSA](https://github.com/tiann/KernelSU/actions/workflows/build-kernel-wsa.yml/badge.svg?event=push)](https://github.com/tiann/KernelSU/actions/workflows/build-kernel-wsa.yml?query=branch%3Amain+event%3Apush+is%3Acompleted) (Remember to download the same architecture). 1. Unzip the downloaded zip package and get the kernel file named `bzImage`. 1. Replace the kernel in the folder named `Tools` in the WSA directory with `bzImage`. 1. Restart WSA and then enjoy. ================================================ FILE: docs/README.md ================================================ # Magisk on WSA (with Google Apps) :warning: Magisk on WSA will no longer be available after March 5, 2025. [Learn more](https://learn.microsoft.com/en-us/windows/android/wsa/). :warning: For fork developers: Please don't build using GitHub Actions, as GitHub will count your forked GitHub Actions usage against this upstream repository, which may cause this upstream repository gets disabled by GitHub staff like [MagiskOnWSA](https://github.com/LSPosed/MagiskOnWSA) because of numerous forks building GitHub Actions, and counting the forks' Action usage against this upstream repository. ## Support for generating from these systems - Linux (x86_64 or arm64) The following dependencies are required: | DistrOS | | | | | | |:-------------------:|----------------------------|------------|--------------------|---------------|---------------| | Debian | `python3 aria2 unzip sudo` | `whiptail` | `python3-venv` | `python3-pip` | `p7zip-full` | | openSUSE Tumbleweed | Same as above | `dialog` | `python3-venvctrl` | Same as above | Same as above | | Arch | Same as Debian | `libnewt` | Same as Debian | `python-pip` | `p7zip` | The python3 library `requests` is used. Python version ≥ **3.7.2**. - Recommended use - Ubuntu (You can use [WSL2](https://apps.microsoft.com/store/search?publisher=Canonical%20Group%20Limited)) Ready to use right out of the box. - Debian (You can use [WSL2](https://apps.microsoft.com/store/detail/debian/9MSVKQC78PK6)) Ready to use right out of the box. - openSUSE Tumbleweed (You can use [WSL2](https://apps.microsoft.com/store/detail/opensuse-tumbleweed/9MSSK2ZXXN11)) Ready to use right out of the box. `run.sh` will handle all dependencies automatically. No need to type any commands. ## Features - Integrate Magisk and GApps in a few clicks within minutes - Keep each build up to date - Support both ARM64 and x64 - Support MindTheGapps - Remove Amazon Appstore - Fix VPN dialog not showing (use our [VpnDialogs app](https://github.com/LSPosed/VpnDialogs)) - Add device administration feature - Unattended installation - Automatically activates developers mode in Windows 11 - Update to the new version while preserving data with a one-click script - Merged all language packs ## Text Guide 1. Star (if you like). 2. Clone the repo to local: ```bash git clone https://github.com/LSPosed/MagiskOnWSALocal.git --depth 1 ``` 3. Run `cd MagiskOnWSALocal`. 4. Run `./scripts/run.sh`. 5. Select the WSA version and its architecture (mostly x64). 6. Select the version of Magisk. 7. Choose which brand of GApps you want to install: - MindTheGapps There is no other variant we can choose. 8. Select the root solution (none means no root). 9. If you are running the script for the first time, it will take some time to complete. After the script completes, two new folders named `output` and `download` will be generated in the `MagiskOnWSALocal` folder. Go to the `output` folder. While running the `./run.sh` script in the step 3, if you selected `Yes` for `Do you want to compress the output?` then in `output` folder you will see a compressed file called `WSA-with-magisk-stable-MindTheGapps_2207.40000.8.0_x64_Release-Nightly`or else there will be folder with the `WSA-with-magisk-stable-MindTheGapps_2207.40000.8.0_x64_Release-Nightly`. If there is a folder open it and skip to step 10. NOTE: The name of compressed file or the folder generated in the `output` folder may be different for you. It will be dependent on the choices made when executing `./run.sh`. 10. Extract the compressed file and open the folder created after the extraction of the file. 11. Here look for file `Run.bat` and run it. - If you previously have a MagiskOnWSA installation, it will automatically uninstall the previous one while **preserving all user data** and install the new one, so don't worry about your data. - If you have an official WSA installation, you should uninstall it first. (In case you want to preserve your data, you can backup `%LOCALAPPDATA%\Packages\MicrosoftCorporationII.WindowsSubsystemForAndroid_8wekyb3d8bbwe\LocalCache\userdata.vhdx` before uninstallation and restore it after installation.) - If the popup windows disappear **without asking administrative permission** and WSA is not installed successfully, you should manually run `Install.ps1` as Administrator: 1. Press `Win+x` and select `Windows Terminal (Admin)`. 2. Input `cd "{X:\path\to\your\extracted\folder}"` and press `enter`, and remember to replace `{X:\path\to\your\extracted\folder}` including the `{}`, for example `cd "D:\wsa"` 3. Input `PowerShell.exe -ExecutionPolicy Bypass -File .\Install.ps1` and press `Enter`. 4. The script will run and WSA will be installed. 5. If this workaround does not work, your PC is not supported for WSA. 12. Magisk/Play Store will be launched. Enjoy by installing LSPosed-Zygisk with Zygisk enabled or Riru and LSPosed-Riru. --- ## FAQ
- Can I delete the installed folder? No. - How can I update WSA to a newer version? 1. Update build scripts: ```bash git pull ``` For more usage of git, referred to 2. Rerun the script, replace the content of your previous installation and rerun `Install.ps1`. Don't worry, your data will be preserved. - How can I get the logcat from WSA? `%LOCALAPPDATA%\Packages\MicrosoftCorporationII.WindowsSubsystemForAndroid_8wekyb3d8bbwe\LocalState\diagnostics\logcat` - How can I update Magisk to a newer version? Do the same as updating WSA. - How to pass Play Integrity (formerly known as SafetyNet)? Like all the other emulators, no way. - Virtualization is not enabled? `Install.ps1` helps you enable it if not enabled. After rebooting, rerun `Install.ps1` to install WSA. If it's still not working, you have to enable virtualization in BIOS. That's a long story so ask Google for help. - How to remount the system as read-write? No way in WSA since it's mounted as read-only by Hyper-V. You can modify the system by making a Magisk module. Or directly modify the system.img. Ask Google for help. - I cannot `adb connect localhost:58526`, what to do? Make sure developer mode is enabled. If the issue persists, check the IP address of WSA on the setting page and try `adb connect ip:5555`. - Why the Magisk online module is empty? Magisk actively removes the online module repository. You can install the module locally or by `adb push module.zip /data/local/tmp` and `adb shell su -c magisk --install-module /data/local/tmp/module.zip`. - Can I use Magisk v23.0 stable or a lower version? No. Magisk has bugs preventing itself from running on WSA. Magisk v24+ has fixed them. So you must use Magisk v24 or later. - How can I get rid of Magisk? Choose `none` as the root solution. - How to install custom GApps? [Tutorial](Custom-GApps.md) - Where can I download MindTheGapps? You can download from here [MindTheGapps](https://androidfilehost.com/?w=files&flid=322935) ([mirror](http://downloads.codefi.re/jdcteam/javelinanddart/gapps)). Note that there is no x86_64 pre-build, so you need to build it by yourself ([Repository](https://gitlab.com/MindTheGapps/vendor_gapps)). Or you can download the built package for 12.1 and 13 for x86_64 from [this page](https://sourceforge.net/projects/wsa-mtg/files/x86_64/). - Is it possible to migrate data from a lower version like 2305 to a newer version? This is certainly available, Microsoft's change of read-only partition from 2305's EROFS to read-only EXT4 only affects the read-only system partition. It has no effect on the user data partition. Check the logs if there is a failure to boot. - How to install KernelSU? [Tutorial](KernelSU.md)
--- ## Credits - [StoreLib](https://github.com/StoreDev/StoreLib): API for downloading WSA - [Magisk](https://github.com/topjohnwu/Magisk): The most famous root solution on Android - ~~[The Open GApps Project](https://opengapps.org): One of the most famous Google Apps packages solution~~ - [WSA-Kernel-SU](https://github.com/LSPosed/WSA-Kernel-SU) and [kernel-assisted-superuser](https://git.zx2c4.com/kernel-assisted-superuser/): The kernel `su` for debugging Magisk Integration - ~~[WSAGAScript](https://github.com/ADeltaX/WSAGAScript): The first GApps integration script for WSA~~ - ~~[erofs-utils](https://github.com/sekaiacg/erofs-utils): Pre-build `erofs-utils` with erofsfuse enabled~~ _The repository is provided as a utility._ _Android is a trademark of Google LLC. Windows is a trademark of Microsoft Corporation._ ================================================ FILE: installer/Install.ps1 ================================================ # This file is part of MagiskOnWSALocal. # # MagiskOnWSALocal is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # MagiskOnWSALocal 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with MagiskOnWSALocal. If not, see . # # Copyright (C) 2024 LSPosed Contributors # $Host.UI.RawUI.WindowTitle = "Installing MagiskOnWSA...." function Test-Administrator { [OutputType([bool])] param() process { [Security.Principal.WindowsPrincipal]$user = [Security.Principal.WindowsIdentity]::GetCurrent(); return $user.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator); } } function Get-InstalledDependencyVersion { param ( [string]$Name, [string]$ProcessorArchitecture ) PROCESS { If ($null -Ne $ProcessorArchitecture) { return Get-AppxPackage -Name $Name | ForEach-Object { if ($_.Architecture -Eq $ProcessorArchitecture) { $_ } } | Sort-Object -Property Version | Select-Object -ExpandProperty Version -Last 1; } } } Function Test-CommandExist { Param ($Command) $OldPreference = $ErrorActionPreference $ErrorActionPreference = 'stop' try { if (Get-Command $Command) { RETURN $true } } Catch { RETURN $false } Finally { $ErrorActionPreference = $OldPreference } } #end function Test-CommandExist Function Finish { Clear-Host Start-Process "wsa://com.topjohnwu.magisk" Start-Process "wsa://com.android.vending" } If (Test-CommandExist pwsh.exe) { $pwsh = "pwsh.exe" } Else { $pwsh = "powershell.exe" } If (-Not (Test-Administrator)) { Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force $Proc = Start-Process -PassThru -Verb RunAs $pwsh -Args "-ExecutionPolicy Bypass -Command Set-Location '$PSScriptRoot'; &'$PSCommandPath' EVAL" If ($null -Ne $Proc) { $Proc.WaitForExit() } If ($null -Eq $Proc -Or $Proc.ExitCode -Ne 0) { Write-Warning "Failed to launch start as Administrator`r`nPress any key to exit" $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown'); } exit } ElseIf (($args.Count -Eq 1) -And ($args[0] -Eq "EVAL")) { Start-Process $pwsh -NoNewWindow -Args "-ExecutionPolicy Bypass -Command Set-Location '$PSScriptRoot'; &'$PSCommandPath'" exit } $FileList = Get-Content -Path .\filelist.txt If (((Test-Path -Path $FileList) -Eq $false).Count) { Write-Error "Some files are missing in the folder. Please try to build again. Press any key to exit" $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') exit 1 } If (((Test-Path -Path "MakePri.ps1") -And (Test-Path -Path "makepri.exe")) -Eq $true) { $ProcMakePri = Start-Process $pwsh -PassThru -NoNewWindow -Args "-ExecutionPolicy Bypass -File MakePri.ps1" -WorkingDirectory $PSScriptRoot $null = $ProcMakePri.Handle $ProcMakePri.WaitForExit() If ($ProcMakePri.ExitCode -Ne 0) { Write-Warning "Failed to merge resources, WSA Seetings will always be in English`r`nPress any key to continue" $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') } $Host.UI.RawUI.WindowTitle = "Installing MagiskOnWSA...." } reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1" # When using PowerShell which is installed with MSIX # Get-WindowsOptionalFeature and Enable-WindowsOptionalFeature will fail # See https://github.com/PowerShell/PowerShell/issues/13866 if ($PSHOME.contains("8wekyb3d8bbwe")) { Import-Module DISM -UseWindowsPowerShell } If ($(Get-WindowsOptionalFeature -Online -FeatureName 'VirtualMachinePlatform').State -Ne "Enabled") { Enable-WindowsOptionalFeature -Online -NoRestart -FeatureName 'VirtualMachinePlatform' Write-Warning "Need restart to enable virtual machine platform`r`nPress y to restart or press any key to exit" $Key = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') If ("y" -Eq $Key.Character) { Restart-Computer -Confirm } Else { exit 1 } } [xml]$Xml = Get-Content ".\AppxManifest.xml"; $Name = $Xml.Package.Identity.Name; Write-Output "Installing $Name version: $($Xml.Package.Identity.Version)" $ProcessorArchitecture = $Xml.Package.Identity.ProcessorArchitecture; $Dependencies = $Xml.Package.Dependencies.PackageDependency; $Dependencies | ForEach-Object { $InstalledVersion = Get-InstalledDependencyVersion -Name $_.Name -ProcessorArchitecture $ProcessorArchitecture; If ( $InstalledVersion -Lt $_.MinVersion ) { If ($env:WT_SESSION) { $env:WT_SESSION = $null Write-Output "Dependency should be installed but Windows Terminal is in use. Restarting to conhost.exe" Start-Process conhost.exe -Args "powershell.exe -ExecutionPolicy Bypass -Command Set-Location '$PSScriptRoot'; &'$PSCommandPath'" exit 1 } Write-Output "Dependency package $($_.Name) $ProcessorArchitecture required minimum version: $($_.MinVersion). Installing...." Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Path "$($_.Name)_$ProcessorArchitecture.appx" } Else { Write-Output "Dependency package $($_.Name) $ProcessorArchitecture current version: $InstalledVersion. Nothing to do." } } $Installed = $null $Installed = Get-AppxPackage -Name $Name If (($null -Ne $Installed) -And (-Not ($Installed.IsDevelopmentMode))) { Write-Warning "There is already one installed WSA. Please uninstall it first.`r`nPress y to uninstall existing WSA or press any key to exit" $key = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') If ("y" -Eq $key.Character) { Clear-Host Remove-AppxPackage -Package $Installed.PackageFullName } Else { exit 1 } } If (Test-CommandExist WsaClient) { Write-Output "Shutting down WSA...." Start-Process WsaClient -Wait -Args "/shutdown" } Stop-Process -Name "WsaClient" -ErrorAction SilentlyContinue Write-Output "Installing MagiskOnWSA...." Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Register .\AppxManifest.xml If ($?) { Finish } ElseIf ($null -Ne $Installed) { Write-Error "Failed to update.`r`nPress any key to uninstall existing installation while preserving user data.`r`nTake in mind that this will remove the Android apps' icon from the start menu.`r`nIf you want to cancel, close this window now." $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') Clear-Host Remove-AppxPackage -PreserveApplicationData -Package $Installed.PackageFullName Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Register .\AppxManifest.xml If ($?) { Finish } } Write-Output "All Done!`r`nPress any key to exit" $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') ================================================ FILE: installer/MakePri.ps1 ================================================ # This file is part of MagiskOnWSALocal. # # MagiskOnWSALocal is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # MagiskOnWSALocal 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with MagiskOnWSALocal. If not, see . # # Copyright (C) 2023 LSPosed Contributors # $Host.UI.RawUI.WindowTitle = "Merging resources...." If ((Test-Path -Path "pri") -Eq $true -And (Test-Path -Path "xml") -Eq $true) { $AppxManifestFile = ".\AppxManifest.xml" Copy-Item .\resources.pri -Destination ".\pri\resources.pri" | Out-Null $ProcNew = Start-Process -PassThru makepri.exe -NoNewWindow -Args "new /pr .\pri /cf .\xml\priconfig.xml /of .\resources.pri /mn $AppxManifestFile /o" $null = $ProcNew.Handle $ProcNew.WaitForExit() If ($ProcNew.ExitCode -Ne 0) { Write-Warning "Failed to merge resources from pris`r`nTrying to dump pris to priinfo...." New-Item -Path "." -Name "priinfo" -ItemType "directory" Clear-Host $i = 0 $PriItem = Get-Item ".\pri\*" -Include "*.pri" Write-Output "Dumping resources...." $Processes = ForEach ($Item in $PriItem) { Start-Process -PassThru -WindowStyle Hidden makepri.exe -Args "dump /if $($Item | Resolve-Path -Relative) /o /es .\pri\resources.pri /of .\priinfo\$($Item.Name).xml /dt detailed" $i = $i + 1 $Completed = ($i / $PriItem.count) * 100 Write-Progress -Activity "Dumping resources" -Status "Dumping $($Item.Name):" -PercentComplete $Completed } $Processes | Wait-Process Write-Progress -Activity "Dumping resources" -Status "Ready" -Completed Clear-Host Write-Output "Creating pri from dumps...." $ProcNewFromDump = Start-Process -PassThru -NoNewWindow makepri.exe -Args "new /pr .\priinfo /cf .\xml\priconfig.xml /of .\resources.pri /mn $AppxManifestFile /o" $null = $ProcNewFromDump.Handle $ProcNewFromDump.WaitForExit() Remove-Item 'priinfo' -Recurse If ($ProcNewFromDump.ExitCode -Ne 0) { Write-Error "Failed to create resources from priinfos" exit 1 } } $ProjectXml = [xml](Get-Content $AppxManifestFile) $ProjectResources = $ProjectXml.Package.Resources; $(Get-Item .\xml\* -Exclude "priconfig.xml" -Include "*.xml") | ForEach-Object { $($([xml](Get-Content $_)).Package.Resources.Resource) | ForEach-Object { $ProjectResources.AppendChild($($ProjectXml.ImportNode($_, $true))) } } $ProjectXml.Save($AppxManifestFile) Remove-Item 'pri' -Recurse Set-Content -Path "filelist.txt" -Value (Get-Content -Path "filelist.txt" | Select-String -Pattern '^pri$' -NotMatch) Remove-Item 'xml' -Recurse Set-Content -Path "filelist.txt" -Value (Get-Content -Path "filelist.txt" | Select-String -Pattern '^xml$' -NotMatch) Remove-Item 'makepri.exe' Set-Content -Path "filelist.txt" -Value (Get-Content -Path "filelist.txt" | Select-String -Pattern 'makepri.exe' -NotMatch) Remove-Item $PSCommandPath -Force Set-Content -Path "filelist.txt" -Value (Get-Content -Path "filelist.txt" | Select-String -Pattern 'MakePri.ps1' -NotMatch) exit 0 } ================================================ FILE: installer/Run.bat ================================================ :: This file is part of MagiskOnWSALocal. :: :: MagiskOnWSALocal is free software: you can redistribute it and/or modify :: it under the terms of the GNU Affero General Public License as :: published by the Free Software Foundation, either version 3 of the :: License, or (at your option) any later version. :: :: MagiskOnWSALocal 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 Affero General Public License for more details. :: :: You should have received a copy of the GNU Affero General Public License :: along with MagiskOnWSALocal. If not, see . :: :: Copyright (C) 2023 LSPosed Contributors :: @echo off %~d0 cd "%~dp0" if not exist Install.ps1 ( echo "Install.ps1" is not found. echo Press any key to exit pause>nul exit 1 ) else ( start powershell.exe -ExecutionPolicy Bypass -File .\Install.ps1 exit ) ================================================ FILE: scripts/build.sh ================================================ #!/bin/bash # # This file is part of MagiskOnWSALocal. # # MagiskOnWSALocal is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # MagiskOnWSALocal 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with MagiskOnWSALocal. If not, see . # # Copyright (C) 2024 LSPosed Contributors # if [ ! "$BASH_VERSION" ]; then echo "Please do not use sh to run this script, just execute it directly" 1>&2 exit 1 fi HOST_ARCH=$(uname -m) if [ "$HOST_ARCH" != "x86_64" ] && [ "$HOST_ARCH" != "aarch64" ]; then echo "Unsupported architectures: $HOST_ARCH" exit 1 fi cd "$(dirname "$0")" || exit 1 # export TMPDIR=$HOME/.cache/wsa if [ "$TMPDIR" ] && [ ! -d "$TMPDIR" ]; then mkdir -p "$TMPDIR" fi WORK_DIR=$(mktemp -d -t wsa-build-XXXXXXXXXX_) || exit 1 DOWNLOAD_DIR=../download DOWNLOAD_CONF_NAME=download.list PYTHON_VENV_DIR="$(dirname "$PWD")/python3-env" dir_clean() { rm -rf "${WORK_DIR:?}" if [ "$TMPDIR" ] && [ -d "$TMPDIR" ]; then echo "Cleanup Temp Directory" rm -rf "${TMPDIR:?}" unset TMPDIR fi rm -f "${DOWNLOAD_DIR:?}/$DOWNLOAD_CONF_NAME" if [ "$(python3 -c 'import sys ; print( 1 if sys.prefix != sys.base_prefix else 0 )')" = "1" ]; then echo "deactivate python3 venv" deactivate fi } trap dir_clean EXIT OUTPUT_DIR=../output WSA_WORK_ENV="${WORK_DIR:?}/ENV" if [ -f "$WSA_WORK_ENV" ]; then rm -f "${WSA_WORK_ENV:?}"; fi touch "$WSA_WORK_ENV" export WSA_WORK_ENV clean_download() { if [ -d "$DOWNLOAD_DIR" ]; then echo "Cleanup Download Directory" if [ "$CLEAN_DOWNLOAD_WSA" ]; then rm -f "${WSA_ZIP_PATH:?}" fi if [ "$CLEAN_DOWNLOAD_MAGISK" ]; then rm -f "${MAGISK_PATH:?}" fi if [ "$CLEAN_DOWNLOAD_GAPPS" ]; then rm -f "${GAPPS_IMAGE_PATH:?}" rm -f "${GAPPS_RC_PATH:?}" fi if [ "$CLEAN_DOWNLOAD_KERNELSU" ]; then rm -f "${KERNELSU_PATH:?}" rm -f "${KERNELSU_INFO:?}" fi fi } abort() { [ "$1" ] && echo -e "ERROR: $1" echo "Build: an error has occurred, exit" if [ -d "$WORK_DIR" ]; then echo -e "\nCleanup Work Directory" dir_clean fi clean_download exit 1 } trap abort INT TERM default() { ARCH=x64 RELEASE_TYPE=retail MAGISK_VER=stable ROOT_SOL=magisk COMPRESS_FORMAT=none } exit_with_message() { echo "ERROR: $1" usage exit 1 } ARCH_MAP=( "x64" "arm64" ) RELEASE_TYPE_MAP=( "retail" "RP" "WIS" "WIF" ) MAGISK_VER_MAP=( "stable" "beta" "canary" "debug" "release" ) ROOT_SOL_MAP=( "magisk" "kernelsu" "none" ) COMPRESS_FORMAT_MAP=( "7z" "zip" "none" ) ARR_TO_STR() { local arr=("$@") local joined printf -v joined "%s, " "${arr[@]}" echo "${joined%, }" } usage() { default echo -e " Usage: --arch Architecture of WSA. Possible values: $(ARR_TO_STR "${ARCH_MAP[@]}") Default: $ARCH --release-type Release type of WSA. RP means Release Preview, WIS means Insider Slow, WIF means Insider Fast. Possible values: $(ARR_TO_STR "${RELEASE_TYPE_MAP[@]}") Default: $RELEASE_TYPE --magisk-ver Magisk version. Possible values: $(ARR_TO_STR "${MAGISK_VER_MAP[@]}") Default: $MAGISK_VER --root-sol Root solution. \"none\" means no root. Possible values: $(ARR_TO_STR "${ROOT_SOL_MAP[@]}") Default: $ROOT_SOL --compress-format Compress format of output file. Possible values: $(ARR_TO_STR "${COMPRESS_FORMAT_MAP[@]}") Default: $COMPRESS_FORMAT Additional Options: --offline Build WSA offline --magisk-custom Install custom Magisk --skip-download-wsa Skip download WSA --help Show this help message and exit Example: ./build.sh --release-type RP --magisk-ver beta ./build.sh --arch arm64 --release-type WIF ./build.sh --release-type WIS ./build.sh --offline --magisk-custom ./build.sh --release-type WIF --magisk-custom --magisk-ver release " } ARGUMENT_LIST=( "compress-format:" "arch:" "release-type:" "root-sol:" "magisk-ver:" "magisk-custom" "install-gapps" "remove-amazon" "offline" "skip-download-wsa" "help" "debug" ) default opts=$( getopt \ --longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \ --name "$(basename "$0")" \ --options "" \ -- "$@" ) || exit_with_message "Failed to parse options, please check your input" eval set --"$opts" while [[ $# -gt 0 ]]; do case "$1" in --compress-format) COMPRESS_FORMAT="$2" shift 2 ;; --arch) ARCH="$2" shift 2 ;; --release-type) RELEASE_TYPE="$2" shift 2 ;; --root-sol) ROOT_SOL="$2" shift 2 ;; --magisk-ver) MAGISK_VER="$2" shift 2 ;; --magisk-custom) CUSTOM_MAGISK=1 shift ;; --install-gapps) HAS_GAPPS=1 shift ;; --remove-amazon) REMOVE_AMAZON=1 shift ;; --offline) OFFLINE=1 shift ;; --skip-download-wsa) SKIP_DOWN_WSA=1 shift ;; --help) usage exit 0 ;; --debug) DEBUG=1 shift ;; --) shift break ;; esac done check_list() { local input=$1 if [ -n "$input" ]; then local name=$2 shift local arr=("$@") local list_count=${#arr[@]} for i in "${arr[@]}"; do if [ "$input" == "$i" ]; then echo "INFO: $name: $input" break fi ((list_count--)) if (("$list_count" <= 0)); then exit_with_message "Invalid $name: $input" fi done fi } check_list "$ARCH" "Architecture" "${ARCH_MAP[@]}" check_list "$RELEASE_TYPE" "Release Type" "${RELEASE_TYPE_MAP[@]}" check_list "$MAGISK_VER" "Magisk Version" "${MAGISK_VER_MAP[@]}" check_list "$ROOT_SOL" "Root Solution" "${ROOT_SOL_MAP[@]}" check_list "$COMPRESS_FORMAT" "Compress Format" "${COMPRESS_FORMAT_MAP[@]}" if [ "$DEBUG" ]; then set -x fi if [ "$HAS_GAPPS" ]; then case "$ROOT_SOL" in "none") ROOT_SOL="magisk" echo "WARN: Force install Magisk since GApps needs it to mount the file" ;; "kernelsu") abort "Unsupported combination: Install GApps and KernelSU" ;; *) ;; esac fi # shellcheck disable=SC1091 [ -f "$PYTHON_VENV_DIR/bin/activate" ] && { source "$PYTHON_VENV_DIR/bin/activate" || abort "Failed to activate virtual environment, please re-run install_deps.sh" } declare -A RELEASE_NAME_MAP=(["retail"]="Retail" ["RP"]="Release Preview" ["WIS"]="Insider Slow" ["WIF"]="Insider Fast") declare -A ANDROID_API_MAP=(["30"]="11.0" ["32"]="12.1" ["33"]="13.0") declare -A ARCH_NAME_MAP=(["x64"]="x86_64" ["arm64"]="arm64") RELEASE_NAME=${RELEASE_NAME_MAP[$RELEASE_TYPE]} || abort echo -e "INFO: Release Name: $RELEASE_NAME\n" WSA_ZIP_PATH=$DOWNLOAD_DIR/wsa-$RELEASE_TYPE.zip vclibs_PATH="$DOWNLOAD_DIR/Microsoft.VCLibs.140.00_$ARCH.appx" UWPVCLibs_PATH="$DOWNLOAD_DIR/Microsoft.VCLibs.140.00.UWPDesktop_$ARCH.appx" xaml_PATH="$DOWNLOAD_DIR/Microsoft.UI.Xaml.2.8_$ARCH.appx" MAGISK_ZIP=magisk-$MAGISK_VER.zip MAGISK_PATH=$DOWNLOAD_DIR/$MAGISK_ZIP CUST_PATH="$DOWNLOAD_DIR/cust.img" if [ "$CUSTOM_MAGISK" ]; then if [ ! -f "$MAGISK_PATH" ]; then echo "Custom Magisk $MAGISK_ZIP not found" MAGISK_ZIP=app-$MAGISK_VER.apk echo -e "Fallback to $MAGISK_ZIP\n" MAGISK_PATH=$DOWNLOAD_DIR/$MAGISK_ZIP if [ ! -f "$MAGISK_PATH" ]; then abort "Custom Magisk $MAGISK_ZIP not found\nPlease put custom Magisk in $DOWNLOAD_DIR" fi fi fi ANDROID_API=33 update_gapps_files_name() { GAPPS_IMAGE_NAME=gapps-${ANDROID_API_MAP[$ANDROID_API]}-${ARCH_NAME_MAP[$ARCH]}.img GAPPS_RC_NAME=gapps-${ANDROID_API_MAP[$ANDROID_API]}.rc GAPPS_IMAGE_PATH=$DOWNLOAD_DIR/$GAPPS_IMAGE_NAME GAPPS_RC_PATH=$DOWNLOAD_DIR/$GAPPS_RC_NAME } WSA_MAJOR_VER=0 getKernelVersion() { local bintype kernel_string kernel_version bintype="$(file -b "$1")" if [[ $bintype == *"version"* ]]; then readarray -td '' kernel_string < <(awk '{ gsub(/, /,"\0"); print; }' <<<"$bintype, ") unset 'kernel_string[-1]' for i in "${kernel_string[@]}"; do if [[ $i == *"version"* ]]; then IFS=" " read -r -a kernel_string <<<"$i" kernel_version="${kernel_string[1]}" fi done else IFS=" " read -r -a kernel_string <<<"$(strings "$1" | grep 'Linux version')" kernel_version="${kernel_string[2]}" fi IFS=" " read -r -a arr <<<"${kernel_version//-/ }" printf '%s' "${arr[0]}" } update_ksu_zip_name() { KERNEL_VER="" if [ -f "$WORK_DIR/wsa/$ARCH/Tools/kernel" ]; then KERNEL_VER=$(getKernelVersion "$WORK_DIR/wsa/$ARCH/Tools/kernel") fi KERNELSU_ZIP_NAME=kernelsu-$ARCH-$KERNEL_VER.zip KERNELSU_PATH=$DOWNLOAD_DIR/$KERNELSU_ZIP_NAME KERNELSU_INFO="$KERNELSU_PATH.info" } if [ -z ${OFFLINE+x} ]; then echo "Generating WSA Download Links" if [ -z ${SKIP_DOWN_WSA+x} ]; then python3 generateWSALinks.py "$ARCH" "$RELEASE_TYPE" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort echo "Downloading WSA" else python3 generateWSALinks.py "$ARCH" "$RELEASE_TYPE" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" "$SKIP_DOWN_WSA" || abort echo "Skip download WSA, downloading WSA depends" fi if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_download.log" -x16 -s16 -j5 -c -R -m0 \ --async-dns=false --check-integrity=true --continue=true --allow-overwrite=true --conditional-get=true \ -d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR/$DOWNLOAD_CONF_NAME"; then abort "We have encountered an error while downloading files." fi rm -f "${DOWNLOAD_DIR:?}/$DOWNLOAD_CONF_NAME" fi echo "Extracting WSA" if [ -f "$WSA_ZIP_PATH" ]; then if ! python3 extractWSA.py "$ARCH" "$WSA_ZIP_PATH" "$WORK_DIR" "$WSA_WORK_ENV"; then CLEAN_DOWNLOAD_WSA=1 abort "Unzip WSA failed" fi echo -e "done\n" # shellcheck disable=SC1090 source "$WSA_WORK_ENV" || abort else abort "The WSA zip package does not exist" fi if [[ "$WSA_MAJOR_VER" -lt 2211 ]]; then ANDROID_API=32 fi if [ -z ${OFFLINE+x} ]; then echo "Generating Download Links" if [ "$ROOT_SOL" = "magisk" ]; then if [ -z ${CUSTOM_MAGISK+x} ]; then python3 generateMagiskLink.py "$MAGISK_VER" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort fi fi if [ "$ROOT_SOL" = "kernelsu" ]; then update_ksu_zip_name python3 generateKernelSULink.py "$ARCH" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" "$KERNEL_VER" "$KERNELSU_ZIP_NAME" || abort # shellcheck disable=SC1090 source "$WSA_WORK_ENV" || abort # shellcheck disable=SC2153 echo "KERNELSU_VER=$KERNELSU_VER" >"$KERNELSU_INFO" fi if [ "$HAS_GAPPS" ]; then update_gapps_files_name python3 generateGappsLink.py "$ARCH" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" "$ANDROID_API" "$GAPPS_IMAGE_NAME" || abort fi if [ -f "$DOWNLOAD_DIR/$DOWNLOAD_CONF_NAME" ]; then echo "Downloading Artifacts" if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_download.log" -x16 -s16 -j5 -c -R -m0 \ --async-dns=false --check-integrity=true --continue=true --allow-overwrite=true --conditional-get=true \ -d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR/$DOWNLOAD_CONF_NAME"; then abort "We have encountered an error while downloading files." fi fi fi declare -A FILES_CHECK_LIST=([xaml_PATH]="$xaml_PATH" [vclibs_PATH]="$vclibs_PATH" [UWPVCLibs_PATH]="$UWPVCLibs_PATH") if [ "$ROOT_SOL" = "magisk" ]; then FILES_CHECK_LIST+=(["MAGISK_PATH"]="$MAGISK_PATH" ["CUST_PATH"]="$CUST_PATH") fi if [ "$ROOT_SOL" = "kernelsu" ]; then update_ksu_zip_name FILES_CHECK_LIST+=(["KERNELSU_PATH"]="$KERNELSU_PATH") fi if [ "$HAS_GAPPS" ]; then update_gapps_files_name FILES_CHECK_LIST+=(["GAPPS_IMAGE_PATH"]="$GAPPS_IMAGE_PATH" ["GAPPS_RC_PATH"]="$GAPPS_RC_PATH") fi for i in "${FILES_CHECK_LIST[@]}"; do if [ ! -f "$i" ]; then echo "Offline mode: missing [$i]" FILE_MISSING="1" fi done if [ "$FILE_MISSING" ]; then abort "Some files are missing" fi if [ "$ROOT_SOL" = "magisk" ]; then echo "Extracting Magisk" if [ -f "$MAGISK_PATH" ]; then MAGISK_VERSION_NAME="" MAGISK_VERSION_CODE=0 if ! python3 extractMagisk.py "$ARCH" "$MAGISK_PATH" "$WORK_DIR"; then CLEAN_DOWNLOAD_MAGISK=1 abort "Unzip Magisk failed, is the download incomplete?" fi # shellcheck disable=SC1090 source "$WSA_WORK_ENV" || abort if [ "$MAGISK_VERSION_CODE" -lt 26000 ] && [ "$MAGISK_VER" != "stable" ] && [ -z ${CUSTOM_MAGISK+x} ]; then abort "Please install Magisk 26.0+" fi chmod +x "$WORK_DIR/magisk/magiskboot" || abort elif [ -z "${CUSTOM_MAGISK+x}" ]; then abort "The Magisk zip package does not exist, is the download incomplete?" else abort "The Magisk zip package does not exist, rename it to magisk-debug.zip and put it in the download folder." fi echo -e "done\n" fi if [ "$ROOT_SOL" = "magisk" ]; then echo "Integrating Magisk" SKIP="#" SINGLEABI="#" SKIPINITLD="#" if [ -f "$WORK_DIR/magisk/magisk64" ]; then "$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/magisk64" "$WORK_DIR/magisk/magisk64.xz" "$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/magisk32" "$WORK_DIR/magisk/magisk32.xz" unset SINGLEABI else "$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/magisk" "$WORK_DIR/magisk/magisk.xz" unset SKIP fi if [ -f "$WORK_DIR/magisk/init-ld" ]; then "$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/init-ld" "$WORK_DIR/magisk/init-ld.xz" unset SKIPINITLD fi "$WORK_DIR/magisk/magiskboot" compress=xz "$MAGISK_PATH" "$WORK_DIR/magisk/stub.xz" "$WORK_DIR/magisk/magiskboot" cpio "$WORK_DIR/wsa/$ARCH/Tools/initrd.img" \ "mv /init /wsainit" \ "add 0750 /lspinit ../bin/$ARCH/lspinit" \ "ln /lspinit /init" \ "add 0750 /magiskinit $WORK_DIR/magisk/magiskinit" \ "mkdir 0750 overlay.d" \ "mkdir 0750 overlay.d/sbin" \ "$SINGLEABI add 0644 overlay.d/sbin/magisk64.xz $WORK_DIR/magisk/magisk64.xz" \ "$SINGLEABI add 0644 overlay.d/sbin/magisk32.xz $WORK_DIR/magisk/magisk32.xz" \ "$SKIP add 0644 overlay.d/sbin/magisk.xz $WORK_DIR/magisk/magisk.xz" \ "$SKIPINITLD add 0644 overlay.d/sbin/init-ld.xz $WORK_DIR/magisk/init-ld.xz" \ "add 0644 overlay.d/sbin/stub.xz $WORK_DIR/magisk/stub.xz" \ "mkdir 000 .backup" \ "add 000 overlay.d/init.lsp.magisk.rc init.lsp.magisk.rc" \ "add 000 overlay.d/sbin/post-fs-data.sh post-fs-data.sh" \ "add 000 overlay.d/sbin/lsp_cust.img $CUST_PATH" \ || abort "Unable to patch initrd" elif [ "$ROOT_SOL" = "kernelsu" ]; then echo "Extracting KernelSU" # shellcheck disable=SC1090 source "${KERNELSU_INFO:?}" || abort echo "WSA Kernel Version: $KERNEL_VER" echo "KernelSU Version: $KERNELSU_VER" if ! unzip "$KERNELSU_PATH" -d "$WORK_DIR/kernelsu"; then CLEAN_DOWNLOAD_KERNELSU=1 abort "Unzip KernelSU failed, package is corrupted?" fi if [ "$ARCH" = "x64" ]; then mv "$WORK_DIR/kernelsu/bzImage" "$WORK_DIR/kernelsu/kernel" elif [ "$ARCH" = "arm64" ]; then mv "$WORK_DIR/kernelsu/Image" "$WORK_DIR/kernelsu/kernel" fi echo "Integrate KernelSU" mv "$WORK_DIR/wsa/$ARCH/Tools/kernel" "$WORK_DIR/wsa/$ARCH/Tools/kernel_origin" cp "$WORK_DIR/kernelsu/kernel" "$WORK_DIR/wsa/$ARCH/Tools/kernel" fi echo -e "done\n" if [ "$HAS_GAPPS" ]; then update_gapps_files_name if [ -f "$GAPPS_IMAGE_PATH" ] && [ -f "$GAPPS_RC_PATH" ]; then echo "Integrating GApps" "$WORK_DIR/magisk/magiskboot" cpio "$WORK_DIR/wsa/$ARCH/Tools/initrd.img" \ "add 000 overlay.d/gapps.rc $GAPPS_RC_PATH" \ "add 000 overlay.d/sbin/lsp_gapps.img $GAPPS_IMAGE_PATH" \ || abort "Unable to patch initrd" echo -e "done\n" else abort "The GApps package does not exist." fi fi if [ "$REMOVE_AMAZON" ]; then rm -f "$WORK_DIR/wsa/$ARCH/apex/"mado*.apex || abort fi echo "Removing signature and add scripts" rm -rf "${WORK_DIR:?}"/wsa/"$ARCH"/\[Content_Types\].xml "$WORK_DIR/wsa/$ARCH/AppxBlockMap.xml" "$WORK_DIR/wsa/$ARCH/AppxSignature.p7x" "$WORK_DIR/wsa/$ARCH/AppxMetadata" || abort cp "$vclibs_PATH" "$xaml_PATH" "$WORK_DIR/wsa/$ARCH" || abort cp "$UWPVCLibs_PATH" "$xaml_PATH" "$WORK_DIR/wsa/$ARCH" || abort cp "../bin/$ARCH/makepri.exe" "$WORK_DIR/wsa/$ARCH" || abort cp "../xml/priconfig.xml" "$WORK_DIR/wsa/$ARCH/xml/" || abort cp ../installer/MakePri.ps1 "$WORK_DIR/wsa/$ARCH" || abort cp ../installer/Install.ps1 "$WORK_DIR/wsa/$ARCH" || abort cp ../installer/Run.bat "$WORK_DIR/wsa/$ARCH" || abort find "$WORK_DIR/wsa/$ARCH" -maxdepth 1 -mindepth 1 -printf "%P\n" >"$WORK_DIR/wsa/$ARCH/filelist.txt" || abort echo -e "done\n" if [[ "$ROOT_SOL" = "none" ]]; then name1="" elif [ "$ROOT_SOL" = "magisk" ]; then name1="-with-magisk-$MAGISK_VERSION_NAME($MAGISK_VERSION_CODE)-$MAGISK_VER" elif [ "$ROOT_SOL" = "kernelsu" ]; then name1="-with-$ROOT_SOL-$KERNELSU_VER" fi if [ -z "$HAS_GAPPS" ]; then name2="-NoGApps" else name2=-GApps-${ANDROID_API_MAP[$ANDROID_API]} fi artifact_name=WSA_${WSA_VER}_${ARCH}_${WSA_REL}${name1}${name2} [ "$REMOVE_AMAZON" ] && artifact_name+=-NoAmazon if [ -f "$OUTPUT_DIR" ]; then rm -rf ${OUTPUT_DIR:?} fi if [ ! -d "$OUTPUT_DIR" ]; then mkdir -p "$OUTPUT_DIR" fi OUTPUT_PATH="${OUTPUT_DIR:?}/$artifact_name" if [ "$COMPRESS_FORMAT" != "none" ]; then mv "$WORK_DIR/wsa/$ARCH" "$WORK_DIR/wsa/$artifact_name" if [ -n "$COMPRESS_FORMAT" ]; then FILE_EXT=".$COMPRESS_FORMAT" OUTPUT_PATH="$OUTPUT_PATH$FILE_EXT" fi rm -f "${OUTPUT_PATH:?}" || abort if [ "$COMPRESS_FORMAT" = "7z" ]; then echo "Compressing with 7z to $OUTPUT_PATH" 7z a "${OUTPUT_PATH:?}" "$WORK_DIR/wsa/$artifact_name" || abort elif [ "$COMPRESS_FORMAT" = "zip" ]; then echo "Compressing with zip to $OUTPUT_PATH" 7z -tzip a "$OUTPUT_PATH" "$WORK_DIR/wsa/$artifact_name" || abort fi else rm -rf "${OUTPUT_PATH:?}" || abort echo "Copying to $OUTPUT_PATH" cp -r "$WORK_DIR/wsa/$ARCH" "$OUTPUT_PATH" || abort fi ================================================ FILE: scripts/extractMagisk.py ================================================ #!/usr/bin/python3 # # This file is part of MagiskOnWSALocal. # # MagiskOnWSALocal is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # MagiskOnWSALocal 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with MagiskOnWSALocal. If not, see . # # Copyright (C) 2024 LSPosed Contributors # import sys import zipfile from pathlib import Path import platform import os from typing import Any, OrderedDict class Prop(OrderedDict): def __init__(self, props: str = ...) -> None: super().__init__() for i, line in enumerate(props.splitlines(False)): if '=' in line: k, v = line.split('=', 1) self[k] = v else: self[f".{i}"] = line def __setattr__(self, __name: str, __value: Any) -> None: self[__name] = __value def __repr__(self): return '\n'.join(f'{item}={self[item]}' for item in self) is_x86_64 = platform.machine() in ("AMD64", "x86_64") host_abi = "x64" if is_x86_64 else "arm64" arch = sys.argv[1] magisk_zip = sys.argv[2] workdir = Path(sys.argv[3]) workdir.mkdir(parents=True, exist_ok=True) abi_map = {"x64": ["x86_64", "x86"], "arm64": ["arm64-v8a", "armeabi-v7a"]} def extract_as(zip, name, as_name, dir): info = zip.getinfo(name) info.filename = as_name zip.extract(info, workdir / dir) with zipfile.ZipFile(magisk_zip) as zip: props = Prop(zip.comment.decode().replace('\000', '\n')) namelist = zip.namelist() versionName = props.get("version") versionCode = props.get("versionCode") print(f"Magisk version: {versionName} ({versionCode})", flush=True) if 'WSA_WORK_ENV' in os.environ and Path(os.environ['WSA_WORK_ENV']).is_file(): with open(os.environ['WSA_WORK_ENV'], 'r') as environ_file: env = Prop(environ_file.read()) env.MAGISK_VERSION_NAME = versionName env.MAGISK_VERSION_CODE = versionCode with open(os.environ['WSA_WORK_ENV'], 'w') as environ_file: environ_file.write(str(env)) if f"lib/{ abi_map[arch][0] }/libmagisk64.so" in namelist: extract_as(zip, f"lib/{ abi_map[arch][0] }/libmagisk64.so", "magisk64", "magisk") extract_as(zip, f"lib/{ abi_map[arch][1] }/libmagisk32.so", "magisk32", "magisk") else: extract_as(zip, f"lib/{ abi_map[arch][0] }/libmagisk.so", "magisk", "magisk") if f"lib/{ abi_map[arch][0] }/libinit-ld.so" in namelist: extract_as(zip, f"lib/{ abi_map[arch][0] }/libinit-ld.so", "init-ld", "magisk") extract_as(zip, f"lib/{ abi_map[arch][0] }/libmagiskinit.so", "magiskinit", "magisk") extract_as(zip, f"lib/{ abi_map[host_abi][0] }/libmagiskboot.so", "magiskboot", "magisk") ================================================ FILE: scripts/extractWSA.py ================================================ #!/usr/bin/python3 # # This file is part of MagiskOnWSALocal. # # MagiskOnWSALocal is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # MagiskOnWSALocal 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with MagiskOnWSALocal. If not, see . # # Copyright (C) 2023 LSPosed Contributors # import os import sys from typing import Any, OrderedDict import zipfile from pathlib import Path import re import shutil class Prop(OrderedDict): def __init__(self, props: str = ...) -> None: super().__init__() for i, line in enumerate(props.splitlines(False)): if '=' in line: k, v = line.split('=', 1) self[k] = v else: self[f".{i}"] = line def __setattr__(self, __name: str, __value: Any) -> None: self[__name] = __value def __repr__(self): return '\n'.join(f'{item}={self[item]}' for item in self) arch = sys.argv[1] zip_name = "" wsa_zip_path = Path(sys.argv[2]) rootdir = Path(sys.argv[3]) env_file = Path(sys.argv[4]) workdir = rootdir / "wsa" archdir = Path(workdir / arch) pridir = workdir / archdir / 'pri' xmldir = workdir / archdir / 'xml' if not Path(rootdir).is_dir(): rootdir.mkdir() if Path(workdir).is_dir(): shutil.rmtree(workdir) else: workdir.unlink(missing_ok=True) if not Path(workdir).is_dir(): workdir.mkdir() if not Path(archdir).is_dir(): archdir.mkdir() uid = os.getuid() workdir_rw = os.access(workdir, os.W_OK) with zipfile.ZipFile(wsa_zip_path) as zip: for f in zip.filelist: filename_lower = f.filename.lower() if arch in filename_lower: zip_name = f.filename if not Path(workdir / zip_name).is_file(): print(f"unzipping {zip_name} to {workdir}", flush=True) zip_path = zip.extract(f, workdir) with zipfile.ZipFile(zip_path) as wsa_zip: stat = Path(zip_path).stat() print(f"unzipping from {zip_path}", flush=True) wsa_zip.extractall(archdir) ver_no = zip_name.split("_") long_ver = ver_no[1] ver = long_ver.split(".") major_ver = ver[0] rel = ver_no[3].split(".") rel_long = str(rel[0]) with open(env_file, 'r') as environ_file: env = Prop(environ_file.read()) env.WSA_VER = long_ver env.WSA_MAJOR_VER = major_ver env.WSA_REL = rel_long with open(env_file, 'w') as environ_file: environ_file.write(str(env)) if 'language' in filename_lower or 'scale' in filename_lower: name = f.filename.split("_")[2].split(".")[0] zip.extract(f, workdir) with zipfile.ZipFile(workdir / f.filename) as l: for g in l.filelist: if g.filename == 'resources.pri': g.filename = f'resources.{name}.pri' l.extract(g, pridir) elif g.filename == 'AppxManifest.xml': g.filename = f'resources.{name}.xml' l.extract(g, xmldir) elif re.search(r'Images/.+\.png', g.filename): l.extract(g, archdir) ================================================ FILE: scripts/gapps_debug.sh ================================================ #!/bin/bash # # This file is part of MagiskOnWSALocal. # # MagiskOnWSALocal is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # MagiskOnWSALocal 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with MagiskOnWSALocal. If not, see . # # Copyright (C) 2024 LSPosed Contributors # if [ ! "$BASH_VERSION" ]; then echo "Please do not use sh to run this script, just execute it directly" 1>&2 exit 1 fi HOST_ARCH=$(uname -m) if [ "$HOST_ARCH" != "x86_64" ] && [ "$HOST_ARCH" != "aarch64" ]; then echo "Unsupported architectures: $HOST_ARCH" exit 1 fi cd "$(dirname "$0")" || exit 1 # export TMPDIR=$HOME/.cache/wsa if [ "$TMPDIR" ] && [ ! -d "$TMPDIR" ]; then mkdir -p "$TMPDIR" fi WORK_DIR=$(mktemp -d -t wsa-build-XXXXXXXXXX_) || exit 1 DOWNLOAD_DIR=../download PYTHON_VENV_DIR="$(dirname "$PWD")/python3-env" dir_clean() { rm -rf "${WORK_DIR:?}" if [ "$TMPDIR" ] && [ -d "$TMPDIR" ]; then echo "Cleanup Temp Directory" rm -rf "${TMPDIR:?}" unset TMPDIR fi if [ "$(python3 -c 'import sys ; print( 1 if sys.prefix != sys.base_prefix else 0 )')" = "1" ]; then echo "deactivate python3 venv" deactivate fi } trap dir_clean EXIT abort() { [ "$1" ] && echo -e "ERROR: $1" echo "Build: an error has occurred, exit" if [ -d "$WORK_DIR" ]; then echo -e "\nCleanup Work Directory" dir_clean fi exit 1 } trap abort INT TERM # shellcheck disable=SC1091 [ -f "$PYTHON_VENV_DIR/bin/activate" ] && { source "$PYTHON_VENV_DIR/bin/activate" || abort "Failed to activate virtual environment, please re-run install_deps.sh" } declare -A ANDROID_API_MAP=(["30"]="11.0" ["32"]="12.1" ["33"]="13.0") declare -A ARCH_NAME_MAP=(["x64"]="x86_64" ["arm64"]="arm64") ANDROID_API=33 MAGISK_VER=$1 ARCH=$2 TARGET=$3 if [ -z "$MAGISK_VER" ] || [ -z "$ARCH" ] || [ -z "$TARGET" ]; then echo "Usage: $0 " exit 1 fi update_gapps_files_name() { GAPPS_IMAGE_NAME=gapps-${ANDROID_API_MAP[$ANDROID_API]}-${ARCH_NAME_MAP[$ARCH]}.img GAPPS_RC_NAME=gapps-${ANDROID_API_MAP[$ANDROID_API]}.rc GAPPS_IMAGE_PATH=$DOWNLOAD_DIR/$GAPPS_IMAGE_NAME GAPPS_RC_PATH=$DOWNLOAD_DIR/$GAPPS_RC_NAME } MAGISK_ZIP=magisk-$MAGISK_VER.zip MAGISK_PATH=$DOWNLOAD_DIR/$MAGISK_ZIP if [ ! -f "$MAGISK_PATH" ]; then echo "Custom Magisk $MAGISK_ZIP not found" MAGISK_ZIP=app-$MAGISK_VER.apk echo -e "Fallback to $MAGISK_ZIP\n" MAGISK_PATH=$DOWNLOAD_DIR/$MAGISK_ZIP if [ ! -f "$MAGISK_PATH" ]; then abort "Custom Magisk $MAGISK_ZIP not found\nPlease put custom Magisk in $DOWNLOAD_DIR" fi fi echo "Extracting Magisk" if [ -f "$MAGISK_PATH" ]; then if ! python3 extractMagisk.py "$ARCH" "$MAGISK_PATH" "$WORK_DIR"; then abort "Unzip Magisk failed, is the download incomplete?" fi chmod +x "$WORK_DIR/magisk/magiskboot" || abort elif [ -z "${CUSTOM_MAGISK+x}" ]; then abort "The Magisk zip package does not exist, is the download incomplete?" else abort "The Magisk zip package does not exist, rename it to magisk-debug.zip and put it in the download folder." fi echo -e "done\n" update_gapps_files_name if [ -f "$GAPPS_IMAGE_PATH" ] && [ -f "$GAPPS_RC_PATH" ]; then echo "Integrating GApps" "$WORK_DIR/magisk/magiskboot" cpio "$TARGET" \ "add 000 overlay.d/gapps.rc $GAPPS_RC_PATH" \ "add 000 overlay.d/sbin/lsp_gapps.img $GAPPS_IMAGE_PATH" || abort "Unable to patch initrd" echo -e "done\n" else abort "The GApps package does not exist." fi ================================================ FILE: scripts/generateGappsLink.py ================================================ #!/usr/bin/python3 # # This file is part of MagiskOnWSALocal. # # MagiskOnWSALocal is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # MagiskOnWSALocal 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with MagiskOnWSALocal. If not, see . # # Copyright (C) 2025 LSPosed Contributors # import sys from pathlib import Path arch = sys.argv[1] arg2 = sys.argv[2] download_dir = Path.cwd().parent / "download" if arg2 == "" else Path(arg2) tempScript = sys.argv[3] android_api = sys.argv[4] file_name = sys.argv[5] print(f"Generating GApps download link: arch={arch}", flush=True) abi_map = {"x64": "x86_64", "arm64": "arm64"} android_api_map = {"30": "11.0", "32": "12.1", "33": "13.0"} release = android_api_map[android_api] download_files = {} download_files[f"gapps-{release}.rc"] = f"https://github.com/LSPosed/WSA-Addon/releases/latest/download/gapps-{release}.rc" download_files[f"gapps-{release}-{abi_map[arch]}.img"] = f"https://github.com/LSPosed/WSA-Addon/releases/latest/download/gapps-{release}-{abi_map[arch]}.img" with open(download_dir / tempScript, "a") as f: for key, value in download_files.items(): print(f"download link: {value}\npath: {download_dir / key}\n", flush=True) f.writelines(value + "\n") f.writelines(f" dir={download_dir}\n") f.writelines(f" out={key}\n") ================================================ FILE: scripts/generateKernelSULink.py ================================================ #!/usr/bin/python3 # # This file is part of MagiskOnWSALocal. # # MagiskOnWSALocal is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # MagiskOnWSALocal 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with MagiskOnWSALocal. If not, see . # # Copyright (C) 2024 LSPosed Contributors # from datetime import datetime import sys import os from typing import Any, OrderedDict import requests import json import re from pathlib import Path from packaging import version class Prop(OrderedDict): def __init__(self, props: str = ...) -> None: super().__init__() for i, line in enumerate(props.splitlines(False)): if '=' in line: k, v = line.split('=', 1) self[k] = v else: self[f".{i}"] = line def __setattr__(self, __name: str, __value: Any) -> None: self[__name] = __value def __repr__(self): return '\n'.join(f'{item}={self[item]}' for item in self) arch = sys.argv[1] arg2 = sys.argv[2] download_dir = Path.cwd().parent / "download" if arg2 == "" else Path(arg2) tempScript = sys.argv[3] kernelVersion = sys.argv[4] file_name = sys.argv[5] abi_map = {"x64": "x86_64", "arm64": "arm64"} print( f"Generating KernelSU download link: arch={abi_map[arch]}, kernel version={kernelVersion}", flush=True) res = requests.get( f"https://api.github.com/repos/tiann/KernelSU/releases/latest") json_data = json.loads(res.content) headers = res.headers x_ratelimit_remaining = headers["x-ratelimit-remaining"] kernel_ver = 0 if res.status_code == 200: link = "" assets = json_data["assets"] for asset in assets: asset_name = asset["name"] if re.match(rf'kernel-WSA-{abi_map[arch]}-{kernelVersion}.*\.zip$', asset_name) and asset["content_type"] == "application/zip": tmp_kernel_ver = re.search( u'\d{1}.\d{1,}.\d{1,}.\d{1,}', asset_name.split("-")[3]).group() if (kernel_ver == 0): kernel_ver = tmp_kernel_ver elif version.parse(kernel_ver) < version.parse(tmp_kernel_ver): kernel_ver = tmp_kernel_ver print(f"Kernel version: {kernel_ver}", flush=True) for asset in assets: if re.match(rf'kernel-WSA-{abi_map[arch]}-{kernel_ver}.*\.zip$', asset["name"]) and asset["content_type"] == "application/zip": link = asset["browser_download_url"] break if link == "": print( f"Error: No KernelSU release found for arch={abi_map[arch]}, kernel version={kernelVersion}", flush=True) exit(1) release_name = json_data["name"] with open(os.environ['WSA_WORK_ENV'], 'r') as environ_file: env = Prop(environ_file.read()) env.KERNELSU_VER = release_name with open(os.environ['WSA_WORK_ENV'], 'w') as environ_file: environ_file.write(str(env)) elif res.status_code == 403 and x_ratelimit_remaining == '0': message = json_data["message"] print(f"Github API Error: {message}", flush=True) ratelimit_reset = headers["x-ratelimit-reset"] ratelimit_reset = datetime.fromtimestamp(int(ratelimit_reset)) print( f"The current rate limit window resets in {ratelimit_reset}", flush=True) exit(1) print(f"download link: {link}", flush=True) with open(download_dir/tempScript, 'a') as f: f.writelines(f'{link}\n') f.writelines(f' dir={download_dir}\n') f.writelines(f' out={file_name}\n') ================================================ FILE: scripts/generateMagiskLink.py ================================================ #!/usr/bin/python3 # # This file is part of MagiskOnWSALocal. # # MagiskOnWSALocal is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # MagiskOnWSALocal 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with MagiskOnWSALocal. If not, see . # # Copyright (C) 2025 LSPosed Contributors # import sys import json import requests from pathlib import Path magisk_ver = sys.argv[1] download_dir = (Path.cwd().parent / "download" if sys.argv[2] == "" else Path(sys.argv[2])) tempScript = sys.argv[3] download_files = {} cdn_hosts = [ "cdn.jsdelivr.net", "fastly.jsdelivr.net", "testingcf.jsdelivr.net", "gcore.jsdelivr.net", ] print(f"Generating Magisk download link: release type={magisk_ver}", flush=True) magisk_link = None if not magisk_ver: magisk_ver = "stable" if ( magisk_ver == "stable" or magisk_ver == "beta" or magisk_ver == "canary" or magisk_ver == "debug" ): try: magisk_link = json.loads(requests.get(f"https://topjohnwu.github.io/magisk-files/{magisk_ver}.json").content)["magisk"]["link"] download_files[f"magisk-{magisk_ver}.zip"] = magisk_link except Exception: print("Failed to fetch from GitHub API, fallbacking to jsdelivr...") for host in cdn_hosts: try: magisk_link = json.loads(requests.get(f"https://{host}/gh/topjohnwu/magisk-files@master/{magisk_ver}.json").content)["magisk"]["link"] download_files[f"magisk-{magisk_ver}.zip"] = magisk_link break except Exception: print(f"Failed to fetch from {host}, trying next...", flush=True) pass finally: if magisk_link is None: print("Failed to fetch Magisk download link", flush=True) exit(1) download_files["cust.img"] = "https://github.com/LSPosed/WSA-Addon/releases/latest/download/cust.img" with open(download_dir / tempScript, "a") as f: for key, value in download_files.items(): print(f"download link: {value}\npath: {download_dir / key}\n", flush=True) f.writelines(value + "\n") f.writelines(f" dir={download_dir}\n") f.writelines(f" out={key}\n") ================================================ FILE: scripts/generateWSALinks.py ================================================ #!/usr/bin/python3 # # This file is part of MagiskOnWSALocal. # # MagiskOnWSALocal is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # MagiskOnWSALocal 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with MagiskOnWSALocal. If not, see . # # Copyright (C) 2024 LSPosed Contributors # import html import logging import re import sys from pathlib import Path from threading import Thread from typing import Any, OrderedDict from xml.dom import minidom from requests import Session from packaging import version class Prop(OrderedDict): def __init__(self, props: str = ...) -> None: super().__init__() for i, line in enumerate(props.splitlines(False)): if '=' in line: k, v = line.split('=', 1) self[k] = v else: self[f".{i}"] = line def __setattr__(self, __name: str, __value: Any) -> None: self[__name] = __value def __repr__(self): return '\n'.join(f'{item}={self[item]}' for item in self) logging.captureWarnings(True) arch = sys.argv[1] release_name_map = {"retail": "Retail", "RP": "Release Preview", "WIS": "Insider Slow", "WIF": "Insider Fast"} release_type = sys.argv[2] if sys.argv[2] != "" else "Retail" release_name = release_name_map[release_type] download_dir = Path.cwd().parent / \ "download" if sys.argv[3] == "" else Path(sys.argv[3]) ms_account_conf = download_dir/".ms_account" tempScript = sys.argv[4] skip_wsa_download = sys.argv[5] == "1" if len(sys.argv) >= 6 else False cat_id = '858014f3-3934-4abe-8078-4aa193e74ca8' user = '' session = Session() session.verify = False if ms_account_conf.is_file(): with open(ms_account_conf, "r") as f: conf = Prop(f.read()) user = conf.get('user_code') print( f"Generating WSA download link: arch={arch} release_type={release_name}\n", flush=True) with open(Path.cwd().parent / ("xml/GetCookie.xml"), "r") as f: cookie_content = f.read().format(user) out = session.post( 'https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx', data=cookie_content, headers={'Content-Type': 'application/soap+xml; charset=utf-8'} ) doc = minidom.parseString(out.text) cookie = doc.getElementsByTagName('EncryptedData')[0].firstChild.nodeValue with open(Path.cwd().parent / "xml/WUIDRequest.xml", "r") as f: cat_id_content = f.read().format(user, cookie, cat_id, release_type) out = session.post( 'https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx', data=cat_id_content, headers={'Content-Type': 'application/soap+xml; charset=utf-8'} ) doc = minidom.parseString(html.unescape(out.text)) filenames = {} for node in doc.getElementsByTagName('ExtendedUpdateInfo')[0].getElementsByTagName('Updates')[0].getElementsByTagName('Update'): node_xml = node.getElementsByTagName('Xml')[0] node_files = node_xml.getElementsByTagName('Files') if not node_files: continue else: for node_file in node_files[0].getElementsByTagName('File'): if node_file.hasAttribute('InstallerSpecificIdentifier') and node_file.hasAttribute('FileName'): filenames[node.getElementsByTagName('ID')[0].firstChild.nodeValue] = (f"{node_file.attributes['InstallerSpecificIdentifier'].value}_{node_file.attributes['FileName'].value}", node_xml.getElementsByTagName('ExtendedProperties')[0].attributes['PackageIdentityName'].value) identities = {} for node in doc.getElementsByTagName('NewUpdates')[0].getElementsByTagName('UpdateInfo'): node_xml = node.getElementsByTagName('Xml')[0] if not node_xml.getElementsByTagName('SecuredFragment'): continue else: id = node.getElementsByTagName('ID')[0].firstChild.nodeValue update_identity = node_xml.getElementsByTagName('UpdateIdentity')[0] if id in filenames: fileinfo = filenames[id] if fileinfo[0] not in identities: identities[fileinfo[0]] = ([update_identity.attributes['UpdateID'].value, update_identity.attributes['RevisionNumber'].value], fileinfo[1]) with open(Path.cwd().parent / "xml/FE3FileUrl.xml", "r") as f: FE3_file_content = f.read() if not download_dir.is_dir(): download_dir.mkdir() tmpdownlist = open(download_dir/tempScript, 'a') download_files = {} def send_req(i, v, out_file_name): out = session.post( 'https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured', data=FE3_file_content.format(user, i, v, release_type), headers={'Content-Type': 'application/soap+xml; charset=utf-8'} ) doc = minidom.parseString(out.text) for l in doc.getElementsByTagName("FileLocation"): url = l.getElementsByTagName("Url")[0].firstChild.nodeValue if len(url) != 99: download_files[out_file_name] = url threads = [] wsa_build_ver = 0 for filename, values in identities.items(): if re.match(rf"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename): tmp_wsa_build_ver = re.search( r'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group() if (wsa_build_ver == 0): wsa_build_ver = tmp_wsa_build_ver elif version.parse(wsa_build_ver) < version.parse(tmp_wsa_build_ver): wsa_build_ver = tmp_wsa_build_ver for filename, values in identities.items(): if re.match(rf"Microsoft\.UI\.Xaml\..*_{arch}_.*\.appx", filename): out_file_name = f"{values[1]}_{arch}.appx" out_file = download_dir / out_file_name elif re.match(rf"Microsoft\.VCLibs\..+\.UWPDesktop_.*_{arch}_.*\.appx", filename): out_file_name = f"{values[1]}_{arch}.appx" out_file = download_dir / out_file_name elif re.match(rf"Microsoft\.VCLibs\..+_.*_{arch}_.*\.appx", filename): out_file_name = f"{values[1]}_{arch}.appx" out_file = download_dir / out_file_name elif not skip_wsa_download and re.match(rf"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename): tmp_wsa_build_ver = re.search( r'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group() if (wsa_build_ver != tmp_wsa_build_ver): continue version_splitted = wsa_build_ver.split(".") major_ver = version_splitted[0] minor_ver = version_splitted[1] build_ver = version_splitted[2] revision_ver = version_splitted[3] out_file_name = f"wsa-{release_type}.zip" out_file = download_dir / out_file_name else: continue th = Thread(target=send_req, args=( values[0][0], values[0][1], out_file_name)) threads.append(th) th.daemon = True th.start() for th in threads: th.join() print(f'WSA Build Version={wsa_build_ver}\n', flush=True) for key, value in download_files.items(): print(f"download link: {value}\npath: {download_dir / key}\n", flush=True) tmpdownlist.writelines(value + '\n') tmpdownlist.writelines(f' dir={download_dir}\n') tmpdownlist.writelines(f' out={key}\n') tmpdownlist.close() ================================================ FILE: scripts/init.lsp.magisk.rc ================================================ on post-fs-data exec u:r:magisk:s0 0 0 -- /system/bin/sh ${MAGISKTMP}/post-fs-data.sh ================================================ FILE: scripts/install_deps.sh ================================================ #!/bin/bash # # This file is part of MagiskOnWSALocal. # # MagiskOnWSALocal is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # MagiskOnWSALocal 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with MagiskOnWSALocal. If not, see . # # Copyright (C) 2023 LSPosed Contributors # if [ ! "$BASH_VERSION" ]; then echo "Please do not use sh to run this script, just execute it directly" 1>&2 exit 1 fi cd "$(dirname "$0")" || exit 1 abort() { [ "$1" ] && echo "ERROR: $1" echo "Dependencies: an error has occurred, exit" exit 1 } require_su() { if test "$(id -u)" != "0"; then if [ "$(sudo id -u)" != "0" ]; then echo "sudo is required to run this script" abort fi fi } echo "Checking and ensuring dependencies" check_dependencies() { command -v whiptail >/dev/null 2>&1 || command -v dialog >/dev/null 2>&1 || NEED_INSTALL+=("whiptail") command -v pip >/dev/null 2>&1 || NEED_INSTALL+=("python3-pip") command -v aria2c >/dev/null 2>&1 || NEED_INSTALL+=("aria2") command -v 7z >/dev/null 2>&1 || NEED_INSTALL+=("p7zip-full") command -v unzip >/dev/null 2>&1 || NEED_INSTALL+=("unzip") } check_dependencies osrel=$(sed -n '/^ID_LIKE=/s/^.*=//p' /etc/os-release) declare -A os_pm_install # os_pm_install["/etc/redhat-release"]=yum os_pm_install["/etc/arch-release"]=pacman os_pm_install["/etc/gentoo-release"]=emerge os_pm_install["/etc/SuSE-release"]=zypper os_pm_install["/etc/debian_version"]=apt-get # os_pm_install["/etc/alpine-release"]=apk declare -A PM_UPDATE_MAP PM_UPDATE_MAP["yum"]="check-update" PM_UPDATE_MAP["pacman"]="-Syu --noconfirm" PM_UPDATE_MAP["emerge"]="-auDU1 @world" PM_UPDATE_MAP["zypper"]="ref" PM_UPDATE_MAP["apt-get"]="update" PM_UPDATE_MAP["apk"]="update" declare -A PM_INSTALL_MAP PM_INSTALL_MAP["yum"]="install -y" PM_INSTALL_MAP["pacman"]="-S --noconfirm --needed" PM_INSTALL_MAP["emerge"]="-a" PM_INSTALL_MAP["zypper"]="in -y" PM_INSTALL_MAP["apt-get"]="install -y" PM_INSTALL_MAP["apk"]="add" declare -A PM_UPGRADE_MAP PM_UPGRADE_MAP["apt-get"]="upgrade -y" PM_UPGRADE_MAP["zypper"]="up -y" check_package_manager() { for f in "${!os_pm_install[@]}"; do if [[ -f $f ]]; then PM="${os_pm_install[$f]}" break fi done if [[ "$osrel" = *"suse"* ]]; then PM="zypper" fi if [ -n "$PM" ]; then readarray -td ' ' UPDATE_OPTION <<<"${PM_UPDATE_MAP[$PM]} " unset 'UPDATE_OPTION[-1]' readarray -td ' ' INSTALL_OPTION <<<"${PM_INSTALL_MAP[$PM]} " unset 'INSTALL_OPTION[-1]' readarray -td ' ' UPGRADE_OPTION <<<"${PM_UPGRADE_MAP[$PM]} " unset 'UPGRADE_OPTION[-1]' fi } check_package_manager require_su if [ -z "$PM" ]; then echo "Unable to determine package manager: Unsupported distros" abort elif [[ "$PM" =~ pacman|emerge ]]; then [ "$PM" = "emerge" ] && (sudo emerge -qoO aria2[adns] || abort) i=30 while ((i-- > 1)) && ! read -r -sn 1 -t 1 -p $'\r:: Proceed with full system upgrade? Cancel after '$i$'s.. [y/N]\e[0K ' answer; do : done [[ $answer == [yY] ]] && answer=Yes || answer=No echo "$answer" case "$answer" in Yes) if ! (sudo "$PM" "${UPDATE_OPTION[@]}" ca-certificates); then abort; fi ;; *) abort "Operation cancelled by user" ;; esac else if ! (sudo "$PM" "${UPDATE_OPTION[@]}" && sudo "$PM" "${UPGRADE_OPTION[@]}" ca-certificates); then abort; fi fi if [ -n "${NEED_INSTALL[*]}" ]; then if [ "$PM" = "zypper" ]; then NEED_INSTALL_FIX=${NEED_INSTALL[*]} { NEED_INSTALL_FIX=${NEED_INSTALL_FIX//whiptail/dialog} 2>&1 } >>/dev/null readarray -td ' ' NEED_INSTALL <<<"$NEED_INSTALL_FIX " unset 'NEED_INSTALL[-1]' elif [ "$PM" = "apk" ]; then NEED_INSTALL_FIX=${NEED_INSTALL[*]} readarray -td ' ' NEED_INSTALL <<<"${NEED_INSTALL_FIX//p7zip-full/p7zip} " unset 'NEED_INSTALL[-1]' elif [ "$PM" = "pacman" ]; then NEED_INSTALL_FIX=${NEED_INSTALL[*]} { NEED_INSTALL_FIX=${NEED_INSTALL_FIX//whiptail/libnewt} 2>&1 NEED_INSTALL_FIX=${NEED_INSTALL_FIX//python3-pip/python-pip} 2>&1 NEED_INSTALL_FIX=${NEED_INSTALL_FIX//p7zip-full/p7zip} 2>&1 } >>/dev/null readarray -td ' ' NEED_INSTALL <<<"$NEED_INSTALL_FIX " unset 'NEED_INSTALL[-1]' elif [ "$PM" = "emerge" ]; then NEED_INSTALL_FIX=${NEED_INSTALL[*]} { NEED_INSTALL_FIX=${NEED_INSTALL_FIX//whiptail/dialog} 2>&1 NEED_INSTALL_FIX=${NEED_INSTALL_FIX//python3-pip/dev-python/pip} 2>&1 NEED_INSTALL_FIX=${NEED_INSTALL_FIX//p7zip-full/p7zip} 2>&1 } >>/dev/null readarray -td ' ' NEED_INSTALL <<<"$NEED_INSTALL_FIX " unset 'NEED_INSTALL[-1]' fi if ! (sudo "$PM" "${INSTALL_OPTION[@]}" "${NEED_INSTALL[@]}"); then abort; fi fi python_version=$(python3 -c 'import sys;print("{0}{1}".format(*(sys.version_info[:2])))') PYTHON_VENV_DIR="$(dirname "$PWD")/python3-env" if [ "$python_version" -ge 311 ] || [ -f "$PYTHON_VENV_DIR/bin/activate" ]; then if ! (python3 -c "import venv" >/dev/null 2>&1) || ! (python3 -c "import ensurepip" >/dev/null 2>&1); then case "$PM" in zypper) if ! (sudo "$PM" "${INSTALL_OPTION[@]}" "python3-venvctrl"); then abort fi ;; *) if ! (sudo "$PM" "${INSTALL_OPTION[@]}" "python3-venv"); then abort fi ;; esac fi echo "Creating python3 virtual env" python3 -m venv --system-site-packages "$PYTHON_VENV_DIR" || { echo "Failed to upgrade python3 virtual env, clear and recreate" python3 -m venv --clear --system-site-packages "$PYTHON_VENV_DIR" || abort "Failed to create python3 virtual env" } fi if [ -f "$PYTHON_VENV_DIR/bin/activate" ]; then # shellcheck disable=SC1091 source "$PYTHON_VENV_DIR"/bin/activate || abort "Failed to activate python3 virtual env" python3 -c "import pkg_resources; pkg_resources.require(open('requirements.txt',mode='r'))" &>/dev/null || { echo "Installing Python3 dependencies" python3 -m pip install -r requirements.txt || abort "Failed to install python3 dependencies" } deactivate else python3 -m pip install -r requirements.txt -q || abort "Failed to install python3 dependencies" fi ================================================ FILE: scripts/magisk_debug.sh ================================================ #!/bin/bash # # This file is part of MagiskOnWSALocal. # # MagiskOnWSALocal is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # MagiskOnWSALocal 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with MagiskOnWSALocal. If not, see . # # Copyright (C) 2024 LSPosed Contributors # if [ ! "$BASH_VERSION" ]; then echo "Please do not use sh to run this script, just execute it directly" 1>&2 exit 1 fi HOST_ARCH=$(uname -m) if [ "$HOST_ARCH" != "x86_64" ] && [ "$HOST_ARCH" != "aarch64" ]; then echo "Unsupported architectures: $HOST_ARCH" exit 1 fi cd "$(dirname "$0")" || exit 1 # export TMPDIR=$HOME/.cache/wsa if [ "$TMPDIR" ] && [ ! -d "$TMPDIR" ]; then mkdir -p "$TMPDIR" fi WORK_DIR=$(mktemp -d -t wsa-build-XXXXXXXXXX_) || exit 1 DOWNLOAD_DIR=../download PYTHON_VENV_DIR="$(dirname "$PWD")/python3-env" dir_clean() { rm -rf "${WORK_DIR:?}" if [ "$TMPDIR" ] && [ -d "$TMPDIR" ]; then echo "Cleanup Temp Directory" rm -rf "${TMPDIR:?}" unset TMPDIR fi if [ "$(python3 -c 'import sys ; print( 1 if sys.prefix != sys.base_prefix else 0 )')" = "1" ]; then echo "deactivate python3 venv" deactivate fi } trap dir_clean EXIT abort() { [ "$1" ] && echo -e "ERROR: $1" echo "Build: an error has occurred, exit" if [ -d "$WORK_DIR" ]; then echo -e "\nCleanup Work Directory" dir_clean fi exit 1 } trap abort INT TERM # shellcheck disable=SC1091 [ -f "$PYTHON_VENV_DIR/bin/activate" ] && { source "$PYTHON_VENV_DIR/bin/activate" || abort "Failed to activate virtual environment, please re-run install_deps.sh" } MAGISK_VER=$1 ARCH=$2 TARGET=$3 if [ -z "$MAGISK_VER" ] || [ -z "$ARCH" ] || [ -z "$TARGET" ]; then echo "Usage: $0 " exit 1 fi MAGISK_ZIP=magisk-$MAGISK_VER.zip MAGISK_PATH=$DOWNLOAD_DIR/$MAGISK_ZIP if [ ! -f "$MAGISK_PATH" ]; then echo "Custom Magisk $MAGISK_ZIP not found" MAGISK_ZIP=app-$MAGISK_VER.apk echo -e "Fallback to $MAGISK_ZIP\n" MAGISK_PATH=$DOWNLOAD_DIR/$MAGISK_ZIP if [ ! -f "$MAGISK_PATH" ]; then abort "Custom Magisk $MAGISK_ZIP not found\nPlease put custom Magisk in $DOWNLOAD_DIR" fi fi echo "Extracting Magisk" if [ -f "$MAGISK_PATH" ]; then if ! python3 extractMagisk.py "$ARCH" "$MAGISK_PATH" "$WORK_DIR"; then abort "Unzip Magisk failed, is the download incomplete?" fi chmod +x "$WORK_DIR/magisk/magiskboot" || abort elif [ -z "${CUSTOM_MAGISK+x}" ]; then abort "The Magisk zip package does not exist, is the download incomplete?" else abort "The Magisk zip package does not exist, rename it to magisk-debug.zip and put it in the download folder." fi echo -e "done\n" echo "Integrating Magisk" SKIP="#" SINGLEABI="#" SKIPINITLD="#" if [ -f "$WORK_DIR/magisk/magisk64" ]; then "$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/magisk64" "$WORK_DIR/magisk/magisk64.xz" "$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/magisk32" "$WORK_DIR/magisk/magisk32.xz" unset SINGLEABI else "$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/magisk" "$WORK_DIR/magisk/magisk.xz" unset SKIP fi if [ -f "$WORK_DIR/magisk/init-ld" ]; then "$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/init-ld" "$WORK_DIR/magisk/init-ld.xz" unset SKIPINITLD fi "$WORK_DIR/magisk/magiskboot" compress=xz "$MAGISK_PATH" "$WORK_DIR/magisk/stub.xz" "$WORK_DIR/magisk/magiskboot" cpio "$TARGET" \ "add 0750 /lspinit ../bin/$ARCH/lspinit" \ "add 0750 /magiskinit $WORK_DIR/magisk/magiskinit" \ "$SINGLEABI add 0644 overlay.d/sbin/magisk64.xz $WORK_DIR/magisk/magisk64.xz" \ "$SINGLEABI add 0644 overlay.d/sbin/magisk32.xz $WORK_DIR/magisk/magisk32.xz" \ "$SKIP add 0644 overlay.d/sbin/magisk.xz $WORK_DIR/magisk/magisk.xz" \ "$SKIPINITLD add 0644 overlay.d/sbin/init-ld.xz $WORK_DIR/magisk/init-ld.xz" \ "add 0644 overlay.d/sbin/stub.xz $WORK_DIR/magisk/stub.xz" \ || abort "Unable to patch initrd" ================================================ FILE: scripts/post-fs-data.sh ================================================ #!/bin/sh MAGISKTMP=/sbin [ -d /sbin ] || MAGISKTMP=/debug_ramdisk MAGISKBIN=/data/adb/magisk if [ ! -d /data/adb ]; then mkdir -m 700 /data/adb chcon u:object_r:adb_data_file:s0 /data/adb fi if [ ! -d $MAGISKBIN ]; then # shellcheck disable=SC2174 mkdir -p -m 755 $MAGISKBIN chcon u:object_r:system_file:s0 $MAGISKBIN fi ABI=$(getprop ro.product.cpu.abi) for file in busybox magiskpolicy magiskboot magiskinit; do [ -x "$MAGISKBIN/$file" ] || { unzip -d $MAGISKBIN -oj $MAGISKTMP/stub.apk "lib/$ABI/lib$file.so" mv $MAGISKBIN/lib$file.so $MAGISKBIN/$file chmod 755 "$MAGISKBIN/$file" } done for file in util_functions.sh boot_patch.sh; do [ -x "$MAGISKBIN/$file" ] || { unzip -d $MAGISKBIN -oj $MAGISKTMP/stub.apk "assets/$file" chmod 755 "$MAGISKBIN/$file" } done for file in "$MAGISKTMP"/*; do if echo "$file" | grep -Eq "lsp_.+\.img"; then foldername=$(basename "$file" .img) mkdir -p "$MAGISKTMP/$foldername" mount -t auto -o ro,loop "$file" "$MAGISKTMP/$foldername" "$MAGISKTMP/$foldername/post-fs-data.sh" & fi done wait for file in "$MAGISKTMP"/*; do if echo "$file" | grep -Eq "lsp_.+\.img"; then foldername=$(basename "$file" .img) umount "$MAGISKTMP/$foldername" rm -rf "${MAGISKTMP:?}/${foldername:?}" rm -f "$file" fi done ================================================ FILE: scripts/requirements.txt ================================================ requests packaging ================================================ FILE: scripts/run.sh ================================================ #!/bin/bash # # This file is part of MagiskOnWSALocal. # # MagiskOnWSALocal is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # MagiskOnWSALocal 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with MagiskOnWSALocal. If not, see . # # Copyright (C) 2024 LSPosed Contributors # if [ ! "$BASH_VERSION" ]; then echo "Please do not use sh to run this script, just execute it directly" 1>&2 exit 1 fi cd "$(dirname "$0")" || exit 1 ./install_deps.sh || exit 1 WHIPTAIL=$(command -v whiptail 2>/dev/null) DIALOG=$(command -v dialog 2>/dev/null) DIALOG=${WHIPTAIL:-$DIALOG} function Radiolist { declare -A o="$1" shift if ! $DIALOG --nocancel --radiolist "${o[title]}" 0 0 0 "$@" 3>&1 1>&2 2>&3; then echo "${o[default]}" fi } function YesNoBox { declare -A o="$1" local default [ "$2" ] && { [ "$2" = "no" ] && default="--defaultno" } shift $DIALOG --title "${o[title]}" $default --yesno "${o[text]}" 0 0 } function DialogBox { declare -A o="$1" shift $DIALOG --title "${o[title]}" --msgbox "${o[text]}" 0 0 } intro="Welcome to MagiskOnWSA! With this utility, you can integrate Magisk for WSA easily. Use arrow keys to navigate, and press space to select. Press enter to confirm. " DialogBox "([title]='Intro to MagiskOnWSA' \ [text]='$intro')" ARCH=$( Radiolist '([title]="Build arch" [default]="x64")' \ 'x64' "X86_64" 'on' \ 'arm64' "AArch64" 'off' ) RELEASE_TYPE=$( Radiolist '([title]="WSA release type" [default]="retail")' \ 'retail' "Stable Channel" 'on' \ 'release preview' "Release Preview Channel" 'off' \ 'insider slow' "Beta Channel" 'off' \ 'insider fast' "Dev Channel" 'off' ) declare -A RELEASE_TYPE_MAP=(["retail"]="retail" ["release preview"]="RP" ["insider slow"]="WIS" ["insider fast"]="WIF") COMMAND_LINE=(--arch "$ARCH" --release-type "${RELEASE_TYPE_MAP[$RELEASE_TYPE]}") if (YesNoBox '([title]="Root" [text]="Do you want to Root WSA?")'); then ROOT_SOL=$( Radiolist '([title]="Root solution" [default]="magisk")' \ 'magisk' "Magisk" 'on' \ 'kernelsu' "KernelSU" 'off' ) COMMAND_LINE+=(--root-sol "$ROOT_SOL") else COMMAND_LINE+=(--root-sol "none") fi if [ "$ROOT_SOL" = "magisk" ]; then MAGISK_VER=$( Radiolist '([title]="Magisk version" [default]="stable")' \ 'stable' "Stable Channel" 'on' \ 'beta' "Beta Channel" 'off' \ 'canary' "Canary Channel" 'off' \ 'debug' "Canary Channel Debug Build" 'off' ) COMMAND_LINE+=(--magisk-ver "$MAGISK_VER") if (YesNoBox '([title]="Install GApps" [text]="Do you want to install GApps?")'); then COMMAND_LINE+=(--install-gapps) fi fi if (YesNoBox '([title]="Remove Amazon Appstore" [text]="Do you want to remove Amazon Appstore?")' no); then COMMAND_LINE+=(--remove-amazon) fi if (YesNoBox '([title]="Compress output" [text]="Do you want to compress the output?")'); then COMPRESS_FORMAT=$( Radiolist '([title]="Compress format" [default]="7z")' \ '7z' "7-Zip" 'on' \ 'zip' "Zip" 'off' ) COMMAND_LINE+=(--compress-format "$COMPRESS_FORMAT") fi clear echo "COMMAND_LINE=${COMMAND_LINE[*]}" chmod +x ./build.sh ./build.sh "${COMMAND_LINE[@]}" ================================================ FILE: xml/FE3FileUrl.xml ================================================ http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetExtendedUpdateInfo2 urn:uuid:2cc99c2e-3b3e-4fb1-9e31-0cd30e6f43a0 https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured 2017-08-01T00:29:01.868Z 2017-08-01T00:34:01.868Z {} {} {} FileUrl FileDecryption BranchReadinessLevel=CB;CurrentBranch=rs_prerelease;OEMModel=Virtual Machine;FlightRing={};AttrDataVer=21;SystemManufacturer=Microsoft Corporation;InstallLanguage=en-US;OSUILocale=en-US;InstallationType=Client;FlightingBranchName=external;FirmwareVersion=Hyper-V UEFI Release v2.5;SystemProductName=Virtual Machine;OSSkuId=48;FlightContent=Branch;App=WU;OEMName_Uncleaned=Microsoft Corporation;AppVer=10.0.22621.900;OSArchitecture=AMD64;SystemSKU=None;UpdateManagementGroup=2;IsFlightingEnabled=1;IsDeviceRetailDemo=0;TelemetryLevel=3;OSVersion=10.0.22621.900;DeviceFamily=Windows.Desktop; ================================================ FILE: xml/GetCookie.xml ================================================
http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetCookie urn:uuid:b9b43757-2247-4d7b-ae8f-a71ba8a22386 https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx 2017-12-02T00:16:15.210Z 2017-12-29T06:25:43.943Z {}
2015-10-21T17:01:07.1472913Z 2017-12-02T00:16:15.217Z 1.40
================================================ FILE: xml/WUIDRequest.xml ================================================ http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/SyncUpdates urn:uuid:175df68c-4b91-41ee-b70b-f2208c65438e https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx 2017-08-05T02:03:05.038Z 2017-08-05T02:08:05.038Z {} 2045-03-11T02:02:48Z {} false 1 2 3 11 19 544 549 2359974 2359977 5169044 8788830 23110993 23110994 54341900 54343656 59830006 59830007 59830008 60484010 62450018 62450019 62450020 66027979 66053150 97657898 98822896 98959022 98959023 98959024 98959025 98959026 104433538 104900364 105489019 117765322 129905029 130040031 132387090 132393049 133399034 138537048 140377312 143747671 158941041 158941042 158941043 158941044 159123858 159130928 164836897 164847386 164848327 164852241 164852246 164852252 164852253 10 17 2359977 5143990 5169043 5169047 8806526 9125350 9154769 10809856 23110995 23110996 23110999 23111000 23111001 23111002 23111003 23111004 24513870 28880263 30077688 30486944 30526991 30528442 30530496 30530501 30530504 30530962 30535326 30536242 30539913 30545142 30545145 30545488 30546212 30547779 30548797 30548860 30549262 30551160 30551161 30551164 30553016 30553744 30554014 30559008 30559011 30560006 30560011 30561006 30563261 30565215 30578059 30664998 30677904 30681618 30682195 30685055 30702579 30708772 30709591 30711304 30715418 30720106 30720273 30732075 30866952 30866964 30870749 30877852 30878437 30890151 30892149 30990917 31049444 31190936 31196961 31197811 31198836 31202713 31203522 31205442 31205557 31207585 31208440 31208451 31209591 31210536 31211625 31212713 31213588 31218518 31219420 31220279 31220302 31222086 31227080 31229030 31238236 31254198 31258008 36436779 36437850 36464012 41916569 47249982 47283134 58577027 58578040 58578041 58628920 59107045 59125697 59142249 60466586 60478936 66450441 66467021 66479051 75202978 77436021 77449129 85159569 90199702 90212090 96911147 97110308 98528428 98665206 98837995 98842922 98842977 98846632 98866485 98874250 98879075 98904649 98918872 98945691 98959458 98984707 100220125 100238731 100662329 100795834 100862457 103124811 103348671 104369981 104372472 104385324 104465831 104465834 104467697 104473368 104482267 104505005 104523840 104550085 104558084 104659441 104659675 104664678 104668274 104671092 104673242 104674239 104679268 104686047 104698649 104751469 104752478 104755145 104761158 104762266 104786484 104853747 104873258 104983051 105063056 105116588 105178523 105318602 105362613 105364552 105368563 105369591 105370746 105373503 105373615 105376634 105377546 105378752 105379574 105381626 105382587 105425313 105495146 105862607 105939029 105995585 106017178 106129726 106768485 107825194 111906429 115121473 115578654 116630363 117835105 117850671 118638500 118662027 118872681 118873829 118879289 118889092 119501720 119551648 119569538 119640702 119667998 119674103 119697201 119706266 119744627 119773746 120072697 120144309 120214154 120357027 120392612 120399120 120553945 120783545 120797092 120881676 120889689 120999554 121168608 121268830 121341838 121729951 121803677 122165810 125408034 127293130 127566683 127762067 127861893 128571722 128647535 128698922 128701748 128771507 129037212 129079800 129175415 129317272 129319665 129365668 129378095 129424803 129590730 129603714 129625954 129692391 129714980 129721097 129886397 129968371 129972243 130009862 130033651 130040030 130040032 130040033 130091954 130100640 130131267 130131921 130144837 130171030 130172071 130197218 130212435 130291076 130402427 130405166 130676169 130698471 130713390 130785217 131396908 131455115 131682095 131689473 131701956 132142800 132525441 132765492 132801275 133399034 134522926 134524022 134528994 134532942 134536993 134538001 134547533 134549216 134549317 134550159 134550214 134550232 134551154 134551207 134551390 134553171 134553237 134554199 134554227 134555229 134555240 134556118 134557078 134560099 134560287 134562084 134562180 134563287 134565083 134566130 134568111 134624737 134666461 134672998 134684008 134916523 135100527 135219410 135222083 135306997 135463054 135779456 135812968 136097030 136131333 136146907 136157556 136320962 136450641 136466000 136745792 136761546 136840245 138160034 138181244 138210071 138210107 138232200 138237088 138277547 138287133 138306991 138324625 138341916 138372035 138372036 138375118 138378071 138380128 138380194 138534411 138618294 138931764 139536037 139536038 139536039 139536040 140367832 140406050 140421668 140422973 140423713 140436348 140483470 140615715 140802803 140896470 141189437 141192744 141382548 141461680 141624996 141627135 141659139 141872038 141993721 142006413 142045136 142095667 142227273 142250480 142518788 142544931 142546314 142555433 142653044 143191852 143258496 143299722 143331253 143432462 143632431 143695326 144219522 144590916 145410436 146720405 150810438 151258773 151315554 151400090 151429441 151439617 151453617 151466296 151511132 151636561 151823192 151827116 151850642 152016572 153111675 153114652 153123147 153267108 153389799 153395366 153718608 154171028 154315227 154559688 154978771 154979742 154985773 154989370 155044852 155065458 155578573 156403304 159085959 159776047 159816630 160733048 160733049 160733050 160733051 160733056 164824922 164824924 164824926 164824930 164831646 164831647 164831648 164831650 164835050 164835051 164835052 164835056 164835057 164835059 164836898 164836899 164836900 164845333 164845334 164845336 164845337 164845341 164845342 164845345 164845346 164845349 164845350 164845353 164845355 164845358 164845361 164845364 164847387 164847388 164847389 164847390 164848328 164848329 164848330 164849448 164849449 164849451 164849452 164849454 164849455 164849457 164849461 164850219 164850220 164850222 164850223 164850224 164850226 164850227 164850228 164850229 164850231 164850236 164850237 164850240 164850242 164850243 164852242 164852243 164852244 164852247 164852248 164852249 164852250 164852251 164852254 164852256 164852257 164852258 164852259 164852260 164852261 164852262 164853061 164853063 164853071 164853072 164853075 168118980 168118981 168118983 168118984 168180375 168180376 168180378 168180379 168270830 168270831 168270833 168270834 168270835 false true {} true false Extended en-US en en-US false BranchReadinessLevel=CB;CurrentBranch=rs_prerelease;OEMModel=Virtual Machine;FlightRing={};AttrDataVer=21;SystemManufacturer=Microsoft Corporation;InstallLanguage=en-US;OSUILocale=en-US;InstallationType=Client;FlightingBranchName=external;FirmwareVersion=Hyper-V UEFI Release v2.5;SystemProductName=Virtual Machine;OSSkuId=48;FlightContent=Branch;App=WU;OEMName_Uncleaned=Microsoft Corporation;AppVer=10.0.22621.900;OSArchitecture=AMD64;SystemSKU=None;UpdateManagementGroup=2;IsFlightingEnabled=1;IsDeviceRetailDemo=0;TelemetryLevel=3;OSVersion=10.0.22621.900;DeviceFamily=Windows.Desktop; Interactive=1;IsSeeker=0; ================================================ FILE: xml/priconfig.xml ================================================