├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── codeql-analysis.yml ├── .gitignore ├── LICENSE ├── README.md ├── VERSION.txt ├── app ├── VERSION.txt ├── __init__.py ├── main.py ├── resources.py └── utils.py ├── banner.png ├── img ├── about.png ├── drop_here.png ├── exit.png ├── help.png ├── image_loaded.png ├── iso.png └── mini_logo.png ├── main.py └── setup.py /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Linux Distro:** 27 | - OS: [e.g. Ubuntu] 28 | - Version [e.g. 20.04 LTS] 29 | 30 | **Installation ISO:** 31 | - Android Image ( Androidx86 ) : [e.g. BlissOS, PrimeOS] 32 | - Version [e.g. Mainline] 33 | - Link [If possible link the iso or the official site] 34 | 35 | **Additional context** 36 | Add any other context about the problem here. 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ main ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ main ] 20 | schedule: 21 | - cron: '22 12 * * 4' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'python' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 37 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support 38 | 39 | steps: 40 | - name: Checkout repository 41 | uses: actions/checkout@v3 42 | 43 | # Initializes the CodeQL tools for scanning. 44 | - name: Initialize CodeQL 45 | uses: github/codeql-action/init@v2 46 | with: 47 | languages: ${{ matrix.language }} 48 | # If you wish to specify custom queries, you can do so here or in a config file. 49 | # By default, queries listed here will override any specified in a config file. 50 | # Prefix the list here with "+" to use these queries and those in the config file. 51 | 52 | # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs 53 | # queries: security-extended,security-and-quality 54 | 55 | 56 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 57 | # If this step fails, then you should remove it and run the build manually (see below) 58 | - name: Autobuild 59 | uses: github/codeql-action/autobuild@v2 60 | 61 | # ℹ️ Command-line programs to run using the OS shell. 62 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun 63 | 64 | # If the Autobuild fails above, remove it and uncomment the following three lines. 65 | # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. 66 | 67 | # - run: | 68 | # echo "Run, Build Application using script" 69 | # ./location_of_script_within_repo/buildscript.sh 70 | 71 | - name: Perform CodeQL Analysis 72 | uses: github/codeql-action/analyze@v2 73 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .tmp 2 | .gitignore 3 | .idea 4 | *.pyc 5 | *__pycache__* 6 | /MANIFEST 7 | /build/ 8 | /deb_dist/ 9 | /dist/ 10 | *.egg-info/ 11 | venv/ 12 | main_app.spec 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Androidx86 Installer for Linux 2 | ![](banner.png) 3 | 4 | ``` 5 | Advanced and easy to use Advanced Android x86 installer for Linux. 6 | Developed with Python. 7 | ``` 8 | Check Releases for Installation : https://github.com/jaxparrow07/Androidx86-Installer-Linux/releases 9 | 10 | _NOTE : This project is being refactored for better maintenance_ 11 | 12 | ## Features 13 | * Guided User Interface 14 | * Supports installation on ext and other filesystems 15 | * Data image creation 16 | * Grub entry creation ( safely ) 17 | * Uninstallation script generation 18 | * Supports `config.ini` of ![AWIN Installer Dev](https://github.com/supremegamers/awin-installer-dev) ( Currently, **NAME** and **VERSION** metadata ) 19 | * Advanced logs to show detailed information 20 | * Allows you to install on `/home` ( Root home directory / partition ) 21 | 22 | 23 | ## Credits and Thanks 24 | * **@axonasif** for refactoring the whole project 25 | * [BlissOS](blissos.org) for promoting this project 26 | * Other members from SupremeGamers community who contibuted to this project 27 | 28 | ## Copyright and License 29 | 30 | This project is [GPL-2.0](https://github.com/jaxparrow07/Androidx86-Installer-Linux/blob/main/LICENSE) licensed. 31 | 32 | ``` 33 | Androidx86 Installer for Linux 34 | Copyright (C) 2022 SupremeGamers 35 | 36 | This program is free software; you can redistribute it and/or modify 37 | it under the terms of the GNU General Public License as published by 38 | the Free Software Foundation; version 2. 39 | 40 | This program is distributed in the hope that it will be useful, 41 | but WITHOUT ANY WARRANTY; without even the implied warranty of 42 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 43 | GNU General Public License for more details. 44 | 45 | You should have received a copy of the GNU General Public License 46 | along with this program; if not, write to the Free Software 47 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 48 | -------------------------------------------------------------------------------- /VERSION.txt: -------------------------------------------------------------------------------- 1 | app/VERSION.txt -------------------------------------------------------------------------------- /app/VERSION.txt: -------------------------------------------------------------------------------- 1 | 1.24 2 | -------------------------------------------------------------------------------- /app/__init__.py: -------------------------------------------------------------------------------- 1 | def __read_version_txt(): 2 | import pkgutil 3 | return pkgutil.get_data('app', 'VERSION.txt').decode('utf-8').strip() 4 | 5 | __version__ = __read_version_txt() 6 | -------------------------------------------------------------------------------- /app/main.py: -------------------------------------------------------------------------------- 1 | """Top-level implementation of the app program.""" 2 | 3 | from PyQt5.QtGui import * 4 | from PyQt5.QtWidgets import * 5 | from PyQt5.QtCore import * 6 | from subprocess import CalledProcessError, check_output 7 | from random import randint 8 | from shutil import which as sh_which 9 | import psutil 10 | import configparser 11 | import os 12 | import sys 13 | 14 | import app.utils as app_utils 15 | import app.resources as resources 16 | 17 | 18 | pyroot = os.path.dirname(os.path.dirname(__file__)) 19 | def fetchResource(res): 20 | return pyroot + '/' + res 21 | 22 | version_name = open(fetchResource("app/VERSION.txt"), "r").read() 23 | debug = False 24 | 25 | def clickable(widget): 26 | class Filter(QObject): 27 | clicked = pyqtSignal() 28 | def eventFilter(self, obj, event): 29 | 30 | if obj == widget: 31 | if event.type() == QEvent.MouseButtonRelease: 32 | if obj.rect().contains(event.pos()): 33 | self.clicked.emit() 34 | return True 35 | return False 36 | filter = Filter(widget) 37 | widget.installEventFilter(filter) 38 | return filter.clicked 39 | 40 | 41 | class DataWorker(QObject): 42 | 43 | finished = pyqtSignal() 44 | on_create_fail = pyqtSignal() 45 | on_verify_fail = pyqtSignal() 46 | 47 | def __init__(self,file,file_n,bs,count): 48 | super().__init__() 49 | self.file = file 50 | self.file_n = file_n 51 | self.bs = bs 52 | self.count = count 53 | self.Utils = app_utils.Utils(pyroot) 54 | 55 | 56 | def run(self): 57 | try: 58 | output = check_output( 59 | ["pkexec", "dd", "if=/dev/zero", self.file, 'bs=' + self.bs, 'count=0', 'seek=' + self.count] 60 | ) 61 | returncode = 0 62 | except CalledProcessError as e: 63 | output = e.output 64 | returncode = e.returncode 65 | 66 | if returncode != 0: 67 | self.on_create_fail.emit() 68 | return 69 | 70 | self.Utils.Log("task","Creating Superblocks for Data") 71 | 72 | try: 73 | output = check_output(["pkexec", "mkfs.ext4", self.file_n]) 74 | returncode = 0 75 | except CalledProcessError as e: 76 | output = e.output 77 | returncode = e.returncode 78 | 79 | if returncode != 0: 80 | self.on_verify_fail.emit() 81 | return 82 | 83 | self.finished.emit() 84 | 85 | class Grub_entry(QObject): 86 | 87 | grub_installed = pyqtSignal() 88 | grub_failed = pyqtSignal() 89 | finished = pyqtSignal() 90 | 91 | def __init__(self,name,isHome,uprocess): 92 | super().__init__() 93 | self.name = name 94 | self.isHome = isHome 95 | self.u_process = uprocess 96 | self.Utils = app_utils.Utils(pyroot) 97 | 98 | def run(self): 99 | 100 | ret_val = self.Utils.GenGrubEntry(self.name, self.isHome, str(self.u_process)) 101 | 102 | if ret_val: 103 | self.Utils.Log("ok","Created GRUB Entry") 104 | self.grub_installed.emit() 105 | 106 | else: 107 | self.grub_failed.emit() 108 | 109 | self.finished.emit() 110 | 111 | 112 | 113 | 114 | 115 | class Worker(QObject): 116 | 117 | finished = pyqtSignal() 118 | update_stats = pyqtSignal(int, str) 119 | update_prog = pyqtSignal(int) 120 | update_finish = pyqtSignal() 121 | 122 | 123 | def __init__(self,files,sessionid,destination): 124 | super().__init__() 125 | self.files = files 126 | self.sessionid = sessionid 127 | self.destin = destination 128 | self.Utils = app_utils.Utils(pyroot) 129 | 130 | 131 | def run(self): 132 | self.Utils.Log("info","Copying Files") 133 | for file in self.files: 134 | self.Utils.Log("task","Copying " + file) 135 | fsize = int(os.path.getsize(self.sessionid+'/'+file)) 136 | new = self.destin + file 137 | self.update_stats.emit(fsize,file) 138 | with open(self.sessionid+'/'+file, 'rb') as f: 139 | with open(new, 'ab') as n: 140 | buffer = bytearray() 141 | while True: 142 | buf = f.read(8192) 143 | n.write(buf) 144 | if len(buf) == 0: 145 | break 146 | buffer += buf 147 | # self.singlefileprog.setValue() 148 | self.update_prog.emit(len(buffer)) 149 | self.update_finish.emit() 150 | self.Utils.Log("ok","File Copying Finished") 151 | self.finished.emit() 152 | 153 | class Loader(QWidget): 154 | def __init__(self,text): 155 | super().__init__() 156 | self.setWindowFlag(Qt.WindowCloseButtonHint, False) 157 | self.widget = QWidget(self) 158 | layout = QVBoxLayout(self) 159 | 160 | helpheading = QLabel(text) 161 | pulse_prog = QProgressBar() 162 | pulse_prog.setRange(0,0) 163 | 164 | layout.addWidget(helpheading) 165 | layout.addWidget(pulse_prog) 166 | layout.setAlignment(Qt.AlignCenter) 167 | 168 | self.setLayout(layout) 169 | 170 | self.setWindowTitle('Please Wait') 171 | self.setGeometry(570, 190, 330, 330) 172 | self.setFixedWidth(330) 173 | self.setFixedHeight(120) 174 | 175 | #====== Help Window to Shot helptxt ========# 176 | class HelpWindow(QWidget): 177 | def __init__(self): 178 | super().__init__() 179 | self.widget = QWidget(self) 180 | 181 | layout = QVBoxLayout(self) 182 | 183 | self.scroll_tab1, self.scroll_tab2, self.scroll_tab3 = QScrollArea(), QScrollArea(), QScrollArea() 184 | 185 | for scroll_tab in [self.scroll_tab1, self.scroll_tab2, self.scroll_tab3]: 186 | scroll_tab.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) 187 | scroll_tab.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) 188 | scroll_tab.setFrameShape(QFrame.NoFrame) 189 | 190 | 191 | self.tabs = QTabWidget() 192 | 193 | self.tab1 = self.scroll_tab1 194 | self.tab2 = self.scroll_tab2 195 | self.tab3 = self.scroll_tab3 196 | 197 | self.tabs.resize(300, 130) 198 | 199 | self.tabs.addTab(self.tab1, "Basic") 200 | self.tabs.addTab(self.tab2, "Advanced") 201 | self.tabs.addTab(self.tab3, "Issues") 202 | 203 | # Section Init 204 | #self.tab1.layout.addWidget() 205 | 206 | #self.tab2.layout.addWidget() 207 | self.text1,self.text2, self.text3 = QLabel(resources.help_basic), QLabel(resources.help_advanced), QLabel(resources.help_issues) 208 | for text in [ self.text1,self.text2, self.text3 ]: 209 | text.setFixedWidth(280) 210 | text.setWordWrap(True) 211 | text.setOpenExternalLinks(True) 212 | 213 | self.scroll_tab1.setWidget(self.text1) 214 | self.scroll_tab2.setWidget(self.text2) 215 | self.scroll_tab3.setWidget(self.text3) 216 | 217 | close_box = QHBoxLayout() 218 | 219 | self.close_btn = QPushButton("Close") 220 | self.close_btn.clicked.connect(self.close) 221 | 222 | close_box.addWidget(self.close_btn) 223 | close_box.setAlignment(Qt.AlignRight) 224 | 225 | layout.addWidget(self.tabs) 226 | layout.addLayout(close_box) 227 | 228 | self.setLayout(layout) 229 | 230 | self.setWindowTitle('Help') 231 | self.setGeometry(570, 190, 330, 330) 232 | self.setFixedWidth(330) 233 | self.setFixedHeight(330) 234 | 235 | 236 | 237 | #====== About Window of Application ========# 238 | class AboutWindow(QWidget): 239 | def __init__(self): 240 | super().__init__() 241 | self.widget = QWidget(self) 242 | layout = QVBoxLayout(self) 243 | pixmap = QPixmap(fetchResource("img/mini_logo.png")) 244 | pixmap = pixmap.scaled(60, 60, Qt.KeepAspectRatio) 245 | Pixmap_label = QLabel() 246 | Pixmap_label.setPixmap(pixmap) 247 | Pixmap_label.setAlignment(Qt.AlignCenter) 248 | 249 | self.scroll_tab3 = QScrollArea() 250 | self.scroll_tab3.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) 251 | self.scroll_tab3.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) 252 | self.scroll_tab3.setFrameShape(QFrame.NoFrame) 253 | 254 | self.tabs = QTabWidget() 255 | self.tab1 = QWidget() 256 | self.tab2 = QWidget() 257 | self.tab3 = self.scroll_tab3 258 | self.tabs.resize(300, 130) 259 | 260 | self.tabs.addTab(self.tab1, "About") 261 | self.tabs.addTab(self.tab2, "Libraries") 262 | self.tabs.addTab(self.tab3, "Thanks To") 263 | 264 | self.tab1.layout = QVBoxLayout() 265 | self.tab2.layout = QVBoxLayout() 266 | 267 | self.main_about = QLabel(resources.about_s1) 268 | 269 | self.site_link = QLabel("https://supreme-gamers.com") 270 | self.site_link.setOpenExternalLinks(True) 271 | 272 | self.license_link = QLabel("License: GNU General Public License Version 2") 273 | self.license_link.setOpenExternalLinks(True) 274 | 275 | # Section Init 276 | self.tab1.layout.setAlignment(Qt.AlignTop) 277 | self.tab1.layout.addWidget(self.main_about) 278 | self.tab1.layout.addWidget(self.site_link) 279 | self.tab1.layout.addWidget(self.license_link) 280 | self.tab1.setLayout(self.tab1.layout) 281 | 282 | self.tab2.layout.setAlignment(Qt.AlignTop) 283 | self.tab2.layout.addWidget(QLabel(resources.about_libraries_used)) 284 | self.tab2.setLayout(self.tab2.layout) 285 | 286 | self.thanks_lbl = QLabel(resources.about_thanks_to) 287 | self.thanks_lbl.setFixedWidth(280) 288 | self.thanks_lbl.setWordWrap(True) 289 | 290 | #self.scrl_lt = QVBoxLayout() 291 | #self.scrl_lt.addWidget(self.thanks_lbl) 292 | 293 | self.scroll_tab3.setWidget(self.thanks_lbl) 294 | 295 | hbox = QHBoxLayout() 296 | hbox.addWidget(Pixmap_label) 297 | vbox = QVBoxLayout() 298 | 299 | heading = QLabel("Androidx86 Installer") 300 | heading.adjustSize() 301 | heading.setFixedWidth(330) 302 | heading.setFont(QFont('Arial', 13)) 303 | heading.setWordWrap(True) 304 | 305 | vbox.addWidget(heading) 306 | vbox.addWidget(QLabel(version_name)) 307 | 308 | hbox.addLayout(vbox) 309 | 310 | 311 | close_box = QHBoxLayout() 312 | 313 | self.close_btn = QPushButton("Close") 314 | self.close_btn.clicked.connect(self.close) 315 | 316 | close_box.addWidget(self.close_btn) 317 | close_box.setAlignment(Qt.AlignRight) 318 | 319 | layout.addLayout(hbox) 320 | layout.addWidget(self.tabs) 321 | layout.addLayout(close_box) 322 | 323 | self.setLayout(layout) 324 | self.setWindowTitle('About') 325 | self.setGeometry(570, 190, 330, 200) 326 | self.setFixedWidth(330) 327 | self.setFixedHeight(290) 328 | 329 | 330 | #====== Main Window ======# 331 | class Example(QMainWindow): 332 | 333 | def __init__(self, parent=None, frame=QFrame.Box): 334 | super().__init__() 335 | self.initUI() 336 | self.setAcceptDrops(True) 337 | self.Utils = app_utils.Utils(pyroot) 338 | 339 | def dragEnterEvent(self, event): 340 | if event.mimeData().hasUrls(): 341 | event.accept() 342 | else: 343 | event.ignore() 344 | 345 | def dropEvent(self, event): 346 | files = [u.toLocalFile() for u in event.mimeData().urls()] 347 | self.fileName = files[0] 348 | 349 | if '.iso' in self.fileName: 350 | self.Pixmap_label.setPixmap(self.iso_loaded) 351 | if self.fileName: 352 | self.Installbtn.setEnabled(True) 353 | self.Isonamevar = self.fileName 354 | 355 | if len(self.fileName) > 35: 356 | self.selectediso.setText('Iso : %s... (%0.2f GB)' % ( 357 | self.fileName[0:35], os.path.getsize(self.fileName) / 1024 / 1024 / 1024)) 358 | 359 | self.DropFile.setText('Iso : %s... (%0.2f GB)' % ( 360 | self.fileName[0:35], os.path.getsize(self.fileName) / 1024 / 1024 / 1024)) 361 | else: 362 | self.selectediso.setText('Iso : %s' % (self.fileName)) 363 | 364 | else: 365 | self.Installbtn.setEnabled(False) 366 | self.selectediso.setText('Iso : None') 367 | self.Isonamevar = 'None' 368 | 369 | def showdialog(self, txtmessage, additionalinfo, detailedtext): 370 | msg = QMessageBox() 371 | msg.setIcon(QMessageBox.Warning) 372 | msg.setText(txtmessage) 373 | msg.setInformativeText(additionalinfo) 374 | msg.setWindowTitle("Androidx86-Installer has Encountered an error") 375 | if detailedtext != "none": 376 | msg.setDetailedText("The details are as follows: \n"+detailedtext) 377 | msg.setStandardButtons(QMessageBox.Ok) 378 | msg.buttonClicked.connect(self.revertback) 379 | msg.exec_() 380 | 381 | def install_done(self, get_name): 382 | msg = QMessageBox() 383 | msg.setText(get_name+' has been installed Successfully') 384 | msg.setWindowTitle("Successfully Installed") 385 | msg.setStandardButtons(QMessageBox.Ok) 386 | msg.buttonClicked.connect(self.revertback) 387 | msg.exec_() 388 | 389 | def initUI(self): 390 | self.setAttribute(Qt.WA_DeleteOnClose, True) 391 | exitAct = QAction(QIcon(fetchResource('img/exit.png')), '&Exit', self) 392 | exitAct.setShortcut('Ctrl+Q') 393 | exitAct.setStatusTip('Exit application') 394 | exitAct.triggered.connect(qApp.quit) 395 | self.statusBar() 396 | 397 | selectiso = QAction(QIcon(fetchResource('img/iso.png')), '&Select iso', self) 398 | selectiso.setShortcut('Ctrl+F') 399 | selectiso.setStatusTip('Select iso file') 400 | selectiso.triggered.connect(self.openFileNameDialog) 401 | self.statusBar() 402 | 403 | AboutAct = QAction(QIcon(fetchResource('img/about.png')), '&About', self) 404 | AboutAct.setShortcut('Ctrl+A') 405 | AboutAct.setStatusTip('About application') 406 | AboutAct.triggered.connect(self.OpenAbout) 407 | self.statusBar() 408 | 409 | HelpAct = QAction(QIcon(fetchResource('img/help.png')), '&Help', self) 410 | HelpAct.setShortcut('Ctrl+H') 411 | HelpAct.setStatusTip('Help for application') 412 | HelpAct.triggered.connect(self.OpenHelp) 413 | self.statusBar() 414 | 415 | self.Isonamevar = 'None' 416 | self.isExtracting = True 417 | self.session_id = "" 418 | self.prevfile = "" 419 | self.isInstalled = False 420 | self.globname = "" 421 | self.globmdir = "" 422 | self.loadwin_vis = False 423 | self.hasGearlock = False 424 | self.grub_code = None 425 | 426 | ################## Menubar ############################# 427 | 428 | menubar = self.menuBar() 429 | 430 | # Adding Top Menus 431 | fileMenu = menubar.addMenu('&File') 432 | fileMenu.addAction(selectiso) 433 | fileMenu.addAction(exitAct) 434 | 435 | helpMenu = menubar.addMenu('&Help') 436 | helpMenu.addAction(HelpAct) 437 | helpMenu.addAction(AboutAct) 438 | 439 | ################## MainUI ############################# 440 | 441 | # Init Base Layout 442 | mlayout = QVBoxLayout() 443 | mlayout.setAlignment(Qt.AlignCenter) 444 | 445 | self.Toplayout = QVBoxLayout() 446 | self.Toplayout.setAlignment(Qt.AlignCenter) 447 | 448 | # Init Top Layout 449 | 450 | self.drop_here = QPixmap(fetchResource("img/drop_here.png")) 451 | self.drop_here = self.drop_here.scaled(70, 70, Qt.KeepAspectRatio) 452 | 453 | self.iso_here = QIcon.fromTheme("application-x-iso") 454 | 455 | 456 | self.iso_loaded = QPixmap(self.iso_here.pixmap(self.iso_here.actualSize(QSize(70, 70)))) 457 | self.iso_loaded = self.iso_loaded.scaled(70, 70, Qt.KeepAspectRatio) 458 | 459 | self.Pixmap_label = QLabel(self) 460 | self.Pixmap_label.setPixmap(self.drop_here) 461 | self.Pixmap_label.setAlignment(Qt.AlignCenter) 462 | 463 | clickable(self.Pixmap_label).connect(self.openFileNameDialog) 464 | 465 | self.DropFile = QLabel("Drop file here ( or Click the icon )") 466 | self.DropFile.setAlignment(Qt.AlignCenter) 467 | 468 | self.selectediso = QLabel('Iso : None') 469 | self.selectediso.setAlignment(Qt.AlignLeft) 470 | self.OSNAMEtxt = QLineEdit() 471 | self.OSVERtxt = QLineEdit() 472 | 473 | self.InstallationFS = QComboBox() 474 | self.InstallationFS.addItems(['Ext', 'OtherFS']) 475 | self.InstallationFS.currentIndexChanged.connect(self.changemethod) 476 | 477 | self.Datasize = QSlider() 478 | self.Datasize.setOrientation(Qt.Horizontal) 479 | self.Datasize.setValue(4) 480 | self.Datasize.setMaximum(32) 481 | self.Datasize.setMinimum(4) 482 | self.Datasize.valueChanged.connect(self.Datachange) 483 | self.Datasize.setVisible(False) 484 | 485 | self.Datasizetxt = QLabel('Data Image Size: %s GB' % ('4')) 486 | self.Datasizetxt.setVisible(False) 487 | 488 | self.Installationpart = QComboBox() 489 | 490 | getpart = os.popen( 491 | "grep '/dev/sd' '/proc/mounts' | awk '{print $1;}'").read() 492 | cpart = os.popen( 493 | "df -Th /home/ | head -n 2 | tail -n 1 | awk '{print $1;}'").read() 494 | root = os.popen( 495 | "df -Th / | head -n 2 | tail -n 1 | awk '{print $1;}'").read() 496 | 497 | if root != cpart: 498 | self.c_home = True 499 | getpart = getpart.replace(cpart, '').replace(root, '') 500 | else: 501 | self.c_home = False 502 | getpart = getpart.replace(root, '') 503 | 504 | self.Installationpart.addItem('Root Home Directory') 505 | for item in getpart.split(): 506 | self.Installationpart.addItem(item) 507 | 508 | self.singlefileprog = QProgressBar() 509 | self.singlefileprog.setValue(0) 510 | self.currentfilename = QLabel('Current File : None') 511 | self.currentfilename.setAlignment(Qt.AlignLeft) 512 | 513 | instspacelay = QVBoxLayout() 514 | instspacelay.setAlignment(Qt.AlignTop) 515 | 516 | self.instspace = QWidget() 517 | self.instspace.setLayout(instspacelay) 518 | self.instspace.setFixedHeight(160) 519 | 520 | self.Toplayout.addWidget(self.Pixmap_label) 521 | self.Toplayout.addWidget(self.DropFile) 522 | 523 | 524 | # Extra Options layout 525 | 526 | self.ExtraOptlayout = QVBoxLayout() 527 | self.ExtraOptlayout.setAlignment(Qt.AlignTop) 528 | self.ExtraOptlayout.addWidget(QLabel('Optional Configuration')) 529 | 530 | # Custom configurable widgets 531 | self.gen_unins_checkbox = QCheckBox("Generate Uninstallation Script") 532 | self.gen_unins_checkbox.setChecked(True) 533 | 534 | #self.gearlock_boot_installer = QCheckBox("Gearlock boot installer") 535 | 536 | self.ExtraOptlayout.addWidget(self.gen_unins_checkbox) 537 | #self.ExtraOptlayout.addWidget(self.gearlock_boot_installer) 538 | 539 | # Toggles visibility if gearlock boot installer isn't available 540 | #if (self.Utils.hasBootInstaller()): 541 | # self.gearlock_boot_installer.setVisible(True) 542 | 543 | self.ExtraOptlayout.addWidget(QLabel('GRUB Entry Options')) 544 | 545 | self.create_grub_entry = QCheckBox("Create GRUB Entry") 546 | self.create_grub_entry.setChecked(True) 547 | self.create_grub_entry.stateChanged.connect(self.Togglegrubsettings) 548 | 549 | self.grub_code_box = QPlainTextEdit(self) 550 | self.grub_code_box.setReadOnly(True) 551 | self.grub_code_box.setVisible(False) 552 | 553 | self.copy_grub_button = QPushButton("Copy GRUB Entry") 554 | self.copy_grub_button.clicked.connect(self.grub_copy) 555 | 556 | self.ExtraOptlayout.addWidget(self.create_grub_entry) 557 | self.ExtraOptlayout.addWidget(self.grub_code_box) 558 | self.ExtraOptlayout.addWidget(self.copy_grub_button) 559 | 560 | 561 | self.grub_settings = QVBoxLayout() 562 | 563 | # Custom grub settings 564 | #self.grubset_use_submenu = QCheckBox("Use Submenu") 565 | #self.grubset_add_glock = QCheckBox("Gearlock Recovery Modes") 566 | #self.grubset_useicon = QCheckBox("Use Icon in entries") 567 | 568 | 569 | #self.grub_settings.addWidget(self.grubset_use_submenu) 570 | #self.grub_settings.addWidget(self.grubset_add_glock) 571 | #self.grub_settings.addWidget(self.grubset_useicon) 572 | 573 | self.grub_settings_wid = QWidget() 574 | self.grub_settings_wid.setLayout(self.grub_settings) 575 | 576 | self.ExtraOptlayout.addWidget(self.grub_settings_wid) 577 | 578 | 579 | self.ExtraOptframe = QFrame() 580 | self.ExtraOptframe.setLayout(self.ExtraOptlayout) 581 | self.ExtraOptframe.setFrameShadow(QFrame.Raised) 582 | self.ExtraOptframe.setFrameShape(QFrame.StyledPanel) 583 | self.ExtraOptframe.setVisible(False) 584 | self.ExtraOptframe.setFixedHeight(370) 585 | 586 | self.Installinglayout = QVBoxLayout() 587 | self.Installinglayout.setAlignment(Qt.AlignTop) 588 | self.Installinglayout.addWidget(QLabel('OS Name:')) 589 | self.Installinglayout.addWidget(self.OSNAMEtxt) 590 | self.Installinglayout.addWidget(QLabel('OS Version:')) 591 | self.Installinglayout.addWidget(self.OSVERtxt) 592 | 593 | self.Installinglayout.addWidget(QLabel('Filesystem Type:')) 594 | self.Installinglayout.addWidget(self.InstallationFS) 595 | self.Installinglayout.addWidget(self.Datasizetxt) 596 | self.Installinglayout.addWidget(self.Datasize) 597 | self.Installinglayout.addWidget(QLabel('Installation Partition:')) 598 | self.Installinglayout.addWidget(self.Installationpart) 599 | 600 | self.Installinglayout.addWidget(self.instspace) 601 | self.Installinglayout.addWidget(self.currentfilename) 602 | self.Installinglayout.addWidget(self.singlefileprog) 603 | 604 | self.Installingframe = QFrame() 605 | self.Installingframe.setLayout(self.Installinglayout) 606 | self.Installingframe.setFrameShadow(QFrame.Raised) 607 | self.Installingframe.setFrameShape(QFrame.StyledPanel) 608 | self.Installingframe.setVisible(False) 609 | self.Installingframe.setFixedHeight(370) 610 | 611 | Bottomlayout = QVBoxLayout() 612 | Bottomlayout.setAlignment(Qt.AlignCenter) 613 | Bottomlayout.addWidget(QPushButton('Bottom')) 614 | 615 | Bottommenu = QHBoxLayout() 616 | Bottommenu.setAlignment(Qt.AlignVCenter) 617 | 618 | self.installprog = QProgressBar() 619 | self.installprog.setValue(0) 620 | 621 | # Init Bottom Toolbar 622 | self.Installbtn = QPushButton('Next') 623 | self.closebtn = QPushButton('Close') 624 | self.closebtn.clicked.connect(self.func_quit_all_windows) 625 | self.Installbtn.setEnabled(False) 626 | self.Installbtn.clicked.connect(self.Extracting) 627 | self.OSVERtxt.textChanged.connect(self.input_fields_check) 628 | self.OSNAMEtxt.textChanged.connect(self.input_fields_check) 629 | 630 | Bottommenu.addWidget(QLabel(' ')) 631 | Bottommenu.addWidget(self.Installbtn) 632 | Bottommenu.addWidget(self.closebtn) 633 | 634 | self.Bmenuwid = QWidget() 635 | self.Bmenuwid.setLayout(Bottommenu) 636 | self.Bmenuwid.setFixedHeight(60) 637 | 638 | self.rightFrame = QFrame() 639 | self.rightFrame.setFrameShape(QFrame.StyledPanel) 640 | self.rightFrame.setFrameShadow(QFrame.Raised) 641 | self.rightFrame.setLayout(self.Toplayout) 642 | self.rightFrame.setFixedHeight(370) 643 | 644 | # Adding created widgets 645 | mlayout.addWidget(self.rightFrame) 646 | mlayout.addWidget(self.Installingframe) 647 | mlayout.addWidget(self.ExtraOptframe) 648 | mlayout.addWidget(self.installprog) 649 | mlayout.addWidget(self.Bmenuwid) 650 | 651 | 652 | 653 | Mainwidget = QWidget() 654 | Mainwidget.setLayout(mlayout) 655 | self.setCentralWidget(Mainwidget) 656 | 657 | ################### Properties ############################ 658 | 659 | self.setGeometry(550, 100, 370, 540) 660 | self.setFixedWidth(370) 661 | self.setFixedHeight(540) 662 | self.setWindowTitle('Androidx86 Installer') 663 | pixmap = QPixmap(fetchResource('img/mini_logo.png')) 664 | # pixmap = pixmap.scaled(20, 20, Qt.KeepAspectRatio) 665 | icon = QIcon(pixmap) 666 | self.setWindowIcon(icon) 667 | self.show() 668 | 669 | def changemethod(self): 670 | if self.InstallationFS.itemText(self.InstallationFS.currentIndex()) == 'Ext': 671 | self.Datasize.setVisible(False) 672 | self.instspace.setFixedHeight(120) 673 | self.Datasizetxt.setVisible(False) 674 | else: 675 | self.Datasize.setVisible(True) 676 | self.instspace.setFixedHeight(0) 677 | self.Datasizetxt.setVisible(True) 678 | 679 | def revertback(self): 680 | self.Utils.Log("info","Reverting back to default") 681 | self.prevfile = self.fileName 682 | self.prevsessionid = self.session_id 683 | self.session_id = "" 684 | self.rightFrame.setVisible(True) 685 | self.ExtraOptframe.setVisible(False) 686 | self.Installingframe.setVisible(False) 687 | self.Isonamevar = 'None' 688 | self.isExtracting = True 689 | self.installprog.setValue(0) 690 | self.currentfilename.setText('Current file : None') 691 | self.singlefileprog.setValue(0) 692 | self.setAcceptDrops(True) 693 | self.DropFile.setText("Drop file here ( or Click the icon )") 694 | self.Pixmap_label.setPixmap(self.drop_here) 695 | self.Installbtn.setEnabled(False) 696 | self.isInstalled = False 697 | self.OSNAMEtxt.setText("") 698 | self.OSVERtxt.setText("") 699 | self.loadwin_vis = False 700 | self.gen_unins_checkbox.setChecked(True) 701 | self.create_grub_entry.setChecked(True) 702 | 703 | 704 | def input_fields_check(self): 705 | if not self.isExtracting: 706 | if self.OSNAMEtxt.text() == "": 707 | self.Installbtn.setEnabled(False) 708 | elif self.OSVERtxt.text() == "": 709 | self.Installbtn.setEnabled(False) 710 | else: 711 | self.Installbtn.setEnabled(True) 712 | 713 | def Datachange(self): 714 | self.Datasizetxt.setText('Data Image Size: %i GB' % 715 | (self.Datasize.value())) 716 | 717 | def Extracting(self): 718 | if self.isExtracting == True: 719 | 720 | self.setAcceptDrops(False) 721 | 722 | self.session_id = '/tmp/'+'ax86_mount' 723 | self.Bmenuwid.setEnabled(False) 724 | 725 | if os.path.isdir(self.session_id): 726 | try: 727 | output = check_output(["pkexec", "umount", self.session_id]) 728 | returncode = 0 729 | except CalledProcessError as e: 730 | output = e.output 731 | returncode = e.returncode 732 | return 733 | 734 | else: 735 | os.mkdir(self.session_id) 736 | 737 | try: 738 | self.Utils.Log("task", "Mounting iso - " + self.Isonamevar) 739 | output = check_output(["pkexec", "mount", "--options","loop",self.Isonamevar,self.session_id]) 740 | returncode = 0 741 | except CalledProcessError as e: 742 | output = e.output 743 | returncode = e.returncode 744 | 745 | if returncode != 0: 746 | self.Utils.Log("error", "Mounting failed") 747 | self.showdialog( 748 | 'Error', 'Iso Mounting Failed due to unknown reason', 'none') 749 | return 750 | 751 | self.Utils.Log("ok","Mounted iso") 752 | 753 | if os.path.isfile(self.session_id+'/windows/config.ini'): 754 | 755 | self.Utils.Log("info", "Found Installer Config") 756 | 757 | config = configparser.ConfigParser() 758 | config.read(self.session_id + '/windows/config.ini') 759 | MetaOSName = config.get('META-DATA', 'NAME') 760 | MetaOSVer = config.get('META-DATA', 'VERSION') 761 | 762 | if MetaOSName[0] == '"': 763 | self.OSNAMEtxt.setText(MetaOSName[1:len(MetaOSName)-1]) 764 | else: 765 | self.OSNAMEtxt.setText(MetaOSName) 766 | 767 | if MetaOSVer[0] == '"': 768 | self.OSVERtxt.setText(MetaOSVer[1:len(MetaOSVer)-1]) 769 | else: 770 | self.OSVERtxt.setText(MetaOSVer) 771 | 772 | else: 773 | self.Installbtn.setEnabled(False) 774 | 775 | self.Bmenuwid.setEnabled(True) 776 | self.rightFrame.setVisible(False) 777 | self.Installingframe.setVisible(True) 778 | self.isExtracting = False 779 | 780 | 781 | elif self.isInstalled: 782 | if not self.ExtraOptframe.isVisible(): 783 | self.ExtraOptions() 784 | else: 785 | self.extra_opt() 786 | 787 | elif debug: 788 | print("Debug") 789 | self.globhome = True 790 | self.isInstalled = True 791 | self.globname = "Debug_1.0" 792 | self.Extracting() 793 | 794 | else: 795 | self.Bmenuwid.setEnabled(False) 796 | 797 | files = ['initrd.img','kernel', 'install.img', 'system.sfs'] 798 | 799 | for nes_file in files: 800 | if not os.path.isfile(self.session_id+'/'+nes_file): 801 | self.Utils.Log("error", "Unsupported Iso - file missing") 802 | self.showdialog('Invalid Iso', 803 | 'Important file missing', detailedtext=""" 804 | Missing file : %s""" % (nes_file)) 805 | return 806 | 807 | optional_files = ['gearlock','ramdisk.img'] 808 | for opt_file in optional_files: 809 | if os.path.isfile(self.session_id+'/'+opt_file): 810 | files.append(opt_file) 811 | 812 | self.to_increase = 100 / len(files) 813 | 814 | partition = self.Installationpart.itemText( 815 | self.Installationpart.currentIndex()) 816 | 817 | 818 | OS_NAME = self.OSNAMEtxt.text() + '-' + self.OSVERtxt.text() 819 | OS_NAME.replace(' ', '_') 820 | self.globname = OS_NAME 821 | 822 | # os.system('app/bin/unmounter ' + partition) 823 | 824 | if partition == 'Root Home Directory': 825 | home = True 826 | else: 827 | home = False 828 | self.mount_point = os.popen("lsblk -o MOUNTPOINT -n " + partition).read() 829 | self.mount_point = self.mount_point[:-1] + '/' 830 | 831 | self.globhome = home 832 | 833 | # os.system('app/bin/mounter ' + partition) 834 | 835 | if not home: 836 | hdd = psutil.disk_usage(self.mount_point) 837 | else: 838 | hdd = psutil.disk_usage('/home/') 839 | filesize = os.path.getsize(self.Isonamevar) 840 | 841 | if hdd.free < filesize: 842 | self.Utils.Log("error","File Copy Failed - insufficient space in " + 843 | self.Installationpart.itemText(self.Installationpart.currentIndex)) 844 | self.showdialog('Error when copying files', 'Not Enough Space on the specified partition', detailedtext=""" 845 | Space required for installation : %d MB 846 | Space Available on %s : %d MB 847 | 848 | Free up some space and retry again.""" % (filesize / 1024 / 1024, self.Installationpart.itemText(self.Installationpart.currentIndex), hdd.free / 1024 / 1024)) 849 | return 850 | 851 | if not home: 852 | if not os.path.isdir(self.mount_point+OS_NAME+'/'): 853 | os.mkdir(self.mount_point+OS_NAME) 854 | self.DESTINATION = self.mount_point + OS_NAME + '/' 855 | else: 856 | self.showdialog('Folder Already Exists', 'Folder Creation Failed', detailedtext=""" 857 | The installation folder %s in %s already exists. 858 | Please rename the folder or use other name in the Os name and Version field""" % (OS_NAME, partition)) 859 | return 860 | 861 | else: 862 | 863 | self.DESTINATION = '/home/' + OS_NAME + '/' 864 | dirname = '/home/' + OS_NAME 865 | 866 | self.Utils.Log("task", "Creating Folder (directory) - " + dirname) 867 | 868 | if not os.path.isdir(dirname): 869 | try: 870 | output = check_output(["pkexec", "mkdir", dirname]) 871 | returncode = 0 872 | except CalledProcessError as e: 873 | output = e.output 874 | returncode = e.returncode 875 | 876 | if returncode != 0: 877 | self.Utils.Log("error","Folder Creation Failed - aborted by user") 878 | self.showdialog( 879 | 'Cannot Create Folder', 'Folder Creation cancelled by user', 'none') 880 | return 881 | else: 882 | self.Utils.Log("error", "Folder Creation Failed - already exists") 883 | self.showdialog('Folder Already Exists', 'Folder Creation Failed', detailedtext=""" 884 | The installation folder %s already exists. 885 | Please rename the folder or use other name in the Os name and Version field""" % (dirname)) 886 | return 887 | 888 | self.Utils.Log("task", "Owning FOlder ( directory ) - " + dirname) 889 | try: 890 | output = check_output(["pkexec", "chmod", "777", dirname]) 891 | returncode = 0 892 | except CalledProcessError as e: 893 | output = e.output 894 | returncode = e.returncode 895 | 896 | if returncode != 0: 897 | self.Utils.Log("error","Owning Failed - aborted by user") 898 | self.showdialog('Cannot Own Folder', 899 | 'Chmod cancelled by user', 'none') 900 | return 901 | 902 | # Disabling the configuration to avoid errors / changes in installation caused by changes in fields 903 | self.toggle_config(False) 904 | self.thread = QThread() 905 | 906 | self.worker = Worker(files,self.session_id,self.DESTINATION) 907 | self.worker.moveToThread(self.thread) 908 | 909 | self.thread.started.connect(self.worker.run) 910 | 911 | self.worker.finished.connect(self.thread.quit) 912 | self.worker.finished.connect(self.worker.deleteLater) 913 | self.thread.finished.connect(self.thread.deleteLater) 914 | 915 | self.worker.finished.connect(self.thread_finish) 916 | self.worker.update_prog.connect(self.thread_progress) 917 | self.worker.update_finish.connect(self.thread_mainprog) 918 | self.worker.update_stats.connect(self.thread_update) 919 | self.thread.start() 920 | 921 | 922 | # Thread Callbacks 923 | def thread_progress(self,int): 924 | self.singlefileprog.setValue(int) 925 | 926 | def thread_update(self,fsize,file): 927 | self.singlefileprog.setValue(0) 928 | self.currentfilename.setText('Current file : %s' % (file)) 929 | self.singlefileprog.setMaximum(fsize) 930 | 931 | def thread_mainprog(self): 932 | self.installprog.setValue( 933 | self.installprog.value() + int(self.to_increase)) 934 | 935 | def thread_finish(self): 936 | if self.installprog.value() != 100: 937 | self.installprog.setValue(100) 938 | self.postInstall() 939 | 940 | def toggle_config(self,state): 941 | self.OSNAMEtxt.setEnabled(state) 942 | self.OSVERtxt.setEnabled(state) 943 | self.InstallationFS.setEnabled(state) 944 | self.Installationpart.setEnabled(state) 945 | self.Datasize.setEnabled(state) 946 | 947 | def postInstall(self): 948 | if self.InstallationFS.itemText(self.InstallationFS.currentIndex()) == 'Ext': 949 | self.data_create = False 950 | 951 | if not self.globhome: 952 | os.mkdir(self.mount_point + self.globname + '/data') 953 | # os.system('touch '+ self.mount_point + self.globname + '/findme') 954 | output = check_output( 955 | ["touch",self.mount_point + self.globname + '/findme' ] 956 | ) 957 | else: 958 | self.DESTINATION = '/home/' + self.globname 959 | os.mkdir(self.DESTINATION + '/data') 960 | # os.system('touch ' + DESTINATION + '/findme') 961 | output = check_output( 962 | ["touch",self.DESTINATION+'/findme' ] 963 | ) 964 | else: 965 | self.data_create = True 966 | if not self.globhome: 967 | file = 'of='+ self.mount_point + self.globname + '/data.img' 968 | file_n = self.mount_point + self.globname + '/data.img' 969 | 970 | output = check_output( 971 | ["touch",self.mount_point + self.globname + '/findme' ] 972 | ) 973 | 974 | hdd = psutil.disk_usage(self.mount_point) 975 | 976 | else: 977 | file = 'of=/home/' + self.globname + '/data.img' 978 | file_n = '/home/' + self.globname + '/data.img' 979 | self.DESTINATION = '/home/' + self.globname 980 | 981 | output = check_output( 982 | ["touch",self.DESTINATION+'/findme'] 983 | ) 984 | 985 | hdd = psutil.disk_usage('/home/') 986 | 987 | bs = "1048576" 988 | bytes_dat = int(self.Datasize.value()) * 1024 * 1024 * 1024 989 | count = int(self.Datasize.value()) * 1024 990 | 991 | self.Utils.Log("task", "Creating data.img of " + str(bytes_dat) + " bytes") 992 | 993 | if hdd.free < bytes_dat: 994 | self.Utils.Log("error", "Data Creation failed - insufficient space") 995 | self.showdialog('Cannot Create data.img', 'Insufficient Space', detailedtext=""" 996 | Space required for Data.img : %d GB 997 | Space Available : %0.2f GB""" % (self.Datasize.value(), hdd.free / 1024 / 1024 / 1024)) 998 | return 999 | else: 1000 | msg = QMessageBox() 1001 | msg.setWindowTitle("Info") 1002 | msg.setText( 1003 | "Please Wait until it creates Data img... Ok to Proceed") 1004 | msg.setFixedWidth(250) 1005 | msg.setFixedHeight(100) 1006 | x = msg.exec_() # this will show our messagebox 1007 | 1008 | self.datathread = QThread() 1009 | 1010 | self.dataworker = DataWorker(file,file_n,bs,str(count)) 1011 | self.dataworker.moveToThread(self.datathread) 1012 | 1013 | self.datathread.started.connect(self.dataworker.run) 1014 | 1015 | self.dataworker.finished.connect(self.datathread.quit) 1016 | self.dataworker.finished.connect(self.dataworker.deleteLater) 1017 | 1018 | self.datathread.finished.connect(self.datathread.deleteLater) 1019 | 1020 | self.dataworker.finished.connect(self.data_create_finish) 1021 | self.dataworker.on_create_fail.connect(self.data_create_fail) 1022 | self.dataworker.on_verify_fail.connect(self.data_verify_fail) 1023 | 1024 | self.datathread.start() 1025 | 1026 | # Will continue installtion if data image is not created otherwise it will wait for callback 1027 | if not self.data_create: 1028 | self.show_notifier("Info","You can close the installer now or head to next step") 1029 | self.Utils.Log("info", "Necessary Steps Completed") 1030 | self.toggle_config(True) 1031 | self.isInstalled = True 1032 | self.Bmenuwid.setEnabled(True) 1033 | 1034 | def show_notifier(self,title,message): 1035 | msg = QMessageBox() 1036 | msg.setWindowTitle(title) 1037 | msg.setText(message) 1038 | msg.setFixedWidth(250) 1039 | msg.setFixedHeight(100) 1040 | x = msg.exec_() # this will show our messagebox 1041 | 1042 | def data_create_finish(self): 1043 | msg = QMessageBox() 1044 | msg.setWindowTitle("Info") 1045 | msg.setText( 1046 | "You can close the installer now or head to next step") 1047 | msg.setFixedWidth(250) 1048 | msg.setFixedHeight(100) 1049 | x = msg.exec_() # this will show our messagebox 1050 | 1051 | self.toggle_config(True) 1052 | self.isInstalled = True 1053 | self.Bmenuwid.setEnabled(True) 1054 | 1055 | def data_create_fail(self): 1056 | self.Utils.Log("error", "Data Image Creation Failed") 1057 | self.showdialog('Cannot Create data.img', 1058 | 'Data Image creation Failed', 'none') 1059 | return 1060 | 1061 | def data_verify_fail(self): 1062 | self.Utils.Log("error", "Data Image Verification Failed") 1063 | self.showdialog( 1064 | 'Cannot Create data.img', 'Data Image creation Failed on Verification', 'none') 1065 | return 1066 | 1067 | 1068 | def Generate_Uninstall(self): 1069 | 1070 | if (self.gen_unins_checkbox.isChecked()): 1071 | print(self.DESTINATION) 1072 | ret = self.Utils.GenerateUnins(self.globname,self.session_id,self.DESTINATION) 1073 | if ret: 1074 | self.Utils.Log("ok", "Generated Uninstallation Script") 1075 | else: 1076 | self.Utils.Log("warning","Failed Generating Uninstallation Script") 1077 | 1078 | self.Finish_Install() 1079 | 1080 | def grub_install_failed(self): 1081 | self.loadwin.close() 1082 | self.show_notifier("Info", "Error: Unable to create GRUB entry") 1083 | self.loadwin_vis = False 1084 | self.Utils.Log("warning","Unable to Create GRUB Entry") 1085 | self.Utils.Log("info", "Skipping GRUB Entry creation") 1086 | 1087 | def extra_opt(self): 1088 | 1089 | self.u_process = randint(10000,999999) 1090 | 1091 | if (self.create_grub_entry.isChecked()): 1092 | 1093 | self.loadwin_vis = True 1094 | self.loadwin = Loader("Adding GRUB Entry") 1095 | self.loadwin.setParent(self, Qt.Window) 1096 | self.Show_loader() 1097 | 1098 | self.grubthread = QThread() 1099 | 1100 | self.grubworker = Grub_entry(self.globname, self.globhome, str(self.u_process)) 1101 | self.grubworker.moveToThread(self.grubthread) 1102 | 1103 | self.grubthread.started.connect(self.grubworker.run) 1104 | 1105 | self.grubworker.finished.connect(self.grubthread.quit) 1106 | self.grubworker.finished.connect(self.grubworker.deleteLater) 1107 | 1108 | self.grubthread.finished.connect(self.grubthread.deleteLater) 1109 | 1110 | self.grubworker.finished.connect(self.Generate_Uninstall) 1111 | self.grubworker.grub_installed.connect(self.loadwin.close) 1112 | self.grubworker.grub_failed.connect(self.grub_install_failed) 1113 | 1114 | self.grubthread.start() 1115 | 1116 | else: 1117 | self.Generate_Uninstall() 1118 | 1119 | def grub_copy(self): 1120 | 1121 | if self.grub_code != None: 1122 | cb = QApplication.clipboard() 1123 | cb.clear(mode=cb.Clipboard) 1124 | cb.setText(self.grub_code, mode=cb.Clipboard) 1125 | self.Utils.Log("info", "Copied GRUB Entry") 1126 | 1127 | def closeEvent(self, event): 1128 | if self.loadwin_vis: 1129 | self.loadwin.close() 1130 | event.accept() 1131 | 1132 | def Finish_Install(self): 1133 | self.Utils.Log("ok", "Successfully Installed - " + self.globname) 1134 | self.install_done(self.globname) 1135 | 1136 | def ExtraOptions(self): 1137 | 1138 | self.Installingframe.setVisible(False) 1139 | self.ExtraOptframe.setVisible(True) 1140 | 1141 | self.grub_code = self.Utils.getGrubCode(self.globname, self.globhome) 1142 | 1143 | if not self.Utils.isGrubEntrySafe(): 1144 | self.grub_code_box.setVisible(True) 1145 | self.grub_code_box.setPlainText(self.grub_code) 1146 | self.create_grub_entry.setChecked(False) 1147 | self.create_grub_entry.setDisabled(True) 1148 | self.Utils.Log("warning","GRUB Entry Creation Disabled - Found grub-customizer or update-grub not found") 1149 | self.show_notifier("Warning", "Disabled GRUB Entry as it may break your system ( unsupported system or state )") 1150 | 1151 | 1152 | 1153 | def openFileNameDialog(self): 1154 | options = QFileDialog.Options() 1155 | options |= QFileDialog.DontUseNativeDialog 1156 | self.fileName, _ = QFileDialog.getOpenFileName(self, "Select an Android image", "", 1157 | "Android Image Files (*.iso)", options=options) 1158 | 1159 | if self.fileName: 1160 | self.Pixmap_label.setPixmap(self.iso_loaded) 1161 | self.Installbtn.setEnabled(True) 1162 | self.Isonamevar = self.fileName 1163 | if len(self.fileName) > 35: 1164 | self.selectediso.setText('Iso : %s... (%0.2f GB)' % ( 1165 | self.fileName[0:35], os.path.getsize(self.fileName) / 1024 / 1024 / 1024)) 1166 | self.DropFile.setText('Iso : %s... (%0.2f GB)' % ( 1167 | self.fileName[0:35], os.path.getsize(self.fileName) / 1024 / 1024 / 1024)) 1168 | else: 1169 | self.selectediso.setText('Iso : %s' % (self.fileName)) 1170 | 1171 | elif self.DropFile.isVisible(): 1172 | pass 1173 | else: 1174 | self.Installbtn.setEnabled(False) 1175 | self.selectediso.setText('Iso : None') 1176 | self.Isonamevar = 'None' 1177 | 1178 | def Togglegrubsettings(self): 1179 | if self.create_grub_entry.isChecked(): 1180 | self.grub_settings_wid.setEnabled(True) 1181 | else: 1182 | self.grub_settings_wid.setEnabled(False) 1183 | 1184 | 1185 | def Show_loader(self): 1186 | self.loadwin.show() 1187 | 1188 | def OpenAbout(self): 1189 | self.abtwin = AboutWindow() 1190 | self.abtwin.setParent(self, Qt.Window) 1191 | self.abtwin.show() 1192 | 1193 | def OpenHelp(self): 1194 | self.hlpwin = HelpWindow() 1195 | self.hlpwin.setParent(self, Qt.Window) 1196 | self.hlpwin.show() 1197 | 1198 | def func_quit_all_windows(self): 1199 | if self.loadwin_vis: 1200 | self.loadwin.close() 1201 | sys.exit() 1202 | 1203 | 1204 | def main(): 1205 | 1206 | if sh_which('pkexec') == None: 1207 | print("pkexec: Not Found") 1208 | exit(1) 1209 | 1210 | app = QApplication(sys.argv) 1211 | ex = Example() 1212 | sys.exit(app.exec_()) 1213 | 1214 | 1215 | if __name__ == '__main__': 1216 | main() 1217 | -------------------------------------------------------------------------------- /app/resources.py: -------------------------------------------------------------------------------- 1 | """Module to get big strings""" 2 | 3 | """UI""" 4 | 5 | help_basic = """ 6 |
7 |

Basic

8 |
9 |
10 |

Selecting files

11 | You can select android images (iso) by either dragging and dropping them onto the desired place or selecting from File > Select Iso 12 | 13 |

OS Name and Version

14 | Allows you to create multiple installtions of the same android image 15 | 16 |

Installation Types

17 | This installer supports Ext ( data folder ) installation and Other filesystems ( data.img upto 32 GB ) 18 | 19 |

Finding Partition Name

20 |
    21 |
  • Open your desired partition on a file manager
  • 22 |
  • Open terminal by Ctrl+Shift+F4 or Right click > Open Terminal here ( or use the terminal below if available )
  • 23 |
  • Then execute df -Th . on the terminal to see the partition name ( sda2 etc.,. )
  • 24 |
25 | 26 |

Uninstallation Script

27 | Uninstallation script allows you to uninstall the android installation files ( grub entry if added ) easily and safely. 28 | """ 29 | 30 | help_advanced = """ 31 |
32 |

Advanced

33 |
34 |
35 |

Grub Entry

36 | Grub entry will be enabled if the system supports it and there's no installation of Grub Customizer ( grub-customizer ). Else, it'll only show the option to copy the Grub entry code. 37 | 38 |

Adding Grub Entry

39 | If you know how to add Grub entries manually by grub.cfg or other workarounds, you can paste the code. Or you can simply use Grub Customizer to add the entry and save it. 40 | 41 | """ 42 | 43 | help_issues = """ 44 |
45 |

Issues

46 |
47 |
48 | If you've found any issues within the installer or if you can't install a specific android image.
Please report by opening an issue : 49 | https://github.com/jaxparrow07/Androidx86-Installer-Linux/issues 50 | """ 51 | 52 | about_thanks_to = """ 53 | AXON
54 | For helping in refactoring the project and fixing a lot of code.
55 |
56 | Team Bliss
57 | For supporting the project by promoting it.
58 |
59 | Manky201 and Xtr ( Xttt )
60 | For giving suggestions and ideas in Mounting and Image creation.
61 | """ 62 | 63 | about_libraries_used = """Python modules: 64 | 65 | • PyQt5 66 | • subprocess 67 | • configparser 68 | • psutil 69 | 70 | Uses some linux binaries too 71 | """ 72 | 73 | about_s1 = """Androidx86 Installer for Linux 74 | 75 | (c) 2021, SupremeGamers 76 | 77 | """ 78 | 79 | ################################################################################ 80 | 81 | """Functional""" 82 | 83 | custom_basic = """#!/bin/sh 84 | exec tail -n +3 $0 85 | 86 | # This file provides an easy way to add custom menu entries. Simply type the 87 | # menu entries you want to add after this comment. Be careful not to change 88 | # the exec tail line above.insmod all_video 89 | """ 90 | 91 | custom_template = """ 92 | 93 | menuentry '{osname}' {{ # {pid} - ax86-installer 94 | insmod all_video # {pid} - ax86-installer 95 | search --set=root --file /{name}/findme # {pid} - ax86-installer 96 | linux /{name}/kernel root=/dev/ram0 acpi_osi=Linux mitigations=off androidboot.hardware=android_x86_64 androidboot.selinux=permissive SRC=/{osname}/ # {pid} - ax86-installer 97 | initrd /{name}/initrd.img # {pid} - ax86-installer 98 | }} # {pid} - ax86-installer 99 | """ 100 | 101 | custom_entry = """insmod all_video 102 | search --set=root --file /{name}/findme 103 | linux /{name}/kernel root=/dev/ram0 acpi_osi=Linux mitigations=off androidboot.hardware=android_x86_64 androidboot.selinux=permissive SRC=/{osname}/ 104 | initrd /{name}/initrd.img""" 105 | 106 | uninstallation_script = """ 107 | #!/usr/bin/bash 108 | 109 | # Script Generated by Androidx86Installer 110 | # It is recommended to delete this file if you have no idea where this ( uninstall.sh ) file came from 111 | # Auto uninstall script 112 | 113 | grubconfig="/etc/grub.d/40_custom" 114 | script_path="$(realpath $0)" 115 | script_path=$(dirname "$script_path") 116 | if [[ -f "$script_path/findme" ]] || [[ -f "$script_path/initrd.img" ]] || [[ -f "$script_path/ramdisk.img" ]] || [[ -f "$script_path/system.sfs" ]] || [[ -f "$script_path/system.img" ]];then 117 | if [[ `whoami` != 'root' ]];then 118 | echo 'Run as root to Uninstall' 119 | else 120 | echo 'Uninstalling : {osname} ' 121 | if [[ -f "$grubconfig" ]];then 122 | read -p "Do you want to remove GRUB Entry ( if added ) [ y/N ] :" g_in 123 | if [[ $g_in == "y" ]] || [[ $g_in == "y" ]];then 124 | echo 'Removing GRUB Entry' 125 | grep -v '# {pid} - ax86-installer' "$grubconfig" > tmpfile && mv tmpfile "$grubconfig" 126 | update-grub 127 | fi 128 | fi 129 | echo 'Removing Files' 130 | if [[ -d "$script_path/data" ]];then 131 | chattr -R -i "$script_path/data" 132 | fi 133 | rm "$script_path" -r 134 | echo 'Successfully Uninstalled {osname}' 135 | exit 0 136 | fi 137 | else 138 | echo "Executing this from a non-android directory is dangerous" 139 | echo "It is recommended to delete this file if you have no idea where this ( uninstall.sh ) file came from" 140 | exit 1 141 | fi 142 | """ -------------------------------------------------------------------------------- /app/utils.py: -------------------------------------------------------------------------------- 1 | import os 2 | import app.resources as resources 3 | from shutil import which as sh_which 4 | from datetime import datetime 5 | 6 | class Utils(): 7 | def __init__(self, current_dir): 8 | super().__init__() 9 | self.cwd = current_dir 10 | self.custom_40 = "/etc/grub.d/40_custom" 11 | self.log_prefix = {"warning":"WARN","error":"ERR","task":"TASK","info":"INFO","ok":"DONE"} 12 | 13 | if not os.path.isdir(self.cwd + "/.tmp/"): 14 | os.mkdir(self.cwd + "/.tmp/") 15 | 16 | 17 | def isGrubEntrySafe(self): 18 | return sh_which("grub-customizer") is None and sh_which("update-grub") is not None 19 | 20 | def Log(self,log_type, log_mesage): 21 | now = datetime.now() 22 | print(now.strftime("%H:%M:%S") + ": ax86-Installer - " + self.log_prefix[log_type] + " - " + log_mesage) 23 | 24 | def isCustomExists(self): 25 | return os.path.isfile(self.custom_40) 26 | 27 | def GenerateUnins(self, name, session_id, path): 28 | try: 29 | with open(path + '/uninstall.sh', 'w') as gfile: 30 | gfile.write(resources.uninstallation_script.format(osname=name, pid=session_id)) 31 | except: 32 | return False 33 | finally: 34 | return True 35 | 36 | def getGrubCode(self, entry_name, isHome): 37 | 38 | path = entry_name 39 | if isHome: 40 | path = "home/" + entry_name 41 | 42 | return resources.custom_entry.format(osname=entry_name, name=path) 43 | 44 | 45 | def GenGrubEntry(self, entry_name, isHome, process): 46 | 47 | custom_path = self.cwd + "/.tmp/" + process + '.cfg' 48 | path = entry_name 49 | 50 | if isHome: 51 | path = "home/" + entry_name 52 | 53 | grub_code = resources.custom_template.format(osname=entry_name, name=path, pid=process) 54 | 55 | if not self.isCustomExists(): 56 | grub_code = resources.custom_basic + grub_code 57 | 58 | with open(custom_path, 'w') as gfile: 59 | gfile.write(grub_code) 60 | 61 | # Some stuntman method to append the grub_config 62 | config_creation = os.system("cat %s | pkexec tee -a %s > /dev/null 2>&1" % (custom_path, self.custom_40)) 63 | 64 | if config_creation == 0: 65 | os.remove(custom_path) 66 | returncode = os.system("pkexec update-grub") 67 | 68 | if returncode == 0: 69 | return True 70 | else: 71 | return False 72 | else: 73 | return False 74 | 75 | -------------------------------------------------------------------------------- /banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaxparrow07/Androidx86-Installer-Linux/b9119c963dbc10b0fb6a148bfe457fcc480f39c3/banner.png -------------------------------------------------------------------------------- /img/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaxparrow07/Androidx86-Installer-Linux/b9119c963dbc10b0fb6a148bfe457fcc480f39c3/img/about.png -------------------------------------------------------------------------------- /img/drop_here.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaxparrow07/Androidx86-Installer-Linux/b9119c963dbc10b0fb6a148bfe457fcc480f39c3/img/drop_here.png -------------------------------------------------------------------------------- /img/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaxparrow07/Androidx86-Installer-Linux/b9119c963dbc10b0fb6a148bfe457fcc480f39c3/img/exit.png -------------------------------------------------------------------------------- /img/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaxparrow07/Androidx86-Installer-Linux/b9119c963dbc10b0fb6a148bfe457fcc480f39c3/img/help.png -------------------------------------------------------------------------------- /img/image_loaded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaxparrow07/Androidx86-Installer-Linux/b9119c963dbc10b0fb6a148bfe457fcc480f39c3/img/image_loaded.png -------------------------------------------------------------------------------- /img/iso.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaxparrow07/Androidx86-Installer-Linux/b9119c963dbc10b0fb6a148bfe457fcc480f39c3/img/iso.png -------------------------------------------------------------------------------- /img/mini_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaxparrow07/Androidx86-Installer-Linux/b9119c963dbc10b0fb6a148bfe457fcc480f39c3/img/mini_logo.png -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | """Top-level script to invoke app implementation.""" 4 | 5 | import sys 6 | import app.main 7 | 8 | if __name__ == '__main__': 9 | sys.exit(app.main.main()) 10 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import io 2 | import os.path 3 | from setuptools import setup 4 | 5 | VERSION_PATH = os.path.join( 6 | os.path.dirname(__file__), 'app/VERSION.txt') 7 | with io.open(VERSION_PATH, 'r', encoding='utf-8') as f: 8 | version = f.read().strip() 9 | 10 | setup( 11 | name = "androidx86-installer", # what you want to call the archive/egg 12 | version = version, 13 | packages=["app"], # top-level python modules you can import like 14 | # 'import foo' 15 | dependency_links = [], # custom links to a specific project 16 | install_requires=[], 17 | extras_require={}, # optional features that other packages can require 18 | # like 'app[foo]' 19 | package_data = {"app": ["VERSION.txt"]}, 20 | author="Jaxparrow", 21 | author_email = "jaxparrow07@pm.me", 22 | description = "A GUI android-x86 installer for the Linux platform", 23 | license = "GPL-2.0", 24 | keywords= "android-x86", 25 | url = "https://github.com/jaxparrow07/Androidx86-Installer-Linux", 26 | entry_points = { 27 | "console_scripts": [ # command-line executables to expose 28 | "app_in_python = app.main:main", 29 | ], 30 | "gui_scripts": [] # GUI executables (creates pyw on Windows) 31 | } 32 | ) 33 | --------------------------------------------------------------------------------