| 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 | updates() { |
| 11 | apt update >/dev/null 2>&1 |
| 12 | updatable=$(apt list --upgradable 2>/dev/null | tail -n +2) |
| 13 | if [ -z "$updatable" ];then |
| 14 | echo "All packages up to date" |
| 15 | else |
| 16 | echo "$updatable" |
| 17 | fi |
| 18 | } |
| 19 | |
| 20 | output="Updatable packages: |
| 21 | $(updates) |
| 22 | System information: |
| 23 | $(uname -a) |
| 24 | Termux-packages arch: |
| 25 | $(dpkg --print-architecture) |
| 26 | Android version: |
| 27 | $(getprop ro.build.version.release) |
| 28 | Device manufacturer: |
| 29 | $(getprop ro.product.manufacturer) |
| 30 | Device model: |
| 31 | $(getprop ro.product.model)" |
| 32 | echo "$output" |
| 33 | # Copy to clipboard (requires termux-api) |
| 34 | # use timeout in case termux-api is installed but the termux:api app is missing |
| 35 | echo "$output" | busybox timeout -t 3 termux-clipboard-set 2>/dev/null |
| 36 | busybox timeout -t 3 termux-toast "Information has been copied to the clipboard" 2>/dev/null |
| 37 | exit 0 |