Skip to content

Latest commit

 

History

1,596 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

termux-sh

This repository contains Shell scripts for Termux including setup automation, shortcuts, and installations and configurations of development tools and emulation environments.

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

  • Full features are supported on arm64-v8a architecture, but only limited features are supported on other architectures.
  • Sufficient storage: (calculated using GitHub Action, typically a bit less than that on a real device)
    • Previous rows remain default with
      TERMUX='termux'
      UBUNTU='ubuntu'
      UBUNTUINSTALL=0
      DEBIAN='debian'
      DEBIANINSTALL=0
      
      : approximately 14.55 GB.
    • UBUNTUINSTALL=1 or DEBIANINSTALL=1: approximately 27.77 GB.
  • 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 disable phantom process killer to prevent Process completed (signal 9) - press Enter error from occuring when using Termux in advance by executing
    device_config set_sync_disabled_for_tests persistent
    device_config put activity_manager max_phantom_processes 214748364
    settings put global settings_enable_monitor_phantom_procs false
    
    If you have setup Shizuku with rish available in Termux to access interactive ADB shell, you can simply run disable-phantom-process-killer-rish.sh in this repo. If you have ADB connected with adb shell available, you can simply run disable-phantom-process-killer-adb.sh in this repo. Otherwise, refer to my guide about it in my Android Non Root repo or Android Non Root site.

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 (e.g. pkg install nano -y && nano ~/termux-sh/termux-setup.sh, pkg install vim -y && vim ~/termux-sh/termux-setup.sh). In proot names variables, (space) will be replaced with _, names that are not allowed will be added a suffix 1.
  4. Run the setup script:
    bash ~/termux-sh/termux-setup.sh
    
  5. Follow the prompts until it exits automatically.

Content

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

  1. Termux properties adjustments: Enables external app access and adjusts extra keys to my configuration designed for swipe gesture navigation, Vim/Neovim, and Markdown users in termux.properties. Extra keys may need relaunching Termux to take effect.
  2. JetBrainsMono Nerd Font: Download and change terminal font to JetBrainsMono Nerd Font.
  3. 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 into home directory ~. See Shortcuts section for more information.
  4. Bashrc configuration: Copies ~/.bashrc.d and ~/.bashrc from my bashrc repo (can be updated by running update_bashrc. Put your overrides in ~/.bashrc.overrides. Tools and configurations installed by this script that is not managed by a package manager can be updated by running update_tools. Tools installed by this script that is managed by a package managers can be updated by running update_pm. Configurations installed by these scripts can be updated with update_config. All update_* functions can be run by running update_all.). proot-distro login and run with my bindings used in proot-ubuntu.sh etc. are defined as functions pdl and pdr, e.g., pdl ubuntu and pdr ubuntu bash -c 'echo a'.
  5. PulseAudio installation startup: Installs PulseAudio and starts it automatically in ~/.bashrc.
  6. VirGL server installation and startup: Installs VirGL server and starts it automatically in ~/.bashrc according to my termux-x11-virgl-gpu-acceleration repo with variables exported in ~/.bashrc.
  7. Termux packages installation: Installs Termux packages set in $PKG. Note that you need to download and install APK from https://github.com/termux/termux-x11 release to use Termux:X11.
  8. img2pdf: Installs img2pdf if not $IMG2PDF=0.
  9. Git LFS: Installs Git LFS if not $GITLFS=0.
  10. git-delta: Installs git-delta and configures git to use it if not $GITDELTA=0.
  11. yt-dlp: Installs yt-dlp if not $YTDLP=0.
  12. XFCE desktop environment: Installs XFCE desktop environment, which 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).
  13. Android Build Environment Setup: Runs install script from my termux-android-sdk-ndk repo with platform-tools installed, if not ANDROID=0. Refer to it for more information.
  14. Vim configuration: Installs Vim configuration from my vim-config repo (can be updated by running update_vim_config), if not $VIM=0.
  15. Neovim configuration: Installs Neovim configuration and required and recommended external applications from my nvim-config repo (You can do a configuration update by running update_nvim_config and a full update by running update_nvim_config_full).
  16. rclone-extra: Installs rclone-extra, an unofficial fork of rclone, with additional enhancements such as Alist, Alist, iCloud Photos, Teldrive and Terabox support, if not $RCLONEEXTRA=0.
  17. mozlz4: Installs mozlz4 if not $MOZLZ4=0.
  18. Phice: Installs Phice, a lightweight privacy-friendly alternative front-end for Facebook, if not $PHICE=0. It can be started by running cd ~/phice && uv run gunicorn -b 127.0.0.1:<port> -w 4 "app:app" or phice [port] (defined in my bashrc, and if port is not specified, 5001 is used) and accessed on localhost:<port>.
  19. CyberChef: Installs CyberChef, a web app for encryption, encoding, compression and data analysis, if not $CYBERCHEF=0. It can be started by optionally editing config in $PREFIX/var/lib/proot-distro/containers/cyberchef/rootfs/etc/nginx/conf.d/default.conf and running proot-distro run cyberchef, or running cyberchef [port] (defined in my bashrc, and if port is not specified, 8081 is used) and accessed on localhost:<port>.
  20. Stirling PDF: Installs Stirling PDF, a powerful, open-source PDF editing platform, with English, Chinese - Simplified, Chinese - Simplified (vertical), Chinese - Traditional, and Chinese - Traditional (vertical) Tesseract OCR, if not $STIRLINGPDF=0. It can be started by optionally editing config in $PREFIX/var/lib/proot-distro/containers/stirling-pdf/rootfs/configs/custom_settings.yml and running proot-distro run stirling-pdf -e SECURITY_ENABLELOGIN=false -e LANGS=en_GB, or running stirlingpdf [port] (defined in my bashrc, and if port is not specified, 9000 is used) and accessed on localhost:<port>. It's normal that startup needs a while.
  21. npm packages: Installs npm packages set in $NPMGALLOW globally with allowing scripts configured and npm packages set in $NPMGIGNORE globally with scripts ignored.
  22. pip packages: Installs pip packages set in $PIP.
  23. uv packages: Installs uv tools set in $UV.
  24. Apktool: Installs Apktool in /$PREFIX/local/bin if not $APKTOOL=0.
  25. EFF Large Wordlist for Passphrases: Downloads EFF Large Wordlist for Passphrases in ~/.eff_large_wordlist.txt.
  26. Proot-distro Termux environment: Installs an Termux proot-distro environment with alias $TERMUX, which can be booted using script proot-termux.sh in home directory ~ and ~/.shortcuts folder (for Termux:Widget), if $TERMUX is set as a nonempty string.
  27. Proot-distro Ubuntu environment: Installs an Ubuntu ARM64 proot-distro environment with alias $UBUNTU if $UBUNTU is set as a nonempty string, and runs ubuntu-debian.sh in it if $UBUNTU is set as a nonempty string, machine is of AArch64 (aka ARM64) architecture, and $UBUNTUINSTALL is not 0. See Invoked VM Setup Scripts section for more information.
  28. Proot-distro Debian environment: Installs Debian ARM64 proot-distro environment with alias $DEBIAN if $DEBIAN is set as a nonempty string, and runs ubuntu-debian.sh in it if $DEBIAN is set as a nonempty string, machine is of AArch64 (aka ARM64) architecture, and $DEBIANINSTALL is not 0 (less recommended than running it in Ubuntu since some tools are not supported and some tools are of older versions than in Ubuntu). 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 (Only Ubuntu >= 24.04 and Debian >= 13 is supported. Running in Ubuntu is more recommended than in Debian since in Debian, some tools are not supported and some tools are of older versions.): Configures PulseAudio and VirGL (according to my 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, Rust, Go, Perl, LuaJIT, Aptitude, trash-cli, Git LFS, git-sizer, GitHub CLI, GitLab CLI, GVim, OpenSSL, OpenSSH, JQ, FFMPEG, Pandoc, TeX Live (via regular installation instead of APT for unrestricted tlmgr and updates, can be updated with update_texlive), Maven, Zsh, XFCE desktop environment, checkinstall, iproute2, net-tools, Nmap, Node.js LTS (via NVM), npm, Yarn, Deno, http-server, Prettier, yt-dlp, Lazygit, Homebrew, Glow, bat, fd, ncdu, dust, fzf, Delta, ripgrep (rg), Yazi, zoxide, Miniforge, uv, autopep8, gallery-dl, procs, tldr, xmljson, JADX, Apktool, broot, bottom (btm), hyperfine, lsd, Qalculate! CLI (qalc), 2048, Cargo B(inary)Install (cargo-binstall), StyLua, gh2md, img2pdf, English, Chinese - Simplified, Chinese - Simplified (vertical), Chinese - Traditional, and Chinese - Traditional (vertical) Tesseract OCR, OCRmyPDF, LibreTranslate, Jupyter Notebook, JupyterLab, Jupytext, Meson, pylatexenc, RARLAB UnRAR, Verilator, Ngspice, jpegoptim, optipng, exiftool, libjxl, libheif, LibWebP, ImageMagick, Inkscape, Poppler, qpdf, PDFtk, Ghostscript, Bookletimposer, Audacity, w3m, XMLStarlet, GTKWave, 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, SQLite 3, yosys – Yosys Open SYnthesis Suite, mpv, iotop-c, netcat, NetHogs, net-tools, iftop, 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 ~/.local/share/lizzieyzy. KataGo network kata1-b6c96-s175395328-d26788732 configured as default engine and estimate engine in ~/.local/share/lizzieyzy/config.txt. ~/.local/share/lizzieyzy/config.txt can be updated by running update_lizzieyzy_config.), Fairy-Stockfish (can be run with stockfish), Cute Chess (GUI can be launched by running cutechess or with desktop entry ~/.local/share/applications/cutechess.desktop or ~/desktop/cutechess.desktop, CLI can be run with cutechess-cli. Fairy-Stockfish configured as engine in ~/.config/cutechess/engines.json. ~/.config/cutechess/engines.json 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. ~/.config/EterCyber/engines.json can be updated by running update_sylvan_config.), mozlz4, Noto Fonts (set as default font for system ui), Noto CJK Fonts (set as fallback font for system ui), Noto Color Emoji (set as fallback font for system ui), 全字庫正楷體 TW-Kai (set as fallback font for 標楷體 DFKai-SB), 全字庫正宋體 TW-Sung (set as fallback font for 細明體 MingLiu and 新細明體 PMingLiu), 文泉驛正黑 WenQuanYi Zen Hei (set as fallback font for 微軟正黑體 Microsoft JhengHei), my LaTeX package physics-patch (in ~/texmf/tex/latex/physics-patch, checked out dev branch, and can be updated with update_latex), my LaTeX template LaTeX-ToolKit (in /usr/share/LaTeX-ToolKit/template.tex and can be updated with update_latex), Vim configuration from my vim-config repo (can be updated by running update_vim_config), Neovim configuration and required and recommended external applications from my nvim-config repo (You can do a configuration update by running update_nvim_config and a full update by running update_nvim_config_full), downloads EFF Large Wordlist for Passphrases in ~/.eff_large_wordlist.txt, copies ~/.bashrc.d and ~/.bashrc from my bashrc repo (can be updated by running update_bashrc. Put your overrides in ~/.bashrc.overrides. Tools and configurations installed by this script that is not managed by a package manager can be updated by running update_tools. Tools installed by this script that is managed by a package managers can be updated by running update_pm. Configurations installed by these scripts can be updated with update_config. All update_* functions can be run by running update_all.), and more, on Ubuntu or Debian ARM64 Proot environment.

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

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

This repository contains Shell scripts for Termux including setup automation, shortcuts, and installations and configurations of development tools and emulation environments.

Resources

Stars

41 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages