Skip to content

Instantly share code, notes, and snippets.

@SDRausty
Created July 20, 2019 18:18
Show Gist options
  • Save SDRausty/d801c01a996357bac98dfce3f345a1a6 to your computer and use it in GitHub Desktop.
Save SDRausty/d801c01a996357bac98dfce3f345a1a6 to your computer and use it in GitHub Desktop.
#!/bin/env sh
# Copyright 2017-2019 (c) all rights reserved by SDRausty.
# https://sdrausty.github.io/au Contributors: frumpylava/Glow, Hax4us
# $ dpkg --purge name.pkg; dpkg --install name.pkg ## downgrades packages.
# External microSD card destination is preferred to save space on devices.
################################################################################
mkdir -p "/storage/emulated/0/tdebs"
apt update # updates packages list
apt -o APT::Keep-Downloaded-Packages="true" upgrade -y # upgrades
apt -o APT::Keep-Downloaded-Packages="true" install $@ -y # installs
mv "$PREFIX"/var/cache/apt/archives/*.deb /storage/emulated/0/tdebs >&2
## In order to save native space on device, change ^the path above^ to a microSDcard destination.
#OEF
@SDRausty
Copy link
Author

-r--r--r-- au

You can use au 📲 to backup you installation files in Termux, i.e. debs. If you find your system unstable after updating, you can try to use dpkg --purge pkg_name and then dpkg --install pkg_name from /sdcard/debs to downgrade packages to a previous version of a package in the hope of regaining system stability in Termux.

You should use au from your $PATH. To see your $PATH, type $PATH +enter/return. Then use mv au destination_directory to move au to your $PATH. au +enter/return will update and backup your Termux in three keystrokes!

Every time you want to apt update && apt upgrade or pkg up, you shall also be backing up your former installation debs to /sdcard/debs by using au. Ideally, you should change /sdcard/debs to an external mirco SD card destination in lines 9 and 11 of au to save space on device.

If you find your system unstable, you can use dpkg --purge pkg_name and then dpkg --install pkg_name from /sdcard/debs to downgrade packages to a previous version of a package in the hope of regaining package stability.

Important: Please use apt -o APT::Keep-Downloaded-Packages="true" install package_name(s) to populate your backup directory in conjunction with au to ensure that you can enjoy a full backup of *.deb files on device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment