| 1 | #!/data/data/com.termux/files/usr/bin/sh |
| 2 | |
| 3 | |
| 4 | if [ "$#" != "0" ]; then |
| 5 | echo 'usage: termux-info' |
| 6 | echo 'Provides information about Termux, and the current system. Helpful for debugging.' |
| 7 | exit |
| 8 | fi |
| 9 | |
| 10 | |
| 11 | |
| 12 | version() { |
| 13 | if [ -e "$PREFIX/version" ]; then |
| 14 | cat "$PREFIX/version" |
| 15 | else |
| 16 | #Last version that didn't have a way to detect Termux version |
| 17 | echo '<=0.48' |
| 18 | fi |
| 19 | } |
| 20 | apps() { |
| 21 | pm list packages -i | grep com.termux |
| 22 | } |
| 23 | updates() { |
| 24 | apt update >/dev/null 2>&1 |
| 25 | updatable=$(apt list --upgradable 2>/dev/null | tail -n +2) |
| 26 | if [ -z "$updatable" ];then |
| 27 | echo "All packages up to date" |
| 28 | else |
| 29 | echo "$updatable" |
| 30 | fi |
| 31 | } |
| 32 | output="Termux version: |
| 33 | $(version) |
| 34 | Installed Termux apps: |
| 35 | $(apps) |
| 36 | Updatable packages: |
| 37 | $(updates) |
| 38 | System information: |
| 39 | $(uname -a) |
| 40 | Termux-packages arch: |
| 41 | $(dpkg --print-architecture) |
| 42 | Android version: |
| 43 | $(getprop ro.build.version.release) |
| 44 | Device manufacturer: |
| 45 | $(getprop ro.product.manufacturer) |
| 46 | Device model: |
| 47 | $(getprop ro.product.model)" |
| 48 | echo "$output" |
| 49 | # Copy to clipboard (requires termux-api) |
| 50 | # use timeout in case termux-api is installed but the termux:api app is missing |
| 51 | echo "$output" | busybox timeout -t 3 termux-clipboard-set 2>/dev/null |
| 52 | busybox timeout -t 3 termux-toast "Information has been copied to the clipboard" 2>/dev/null |
| 53 | exit 0 |