Skip to content

About

A Rust program to backup and restore your Termux home and sysroot directories.

Resources

Stars

1 star

Watchers

1 watching

Forks

 
 

Latest commit

 

History

138 Commits

Folders and files

Repository files navigation

termux-backup

Build & Analyze Crates.io Version License: GPL-3.0-or-later

A Rust program to backup and restore your Termux home and sysroot directories.

Download Counter

GitHub all releases Crates.io - Downloads

Usage

How To Use termux-backup

Install from GitHub Releases (.tar.gz)

  1. Download and extract the latest .tar.gz archive for your architecture:
    case "$(dpkg --print-architecture)" in
      aarch64) TARGET="aarch64-linux-android" ;;
      arm)     TARGET="armv7-linux-androideabi" ;;
      i686)    TARGET="i686-linux-android" ;;
      x86_64)  TARGET="x86_64-linux-android" ;;
    esac
    VERSION=$(curl -sL https://api.github.com/repos/rc-chuah/termux-backup/releases/latest | grep -Po '"tag_name": "\K[^"]*')
    TAR_VERSION="${VERSION#v}"
    curl -LO "https://github.com/rc-chuah/termux-backup/releases/download/${VERSION}/termux-backup-${TAR_VERSION}-${TARGET}.tar.gz"
    tar -xzf "termux-backup-${TAR_VERSION}-${TARGET}.tar.gz" -C "$PREFIX/bin"
    chmod +x "$PREFIX/bin/termux-backup"
    rm -f "termux-backup-${TAR_VERSION}-${TARGET}.tar.gz"
    Or download it directly from GitHub Releases, extract termux-backup, and move it to $PREFIX/bin/.
  2. Run the program:
    termux-backup

Install from crates.io

  1. Install using Cargo:
    cargo install --locked termux-backup
    Or install with latest compatible dependency versions:
    cargo install termux-backup
    Or install using cargo-binstall:
    cargo binstall termux-backup
  2. Run the program:
    termux-backup

Build from source

  1. Install dependencies in Termux:
    pkg update -y && pkg install git rust -y
  2. Git clone the repository:
    git clone https://github.com/rc-chuah/termux-backup
  3. Change directory:
    cd termux-backup
  4. Build the release binary:
    cargo build --release
  5. Install to PATH:
    cp target/release/termux-backup $PREFIX/bin/termux-backup && chmod +x $PREFIX/bin/termux-backup
  6. Run the program:
    termux-backup

Verify Release Artifacts

All release .tar.gz archives include SHA256 checksums and GitHub Artifact Attestations.

  1. Verify build provenance using GitHub CLI (pkg install gh in Termux):
    # Verify .tar.gz archive
    gh attestation verify termux-backup-<version>-<target>.tar.gz --repo rc-chuah/termux-backup
  2. Or verify the SHA256 checksum:
    # Verify .tar.gz checksum
    sha256sum -c termux-backup-<version>-<target>.tar.gz.sha256

Notes

  • Backup only works in a normal Termux session.
  • Restore works in both normal and failsafe sessions.
  • Backups are 100% non-destructive and preserve shell history files (.bash_history) intact.
  • Backups and their .sha256 checksum files are stored at /storage/emulated/0/termux/backups.
  • When prompted for a backup name, leaving it blank defaults to termux-YYYYMMDD-HHMMSS.tar.gz (UTC), while custom names automatically append .tar.gz if .tar.gz or .tgz is omitted.
  • SHA-256 checksum calculation, backup compression, and archive restoration display a live progress bar with percentage, MB/s speed, and ETA.
  • During restore, the archive is automatically verified against its .sha256 checksum file if present before modifying the Termux environment.
  • During restore, the existing Termux files directory is cleaned before extracting the backup archive in pure Rust.

Star History

Star History Chart

Credits

  • Original bash script by Zongou.
  • Rewritten in Rust by RC Chuah-(RaynerSec).

License

Licensed under the GNU General Public License v3.0.

About

A Rust program to backup and restore your Termux home and sysroot directories.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages