├── .gitignore ├── LICENSE ├── README.md ├── centos └── start-centos.sh ├── debian ├── sources.list └── start-debian.sh ├── fedora ├── fedora-modular.repo ├── fedora-updates-modular.repo ├── fedora-updates.repo ├── fedora.repo ├── sources.list └── start-fedora.sh ├── imgs ├── 15876443823741.jpg ├── image-20200423201747321.jpg └── image-20200423203504565.png ├── kali ├── sources.list └── start-kali.sh ├── termux-linux-install.py └── ubuntu ├── centos.sh ├── sources.list └── start-ubuntu.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | */.DS_Store 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 前言简介 2 | Termux 一键安装 Linux 脚本 3 | 4 | 灵感来源于 AnLinux 和 AndroNix。 5 | 6 | 这两个软件提供的脚本下载资源都在国外,而且安装的系统里面更新源也是国外的,再没有 vim 编辑器的情况下,只能手动 echo 写入源 很是难受,于是一气之下就自己写了这个脚本了,核心镜像文件的下载地址使用的是码云(心疼码云3秒钟)。 7 | 8 | # 依赖安装 9 | 10 | Termux 使用如下命令安装: 11 | 12 | ```bash 13 | pkg install proot git python -y 14 | ``` 15 | 16 | # 基本使用 17 | 18 | ```bash 19 | git clone https://github.com/sqlsec/termux-install-linux 20 | cd termux-install-linux 21 | python termux-linux-install.py 22 | ``` 23 | 24 | ![](imgs/15876443823741.jpg) 25 | 26 | 基本上可以直接上手,0 学习成本,用户输错了也没关系,因为国光我都考虑到了,用户想篡改我的网址我也想到了,除非你有点代码基础,否则不是白嫖党小白你想象的那样直接修改就可以了的! 27 | 28 | ## Ubuntu 29 | 30 | 安装成功后,可以直接这样启动: 31 | 32 | ```bash 33 | cd ~/Termux-Linux/Ubuntu 34 | ./start-ubuntu.sh 35 | ``` 36 | 37 | # Kali 38 | 39 | 这个 Kali 是轻量级的,大家要安装完整的 Kali Nethunter 的话 ,可以参考我的 Termux 文章里面的操作细节: [Termux 高级终端安装使用配置教程: Kali NetHunter](https://www.sqlsec.com/2018/05/termux.html#toc-heading-112) 40 | 41 | ```bash 42 | cd ~/Termux-Linux/Kali 43 | ./start-kali.sh 44 | ``` 45 | 46 | # Debian 47 | 48 | ```bash 49 | cd ~/Termux-Linux/Debian 50 | ./start-debian.sh 51 | ``` 52 | 53 | 54 | 55 | # 总结 56 | 57 | 本脚本不会经常更新,除非有重大使用问题,暂时不考虑增加新的操作系统了,也不考虑增加图形化桌面安装功能,随缘佛系更新。 -------------------------------------------------------------------------------- /centos/start-centos.sh: -------------------------------------------------------------------------------- 1 | #!/data/data/com.termux/files/usr/bin/bash 2 | cd $(dirname $0) 3 | ## unset LD_PRELOAD in case termux-exec is installed 4 | unset LD_PRELOAD 5 | command="proot" 6 | command+=" --link2symlink" 7 | command+=" -0" 8 | command+=" -r centos-fs" 9 | if [ -n "$(ls -A binds)" ]; then 10 | for f in binds/* ;do 11 | . $f 12 | done 13 | fi 14 | command+=" -b /dev" 15 | command+=" -b /proc" 16 | command+=" -b centos-fs/root:/dev/shm" 17 | ## uncomment the following line to have access to the home directory of termux 18 | #command+=" -b /data/data/com.termux/files/home:/root" 19 | ## uncomment the following line to mount /sdcard directly to / 20 | #command+=" -b /sdcard" 21 | command+=" -w /root" 22 | command+=" /usr/bin/env -i" 23 | command+=" HOME=/root" 24 | command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games" 25 | command+=" TERM=$TERM" 26 | command+=" LANG=C.UTF-8" 27 | command+=" /bin/bash --login" 28 | com="$@" 29 | if [ -z "$1" ];then 30 | exec $command 31 | else 32 | $command -c "$com" 33 | fi -------------------------------------------------------------------------------- /debian/sources.list: -------------------------------------------------------------------------------- 1 | deb http://mirrors.163.com/debian/ buster main contrib non-free 2 | deb http://mirrors.163.com/debian/ buster-updates main contrib non-free 3 | deb http://mirrors.163.com/debian/ buster-backports main contrib non-free 4 | deb http://mirrors.163.com/debian-security buster/updates main contrib non-free -------------------------------------------------------------------------------- /debian/start-debian.sh: -------------------------------------------------------------------------------- 1 | #!/data/data/com.termux/files/usr/bin/bash 2 | cd $(dirname $0) 3 | ## unset LD_PRELOAD in case termux-exec is installed 4 | unset LD_PRELOAD 5 | command="proot" 6 | command+=" --link2symlink" 7 | command+=" -0" 8 | command+=" -r debian-fs" 9 | if [ -n "$(ls -A binds)" ]; then 10 | for f in binds/* ;do 11 | . $f 12 | done 13 | fi 14 | command+=" -b /dev" 15 | command+=" -b /proc" 16 | command+=" -b debian-fs/root:/dev/shm" 17 | ## uncomment the following line to have access to the home directory of termux 18 | #command+=" -b /data/data/com.termux/files/home:/root" 19 | ## uncomment the following line to mount /sdcard directly to / 20 | #command+=" -b /sdcard" 21 | command+=" -w /root" 22 | command+=" /usr/bin/env -i" 23 | command+=" HOME=/root" 24 | command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games" 25 | command+=" TERM=$TERM" 26 | command+=" LANG=C.UTF-8" 27 | command+=" /bin/bash --login" 28 | com="$@" 29 | if [ -z "$1" ];then 30 | exec $command 31 | else 32 | $command -c "$com" 33 | fi -------------------------------------------------------------------------------- /fedora/fedora-modular.repo: -------------------------------------------------------------------------------- 1 | [fedora-modular] 2 | name=Fedora Modular $releasever - $basearch 3 | failovermethod=priority 4 | baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/releases/$releasever/Modular/$basearch/os/ 5 | enabled=1 6 | metadata_expire=7d 7 | gpgcheck=1 8 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch 9 | skip_if_unavailable=False -------------------------------------------------------------------------------- /fedora/fedora-updates-modular.repo: -------------------------------------------------------------------------------- 1 | [updates-modular] 2 | name=Fedora Modular $releasever - $basearch - Updates 3 | failovermethod=priority 4 | baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/updates/$releasever/Modular/$basearch/ 5 | enabled=1 6 | gpgcheck=1 7 | metadata_expire=6h 8 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch 9 | skip_if_unavailable=False -------------------------------------------------------------------------------- /fedora/fedora-updates.repo: -------------------------------------------------------------------------------- 1 | [updates] 2 | name=Fedora $releasever - $basearch - Updates 3 | failovermethod=priority 4 | baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/updates/$releasever/Everything/$basearch/ 5 | enabled=1 6 | gpgcheck=1 7 | metadata_expire=6h 8 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch 9 | skip_if_unavailable=False -------------------------------------------------------------------------------- /fedora/fedora.repo: -------------------------------------------------------------------------------- 1 | [fedora] 2 | name=Fedora $releasever - $basearch 3 | failovermethod=priority 4 | baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/releases/$releasever/Everything/$basearch/os/ 5 | metadata_expire=28d 6 | gpgcheck=1 7 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch 8 | skip_if_unavailable=False -------------------------------------------------------------------------------- /fedora/sources.list: -------------------------------------------------------------------------------- 1 | deb https://mirrors.tuna.tsinghua.edu.cn/parrot/ stable main contrib non-free 2 | deb-src https://mirrors.tuna.tsinghua.edu.cn/parrot/ stable main contrib non-free -------------------------------------------------------------------------------- /fedora/start-fedora.sh: -------------------------------------------------------------------------------- 1 | #!/data/data/com.termux/files/usr/bin/bash 2 | cd $(dirname $0) 3 | ## unset LD_PRELOAD in case termux-exec is installed 4 | unset LD_PRELOAD 5 | command="proot" 6 | command+=" --link2symlink" 7 | command+=" -0" 8 | command+=" -r fedora-fs" 9 | if [ -n "$(ls -A binds)" ]; then 10 | for f in binds/* ;do 11 | . $f 12 | done 13 | fi 14 | command+=" -b /dev" 15 | command+=" -b /proc" 16 | command+=" -b fedora-fs/root:/dev/shm" 17 | ## uncomment the following line to have access to the home directory of termux 18 | #command+=" -b /data/data/com.termux/files/home:/root" 19 | ## uncomment the following line to mount /sdcard directly to / 20 | #command+=" -b /sdcard" 21 | command+=" -w /root" 22 | command+=" /usr/bin/env -i" 23 | command+=" HOME=/root" 24 | command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games" 25 | command+=" TERM=$TERM" 26 | command+=" LANG=C.UTF-8" 27 | command+=" /bin/bash --login" 28 | com="$@" 29 | if [ -z "$1" ];then 30 | exec $command 31 | else 32 | $command -c "$com" 33 | fi -------------------------------------------------------------------------------- /imgs/15876443823741.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqlsec/termux-install-linux/250d4959b17769413c0fa5b993d7fcbd1695ba53/imgs/15876443823741.jpg -------------------------------------------------------------------------------- /imgs/image-20200423201747321.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqlsec/termux-install-linux/250d4959b17769413c0fa5b993d7fcbd1695ba53/imgs/image-20200423201747321.jpg -------------------------------------------------------------------------------- /imgs/image-20200423203504565.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqlsec/termux-install-linux/250d4959b17769413c0fa5b993d7fcbd1695ba53/imgs/image-20200423203504565.png -------------------------------------------------------------------------------- /kali/sources.list: -------------------------------------------------------------------------------- 1 | deb http://http.kali.org/kali kali-rolling main non-free contrib 2 | deb-src http://http.kali.org/kali kali-rolling main non-free contrib -------------------------------------------------------------------------------- /kali/start-kali.sh: -------------------------------------------------------------------------------- 1 | #!/data/data/com.termux/files/usr/bin/bash 2 | cd $(dirname $0) 3 | ## unset LD_PRELOAD in case termux-exec is installed 4 | unset LD_PRELOAD 5 | command="proot" 6 | command+=" --link2symlink" 7 | command+=" -0" 8 | command+=" -r kali-fs" 9 | if [ -n "$(ls -A binds)" ]; then 10 | for f in binds/* ;do 11 | . $f 12 | done 13 | fi 14 | command+=" -b /dev" 15 | command+=" -b /proc" 16 | command+=" -b kali-fs/root:/dev/shm" 17 | ## uncomment the following line to have access to the home directory of termux 18 | #command+=" -b /data/data/com.termux/files/home:/root" 19 | ## uncomment the following line to mount /sdcard directly to / 20 | #command+=" -b /sdcard" 21 | command+=" -w /root" 22 | command+=" /usr/bin/env -i" 23 | command+=" HOME=/root" 24 | command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games" 25 | command+=" TERM=$TERM" 26 | command+=" LANG=C.UTF-8" 27 | command+=" /bin/bash --login" 28 | com="$@" 29 | if [ -z "$1" ];then 30 | exec $command 31 | else 32 | $command -c "$com" 33 | fi -------------------------------------------------------------------------------- /termux-linux-install.py: -------------------------------------------------------------------------------- 1 | import os 2 | import base64 3 | import argparse 4 | 5 | def logo(): 6 | print(""" _____ 7 | |_ _|__ _ __ _ __ ___ _ ___ __ 8 | | |/ _ \ '__| '_ ` _ \| | | \ \/ / 9 | | | __/ | | | | | | | |_| |> < 10 | |_|\___|_| |_| |_| |_|\__,_/_/\_\\""") 11 | 12 | copyright_title = 'ICAgIFRlcm11eCDpq5jnuqfnu4jnq6/lronoo4Xkvb/nlKjphY3nva7mlZnnqIs=' 13 | copyright_url = 'aHR0cHM6Ly93d3cuc3Fsc2VjLmNvbS8yMDE4LzA1L3Rlcm11eC5odG1s' 14 | print('') 15 | print(base64.b64decode(copyright_title).decode('utf-8')) 16 | print(base64.b64decode(copyright_url).decode('utf-8')) 17 | print('') 18 | print(' 1. 安装 Ubuntu 2. 卸载 Ubuntu') 19 | print(' 3. 安装 Kali 4. 卸载 Kali') 20 | print(' 5. 安装 Debian 6. 卸载 Debian') 21 | print(' 7. 安装 CentOS 8. 卸载 CentOS') 22 | print(' 9. 安装 Fedora 10. 卸载 Fedora') 23 | print('11. 查询已安装系统 12. 退出脚本') 24 | print('') 25 | return copyright_title, copyright_url 26 | 27 | 28 | def install_ubuntu(): 29 | osname = 'Ubuntu' 30 | folder = 'ubuntu-fs' 31 | shname = 'start-ubuntu.sh' 32 | imagedir = 'termux-ubuntu' 33 | tarball = 'ubuntu-rootfs-arm64.tar.xz' 34 | print("\n正在从码云下载 Rootfs 镜像文件,请耐心等待") 35 | os.system('git clone "https://gitee.com/sqlsec/termux-ubuntu.git"') 36 | print('\n下载完成 看来国内码云的速度还是可以的 2333') 37 | print('\n正在解压镜像 请耐心等待') 38 | os.system(f'mkdir -p $HOME/Termux-Linux/{osname}/{folder}') 39 | os.system(f'proot --link2symlink tar -xf {imagedir}/{tarball} -C $HOME/Termux-Linux/{osname}/{folder} --exclude="dev"||:') 40 | print('\n解压完成 正在删除已下载的镜像') 41 | os.system(f'rm -rf {imagedir}') 42 | print('\n正在优化系统设置') 43 | os.system(f'mkdir -p $HOME/Termux-Linux/{osname}/binds') 44 | os.system(f'cp ubuntu/{shname} $HOME/Termux-Linux/{osname}/') 45 | os.system(f'termux-fix-shebang $HOME/Termux-Linux/{osname}/{shname}') 46 | os.system(f'chmod +x $HOME/Termux-Linux/{osname}/{shname}') 47 | os.system(f'rm $HOME/Termux-Linux/{osname}/{folder}/etc/apt/sources.list') 48 | os.system(f'cp ubuntu/sources.list $HOME/Termux-Linux/{osname}/{folder}/etc/apt/') 49 | os.system('screenfetch -A Ubuntu -L') 50 | print('\n Ubuntu 安装成功') 51 | print('\n 祝您使用愉快\n') 52 | 53 | def uninstall_ubuntu(): 54 | print('\n正在卸载 Ubuntu 请耐心等待') 55 | os.system('rm -rf $HOME/Termux-Linux/Ubuntu') 56 | print('\n卸载完成!') 57 | 58 | def install_kali(): 59 | osname = 'Kali' 60 | folder = 'kali-fs' 61 | shname = 'start-kali.sh' 62 | imagedir = 'termux-kali' 63 | tarball = "kali-rootfs-arm64.tar.xz" 64 | print("\n正在从码云下载 Rootfs 镜像文件,请耐心等待") 65 | os.system('git clone "https://gitee.com/sqlsec/termux-kali"') 66 | print('\n下载完成 看来国内码云的速度还是可以的 2333') 67 | print('\n正在解压镜像 请耐心等待') 68 | os.system(f'mkdir -p $HOME/Termux-Linux/{osname}/{folder}') 69 | os.system(f'proot --link2symlink tar -xJf {imagedir}/{tarball} -C $HOME/Termux-Linux/{osname}/{folder} ||:') 70 | print('\n解压完成 正在删除已下载的镜像') 71 | os.system(f'rm -rf {imagedir}') 72 | print('\n正在优化系统设置') 73 | os.system(f'mkdir -p $HOME/Termux-Linux/{osname}/binds') 74 | os.system(f'cp kali/{shname} $HOME/Termux-Linux/{osname}/') 75 | os.system(f'termux-fix-shebang $HOME/Termux-Linux/{osname}/{shname}') 76 | os.system(f'chmod +x $HOME/Termux-Linux/{osname}/{shname}') 77 | os.system(f'rm $HOME/Termux-Linux/{osname}/{folder}/etc/apt/sources.list') 78 | os.system(f'cp kali/sources.list $HOME/Termux-Linux/{osname}/{folder}/etc/apt/') 79 | os.system('screenfetch -A "Kali Linux" -L') 80 | print('\n Kali 安装成功') 81 | print('\n 祝您使用愉快\n') 82 | 83 | def uninstall_kali(): 84 | print('\n正在卸载 Kali 请耐心等待') 85 | os.system('rm -rf $HOME/Termux-Linux/Kali') 86 | print('\n卸载完成!') 87 | 88 | def install_debian(): 89 | osname = 'Debian' 90 | folder = 'debian-fs' 91 | shname = 'start-debian.sh' 92 | imagedir = 'termux-debian' 93 | tarball = "debian-rootfs-arm64.tar.xz" 94 | print("\n正在从码云下载 Rootfs 镜像文件,请耐心等待") 95 | os.system('git clone "https://gitee.com/sqlsec/termux-debian"') 96 | print('\n下载完成 看来国内码云的速度还是可以的 2333') 97 | print('\n正在解压镜像 请耐心等待') 98 | os.system(f'mkdir -p $HOME/Termux-Linux/{osname}/{folder}') 99 | os.system(f'proot --link2symlink tar -xJf {imagedir}/{tarball} -C $HOME/Termux-Linux/{osname}/{folder} ||:') 100 | print('\n解压完成 正在删除已下载的镜像') 101 | os.system(f'rm -rf {imagedir}') 102 | print('\n正在优化系统设置') 103 | os.system(f'mkdir -p $HOME/Termux-Linux/{osname}/binds') 104 | os.system(f'cp debian/{shname} $HOME/Termux-Linux/{osname}/') 105 | os.system(f'termux-fix-shebang $HOME/Termux-Linux/{osname}/{shname}') 106 | os.system(f'chmod +x $HOME/Termux-Linux/{osname}/{shname}') 107 | os.system(f'rm $HOME/Termux-Linux/{osname}/{folder}/etc/apt/sources.list') 108 | os.system(f'cp debian/sources.list $HOME/Termux-Linux/{osname}/{folder}/etc/apt/') 109 | os.system('screenfetch -A "Debian" -L') 110 | print('\n Debian 安装成功') 111 | print('\n 祝您使用愉快\n') 112 | 113 | def uninstall_debian(): 114 | print('\n正在卸载 Debian 请耐心等待') 115 | os.system('rm -rf $HOME/Termux-Linux/Debian') 116 | print('\n卸载完成!') 117 | 118 | def install_centos(): 119 | osname = 'CentOS' 120 | folder = 'centos-fs' 121 | shname = 'start-centos.sh' 122 | imagedir = 'termux-centos' 123 | tarball = "centos-rootfs-arm64.tar.xz" 124 | print("\n正在从码云下载 Rootfs 镜像文件,请耐心等待") 125 | os.system('git clone "https://gitee.com/sqlsec/termux-centos"') 126 | print('\n下载完成 看来国内码云的速度还是可以的 2333') 127 | print('\n正在解压镜像 请耐心等待') 128 | os.system(f'mkdir -p $HOME/Termux-Linux/{osname}/{folder}') 129 | os.system(f'proot --link2symlink tar -xJf {imagedir}/{tarball} -C $HOME/Termux-Linux/{osname}/{folder} --exclude="dev"||:') 130 | print('\n解压完成 正在删除已下载的镜像') 131 | os.system(f'rm -rf {imagedir}') 132 | print('\n正在优化系统设置') 133 | os.system(f'mkdir -p $HOME/Termux-Linux/{osname}/binds') 134 | os.system(f'mkdir -p $HOME/Termux-Linux/{osname}/{folder}/tmp') 135 | os.system(f'echo "127.0.0.1 localhost" > $HOME/Termux-Linux/{osname}/{folder}/etc/hosts') 136 | os.system(f'echo "nameserver 8.8.8.8" > $HOME/Termux-Linux/{osname}/{folder}/etc/resolv.conf') 137 | os.system(f'echo "nameserver 8.8.4.4" >> $HOME/Termux-Linux/{osname}/{folder}/etc/resolv.conf') 138 | os.system(f'cp centos/{shname} $HOME/Termux-Linux/{osname}/') 139 | os.system(f'termux-fix-shebang $HOME/Termux-Linux/{osname}/{shname}') 140 | os.system(f'chmod +x $HOME/Termux-Linux/{osname}/{shname}') 141 | os.system('screenfetch -A "CentOS" -L') 142 | print('\n CentOS 安装成功') 143 | print('\n 祝您使用愉快\n') 144 | 145 | def uninstall_centos(): 146 | print('\n正在卸载 CentOS 请耐心等待') 147 | os.system('chmod 777 -R $HOME/Termux-Linux/CentOS') 148 | os.system('rm -rf $HOME/Termux-Linux/CentOS') 149 | print('\n卸载完成!') 150 | 151 | def install_fedora(): 152 | osname = 'Fedora' 153 | folder = 'fedora-fs' 154 | shname = 'start-fedora.sh' 155 | imagedir = 'termux-fedora' 156 | tarball = "fedora-rootfs-arm64.tar.xz" 157 | print("\n正在从码云下载 Rootfs 镜像文件,请耐心等待") 158 | os.system('git clone "https://gitee.com/sqlsec/termux-fedora"') 159 | print('\n下载完成 看来国内码云的速度还是可以的 2333') 160 | print('\n正在解压镜像 请耐心等待') 161 | os.system(f'mkdir -p $HOME/Termux-Linux/{osname}/{folder}') 162 | os.system(f'proot --link2symlink tar -xJf {imagedir}/{tarball} -C $HOME/Termux-Linux/{osname}/{folder} --exclude "dev" ||:') 163 | print('\n解压完成 正在删除已下载的镜像') 164 | os.system(f'rm -rf {imagedir}') 165 | print('\n正在优化系统设置') 166 | os.system(f'echo "127.0.0.1 localhost" > $HOME/Termux-Linux/{osname}/{folder}/etc/hosts') 167 | os.system(f'echo "nameserver 8.8.4.4" > $HOME/Termux-Linux/{osname}/{folder}/etc/resolv.conf') 168 | os.system(f'echo "nameserver 8.8.4.4" >> $HOME/Termux-Linux/{osname}/{folder}/etc/resolv.conf') 169 | os.system(f'mkdir -p $HOME/Termux-Linux/{osname}/binds') 170 | os.system(f'cp fedora/{shname} $HOME/Termux-Linux/{osname}/') 171 | os.system(f'termux-fix-shebang $HOME/Termux-Linux/{osname}/{shname}') 172 | os.system(f'chmod +x $HOME/Termux-Linux/{osname}/{shname}') 173 | os.system(f'rm $HOME/Termux-Linux/{osname}/{folder}/etc/yum.repos.d/*') 174 | os.system(f'cp fedora/*.repo $HOME/Termux-Linux/{osname}/{folder}/etc/yum.repos.d/') 175 | os.system('screenfetch -A "Fedora" -L') 176 | print('\n Fedora 安装成功') 177 | print('\n 祝您使用愉快\n') 178 | 179 | 180 | def uninstall_fedora(): 181 | print('\n正在卸载 Fedora 请耐心等待') 182 | os.system('chmod 777 -R $HOME/Termux-Linux/Fedora') 183 | os.system('rm -rf $HOME/Termux-Linux/Fedora') 184 | print('\n卸载完成!') 185 | 186 | if __name__ == "__main__": 187 | # 如果没有安装 screenfetch 就安装 188 | result = os.popen('pkg list-installed|grep screenfetch') 189 | if 'screenfetch' not in result.read(): 190 | print('正在安装相关依赖包: screenfetch') 191 | os.system('pkg install screenfetch -y') 192 | 193 | copyright = logo() 194 | if copyright[0][10:13] != '11e' or copyright[1][10:13] != '93d': 195 | print('校验失败 退出脚本') 196 | os._exit(0) 197 | 198 | file_exits = False 199 | result = os.popen('ls $HOME') 200 | for line in result.read().splitlines(): 201 | if line == 'Termux-Linux': 202 | file_exits = True 203 | 204 | linux_dir = [] 205 | if file_exits: 206 | result = os.popen('ls $HOME/Termux-Linux/') 207 | for line in result.read().splitlines(): 208 | linux_dir.append(line) 209 | else: 210 | os.system('mkdir $HOME/Termux-Linux') 211 | 212 | option = input('\n请选择要执行的操作: ') 213 | if int(option) == 1: 214 | if 'Ubuntu' in linux_dir: 215 | print('检测到已安装 Ubuntu 如要安装请卸载后再安装') 216 | else: 217 | install_ubuntu() 218 | elif int(option) == 2: 219 | if 'Ubuntu' in linux_dir: 220 | uninstall_ubuntu() 221 | else: 222 | print('黑人问号 您还没有安装过 Ubuntu 哦') 223 | elif int(option) == 3: 224 | if 'Kali' in linux_dir: 225 | print('检测到已安装 Kali 如要安装请卸载后再安装') 226 | else: 227 | install_kali() 228 | elif int(option) == 4: 229 | if 'Kali' in linux_dir: 230 | uninstall_kali() 231 | else: 232 | print('黑人问号 您还没有安装过 Kali 哦') 233 | elif int(option) == 5: 234 | if 'Debian' in linux_dir: 235 | print('检测到已安装 Debian 如要安装请卸载后再安装') 236 | else: 237 | install_debian() 238 | elif int(option) == 6: 239 | if 'Debian' in linux_dir: 240 | uninstall_debian() 241 | else: 242 | print('黑人问号 您还没有安装过 Debian 哦') 243 | elif int(option) == 7: 244 | if 'CentOS' in linux_dir: 245 | print('检测到已安装 CentOS 如要安装请卸载后再安装') 246 | else: 247 | install_centos() 248 | elif int(option) == 8: 249 | if 'CentOS' in linux_dir: 250 | uninstall_centos() 251 | else: 252 | print('黑人问号 您还没有安装过 CentOS 哦') 253 | elif int(option) == 9: 254 | if 'Fedora' in linux_dir: 255 | print('检测到已安装 Fedora 如要安装请卸载后再安装') 256 | else: 257 | install_fedora() 258 | elif int(option) == 10: 259 | if 'Fedora' in linux_dir: 260 | uninstall_fedora() 261 | else: 262 | print('黑人问号 您还没有安装过 Fedora 哦') 263 | elif int(option) == 11: 264 | if linux_dir: 265 | print('\n已安装系统如下: ') 266 | print(linux_dir) 267 | else: 268 | print('暂没有安装系统哦 赶紧来体验一下吧') 269 | elif int(option) == 12: 270 | os._exit(0) 271 | else: 272 | print('黑人问号 不合法的输入选项') 273 | -------------------------------------------------------------------------------- /ubuntu/centos.sh: -------------------------------------------------------------------------------- 1 | #!/data/data/com.termux/files/usr/bin/bash 2 | folder=centos-fs 3 | if [ -d "$folder" ]; then 4 | first=1 5 | echo "skipping downloading" 6 | fi 7 | tarball="centos-rootfs.tar.xz" 8 | if [ "$first" != 1 ];then 9 | if [ ! -f $tarball ]; then 10 | echo "Download Rootfs, this may take a while base on your internet speed." 11 | case `dpkg --print-architecture` in 12 | aarch64) 13 | archurl="arm64" ;; 14 | arm) 15 | archurl="armhf" ;; 16 | amd64) 17 | archurl="amd64" ;; 18 | x86_64) 19 | archurl="amd64" ;; 20 | i*86) 21 | archurl="i386" ;; 22 | x86) 23 | archurl="i386" ;; 24 | *) 25 | echo "unknown architecture"; exit 1 ;; 26 | esac 27 | wget "https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Rootfs/CentOS/${archurl}/centos-rootfs-${archurl}.tar.xz" -O $tarball 28 | fi 29 | cur=`pwd` 30 | mkdir -p "$folder" 31 | cd "$folder" 32 | echo "Decompressing Rootfs, please be patient." 33 | proot --link2symlink tar -xJf ${cur}/${tarball} --exclude='dev'||: 34 | 35 | echo "Setting up name server" 36 | echo "127.0.0.1 localhost" > etc/hosts 37 | echo "nameserver 8.8.8.8" > etc/resolv.conf 38 | echo "nameserver 8.8.4.4" >> etc/resolv.conf 39 | cd "$cur" 40 | fi 41 | mkdir -p centos-binds 42 | mkdir -p centos-fs/tmp 43 | bin=start-centos.sh 44 | echo "writing launch script" 45 | cat > $bin <<- EOM 46 | #!/bin/bash 47 | cd \$(dirname \$0) 48 | ## unset LD_PRELOAD in case termux-exec is installed 49 | unset LD_PRELOAD 50 | command="proot" 51 | command+=" --link2symlink" 52 | command+=" -0" 53 | command+=" -r $folder" 54 | if [ -n "\$(ls -A centos-binds)" ]; then 55 | for f in centos-binds/* ;do 56 | . \$f 57 | done 58 | fi 59 | command+=" -b /dev" 60 | command+=" -b /proc" 61 | command+=" -b centos-fs/root:/dev/shm" 62 | ## uncomment the following line to have access to the home directory of termux 63 | #command+=" -b /data/data/com.termux/files/home:/root" 64 | ## uncomment the following line to mount /sdcard directly to / 65 | #command+=" -b /sdcard" 66 | command+=" -w /root" 67 | command+=" /usr/bin/env -i" 68 | command+=" HOME=/root" 69 | command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games" 70 | command+=" TERM=\$TERM" 71 | command+=" LANG=C.UTF-8" 72 | command+=" /bin/bash --login" 73 | com="\$@" 74 | if [ -z "\$1" ];then 75 | exec \$command 76 | else 77 | \$command -c "\$com" 78 | fi 79 | EOM 80 | 81 | echo "fixing shebang of $bin" 82 | termux-fix-shebang $bin 83 | echo "making $bin executable" 84 | chmod +x $bin 85 | echo "removing image for some space" 86 | rm $tarball 87 | echo "You can now launch CentOS with the ./${bin} script" 88 | -------------------------------------------------------------------------------- /ubuntu/sources.list: -------------------------------------------------------------------------------- 1 | deb https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse 2 | deb https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse 3 | deb https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse 4 | deb https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse -------------------------------------------------------------------------------- /ubuntu/start-ubuntu.sh: -------------------------------------------------------------------------------- 1 | #!/data/data/com.termux/files/usr/bin/bash 2 | cd $(dirname $0) 3 | ## unset LD_PRELOAD in case termux-exec is installed 4 | unset LD_PRELOAD 5 | command="proot" 6 | command+=" --link2symlink" 7 | command+=" -0" 8 | command+=" -r ubuntu-fs" 9 | if [ -n "$(ls -A binds)" ]; then 10 | for f in binds/* ;do 11 | . $f 12 | done 13 | fi 14 | command+=" -b /dev" 15 | command+=" -b /proc" 16 | command+=" -b ubuntu-fs/root:/dev/shm" 17 | ## uncomment the following line to have access to the home directory of termux 18 | #command+=" -b /data/data/com.termux/files/home:/root" 19 | ## uncomment the following line to mount /sdcard directly to / 20 | #command+=" -b /sdcard" 21 | command+=" -w /root" 22 | command+=" /usr/bin/env -i" 23 | command+=" HOME=/root" 24 | command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games" 25 | command+=" TERM=$TERM" 26 | command+=" LANG=C.UTF-8" 27 | command+=" /bin/bash --login" 28 | com="$@" 29 | if [ -z "$1" ];then 30 | exec $command 31 | else 32 | $command -c "$com" 33 | fi --------------------------------------------------------------------------------