Skip to content

Willie169/termux-sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,032 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

termux-sh

This repository contains Shell scripts for Termux, a terminal emulator for Android. These scripts include setup automation, shortcuts, installations and configurations of development tools and emulation environments such as proot, proot-distro, QEMU system emulation, and box64, and more.

Table of Contents

Termux

Termux (com.termux) can be installed from F-Droid.

WARNING: If you installed termux from Google Play or a very old version, then you will receive package command errors. Google Play builds are deprecated and no longer supported. It is highly recommended that you update to termux-app v0.118.0 or higher as soon as possible for various bug fixes, including a critical world-readable vulnerability reported at https://termux.github.io/general/2022/02/15/termux-apps-vulnerability-disclosures.html. It is recommended that you shift to F-Droid or GitHub releases.

Refer to Android-Non-Root for more information.

Termux Setup

termux-setup.sh

Prerequisites

  • Sufficient storage (calculated on Termux 0.118.3):
    • Approximately 0.2 GB for the Termux app itself.
    • Approximately 7.3 GB in total for the minimal configuration with XFCE=0, ANDROID=0, and
      TERMUX=''
      UBUNTU=''
      UBUNTUINSTALL=0
      DEBIAN=''
      DEBIANINSTALL=0
      UBUNTUBOX=''
      UBUNTUBOXINSTALL=0
      DEBIANBOX=''
      DEBIANBOXINSTALL=0
      
    • Approximately 0.4 GB more for XFCE=1.
    • Approximately 2.6 GB more for ANDROID=1.
    • Approximately 0.1 GB more for a nonempty TERMUX.
    • Approximately 0.3 GB more for a nonempty UBUNTU.
    • Approximately 0.2 GB more for a nonempty DEBIAN.
    • Approximately 36.6 GB more for UBUNTUINSTALL=1.
    • Approximately 36.6 GB more for DEBIANINSTALL=1.
    • Approximately 57.4 GB in total for the default configuration with XFCE=1, ANDROID=1, and
      TERMUX='termux'
      UBUNTU='ubuntu'
      UBUNTUINSTALL=1
      DEBIAN='debian'
      DEBIANINSTALL=0
      UBUNTUBOX=''
      UBUNTUBOXINSTALL=0
      DEBIANBOX=''
      DEBIANBOXINSTALL=0
      
  • Sufficient power supply.
  • Stable internet connection.
  • It is recommended to turn off the battery optimization for Termux.
  • It is recommended to hold wakelock while running these scripts. You can do so by opening Termux, pulling down the notification bar, and then tapping Acquire wakelock on the notification of Termux.
  • It is recommended to prevent the Process completed (signal 9) - press Enter error in advance. You may encounter it when using Termux, especially when running VMs. To prevent it from occuring, please read tutorial about it in my Android Non Root: https://willie169.github.io/Android-Non-Root/#process-completed-signal-9---press-enter-error for the fixes.

Execution

  1. It is suggested to run termux-change-repo and select repo(s) closer to your geographical location for faster download.
  2. termux-setup-storage
    pkg update && pkg install git -y
    cd ~ && git clone https://github.com/Willie169/termux-sh.git
    
  3. Optionally edit the variables in the beginning of ~/termux-sh/termux-setup.sh (nano for example). In VM names variables, (space) will be replaced with _, names that are not allowed will be added a suffix 1:
    pkg install nano
    nano ~/termux-sh/termux-setup.sh
    
  4. Run the setup script:
    bash ~/termux-sh/termux-setup.sh
    
  5. Follow the prompts until it exits automatically.
  6. Run gh auth login --scopes repo,read:org,admin:org,workflow,gist,notifications,delete_repo,write:packages,read:packages to login to GitHub.
  7. Run git config --global user.name [your_name] && git config --global user.email [your_email] to config git.

Content

The variables below refer to the variables set in the beginning of termux-setup.sh.

  1. Termux properties adjustments: Enables external app access in termux.properties.
  2. Shortcut configuration: Copies shortcuts from DOTshortcuts into ~/.shortcuts folder (for Termux:Widget) and Documents.sh, Download.sh, Scripts.sh, Storage.sh, proot-termux.sh, proot-ubuntu.sh, proot-debian.sh, proot-ubuntubox.sh, proot-debianbox.sh into home directory ~. See Shortcuts section for more information.
  3. Bashrc configuration: Copies ~/.bashrc.d and ~/.bashrc from my bashrc repo (can be updated with update_bashrc).
  4. PulseAudio startup: Starts PulseAudio automatically in ~/.bashrc.
  5. VirGL server startup: Starts VirGL server automatically in ~/.bashrc according to my https://github.com/Willie169/termux-x11-virgl-gpu-acceleration repo and with variables exported in ~/.bashrc.
  6. Termux packages installation: Installs Termux packages set in $PKG. The default ones include tools for C, C++, Python3, Java21, Node.js, Rust, Go, Ruby, Perl, GitHub CLI, GitLab CLI, OpenSSL, OpenSSH, JQ, FFMPEG, Maven, Zsh, PRoot, RARLAB UnRAR, Icarus Verilog, Ngspice, jpegoptim, optipng, libheif, LibWebP, ImageMagick, Inkscape, Poppler, qpdf, PDFtk, Ghostscript, XMLStarlet, GTKWave, Matplotlib, Ninja, SciPy, SQLite 3, Termux:X11, Octave, QEMU, and more. Note that you may need to download and install APK from https://github.com/termux/termux-x11 release to use Termux:X11. If you encounter Make sure an X server isn't already running(EE) error, close Termux and wait a few seconds, or Force stop and Clear cache Termux and Termux:X11 apps in Android system settings.
  7. XFCE desktop environment: Installs XFCE desktop environment if not XFCE=0. It can be started with Termux:X11 by running termux-x11 :0 -xstartup "dbus-launch --exit-with-session xfce4-session", where 0 can be replaced with other numbers, which has been defined as a function xxfce with an optional argument for display (e.g., :0).
  8. Android Build Environment Setup: Setup Android apps build environment if not ANDROID=0 using script modified from my termux-android-sdk-ndk repo. Refer to it for more information.
  9. Vim and Neovim configuration: Installs my modified version of vimrc by Amir Salihefendic (amix) for both Vim and Neovim, and lazy.nvim and Neovim plugins from my bashrc repo (can be updated by running update_nvim) for Neovim, if not VIMRC=0.
  10. NPM packages: Installs NPM packages set in $NPM locally in ~ and NPM packages set in $NPMG globally.
  11. Pip packages: Installs pip packages set in PIP.
  12. Pipx packages: Installs pip packages set in PIPX.
  13. Go packages: Installs Go packages set in GO.
  14. JARs: Installs ANTLR 4 (JAR in /usr/local/java) if not ANTLR=0 and PlantUML (JAR in /usr/local/java) if not PLANTUML=0.
  15. Proot-distro Termux environment: Installs an Termux proot-distro environment with alias $TERMUX and add boot script proot-$TERMUX.sh into home directory ~ and ~/.shortcuts folder (for Termux:Widget) if $TERMUX is not empty string.
  16. Proot-distro Ubuntu environment: Installs an Ubuntu ARM64 proot-distro environment with alias $UBUNTU if $UBUNTU is not empty string, and runs ubuntu-debian.sh in it if $UBUNTU is not empty string and $UBUNTUINSTALL is not 0. See Invoked VM Setup Scripts section for more information.
  17. Proot-distro Debian environment: Installs Debian ARM64 proot-distro environment with alias $DEBIAN if $DEBIAN is not empty string, and runs ubuntu-debian.sh in it if $DEBIAN is not empty string and $DEBIANINSTALL is not 0. See Invoked VM Setup Scripts section for more information.
  18. Proot-distro Ubuntu environment with Box64, Wine64, and Winetricks (not invoked by default and no longer actively maintained): Installs Ubuntu ARM64 proot-distro environment with alias $UBUNTUBOX if $UBUNTUBOX is not empty string, and runs box64-wine64-winetricks.sh (no longer actively maintained) in it if $UBUNTUBOX is not empty string and $UBUNTUBOXINSTALL is not 0. See Invoked VM Setup Scripts section for more information.
  19. Proot-distro Debian environment with Box64, Wine64, and Winetricks (not invoked by default and no longer actively maintained): Installs Debian ARM64 proot-distro environment with alias $DEBIANBOX if $DEBIANBOX is not empty string, and runs box64-wine64-winetricks.sh (no longer actively maintained) in it if $DEBIANBOX is not empty string and $DEBIANBOXINSTALL is not 0. See Invoked VM Setup Scripts section for more information.

Invoked VM Setup Scripts

These scripts will be invoked by Termux Setup if corresponding configuration is set.

  • ubuntu-debian.sh: Configures PulseAudio and VirGL (according to my https://github.com/Willie169/termux-x11-virgl-gpu-acceleration repo and with variables exported in ~/.bashrc) and installs development tools, runtime environments, and utilities for C, C++, Python3, Java 21, Node.js LTS (via NVM), Yarn, Rust, Go, Ruby, Perl, Fortran, Qt5, .NET SDK 10, ASP.NET Core Runtime 10, Aptitude, GitHub CLI, OpenSSL, OpenSSH, JQ, DMG2IMG, libguestfs, GHC Filesystem, FFMPEG, Pandoc, TeX Live (via regular installation instead of APT, for unrestricted tlmgr and updates), Maven, Zsh, iproute2, net-tools, Nmap, Alien, nvm, pnpm, Yarn, NPM packages jsdom markdown-toc marked marked-gfm-heading-id node-html-markdown showdown locally in ~, http-server, Bun, Homebrew, Glow, Tennis, Miniforge, pipx, uv, Poetry, MarkItDown, gh2md, LibreTranslate, Jupyter Notebook, JupyterLab, Jupytext, Meson, Tree-sitter CLI, pylatexenc, lazy.nvim and Neovim plugins from my bashrc repo (can be updated by running update_nvim), LSP servers, Microsoft True Type Core Fonts, Noto CJK fonts, CNS11643中文標準交換碼全字庫正楷體與正宋體, RARLAB UnRAR, Icarus Verilog, Verilator, Ngspice, Caneda, jpegoptim, optipng, libheif, LibWebP, ImageMagick, Inkscape, Poppler, qpdf, PDFtk, Ghostscript, Bookletimposer, Audacity, abcde, XMLStarlet, GTKWave, SDL2, SDL2 BGI, llmfit, ANTLR 4 (JAR in /usr/local/java), Firefox, Octave, XFCE desktop environment (can be started with Termux:X11 by running termux-x11 :0 &, logging into Proot-distro with --shared-tmp option, and running export DISPLAY=:0 and xfce inside, where 0 can be replaced with other numbers), fix for stuck elementary-xfce-icon-theme from my fix-elementary-xfce-icon-theme repo, PlantUML (JAR in /usr/local/java), SQLite 3, PostgreSQL 17, KataGo (~/KataGo/cpp/katago and can be run with katago) and KataGo network kata1-b6c96-s175395328-d26788732 (in ~/katago-networks, other networks can be downloaded from https://katagotraining.org/networks), LizzieYzy (can be launched by running lizzieyzy or with desktop entry ~/.local/share/applications/lizzieyzy.desktop or ~/desktop/lizzieyzy.desktop, runtime directory ~/.lizzieyzy, KataGo network kata1-b6c96-s175395328-d26788732 configured as default engine and estimate engine in ~/.lizzieyzy/config.txt, which can be updated by running update_lizzieyzy_config), Fairy-Stockfish (~/Fairy-Stockfish/src/stockfish and can be run with stockfish), Cute Chess (GUI at ~/cutechess/build/cutechess and can be launched by running cutechess or with desktop entry ~/.local/share/applications/cutechess.desktop or ~/desktop/cutechess.desktop, CLI at ~/cutechess/build/cutechess-cli and can be run with cutechess-cli, Fairy-Stockfish configured as engine in ~/.config/cutechess/engines.json, which can be updated by running update_cutechess_config), Sylvan (GUI at ~/Sylvan/projects/gui/sylvan and can be launched by running sylvan or with desktop entry ~/.local/share/applications/sylvan.desktop or ~/desktop/sylvan.desktop, CLI at ~/Sylvan/projects/cli/sylvan-cli and can be run with sylvan-cli, Fairy-Stockfish configured as engine in ~/.config/EterCyber/engines.json, which can be updated by running update_sylvan_config), my modified version of vimrc by Amir Salihefendic (amix) for both Vim and Neovim (can be updated by running update_vimrc), my LaTeX package physics-patch and checks out dev branch and my LaTeX template LaTeX-ToolKit (can be updated with update_latex), and more, and copies ~/.bashrc.d and ~/.bashrc from my bashrc repo (can be updated by running update_bashrc), on Ubuntu or Debian ARM64 Proot environment.
  • box64-wine64-winetricks.sh: Installs box64, wine64, and winetricks for running x86_64 Linux and Windows applications on Debian derivatives ARM64. (No longer actively maintained.)

Shortcuts

Shortcuts are located in DOTshortcuts. Some of them are intended for tools that is not installed or configured in the Termux Setup, such as QEMU. Some related scripts are in Additional Scripts.

Boot VM Scripts

Utility Scripts

  • Storage.sh: cd /storage/emulated/0.
  • Documents.sh, Download.sh, Scripts.sh: cd those directories in /storage/emulated/0 respectively.
  • xmrig-xmr.sh: Mines XMR to the repository owner's wallet, 48j6iQDeCSDeH46gw4dPJnMsa6TQzPa6WJaYbBS9JJucKqg9Mkt5EDe9nSkES3b8u7V6XJfL8neAPAtbEpmV2f4XC7bdbkv, using my modified version of XMRig and through Tor, which is not installed in the Termux Setup and can be installed with xmrig-install.sh. Change the wallet address and other configurations if you want.
  • termux-backup-bz.sh: Creates a compressed bzip2 backup with the highest compression level of /data/data/com.termux/files/home and /data/data/com.termux/files/usr split into 4000MB parts.

Additional Scripts

These scripts are not invoked by Termux Setup. Run it separately if you need it.

License

This repository is licensed under GNU General Public License General Public License, see LICENSE.md for details.

Credits

About

Termux setup and utility scripts for development tools, proot, box86, and more.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages