termux-packages/packages/termux-tools/termux-info
Leonid Pliushch 51cdbe0073 termux-tools: use default shebang in sources
This will allow build system to set shebang according to the
current TERMUX_PREFIX.
2019-09-19 23:41:31 +03:00

40 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
if [ "$#" != "0" ]; then
echo 'usage: termux-info'
echo 'Provides information about Termux, and the current system. Helpful for debugging.'
exit
fi
updates() {
apt update >/dev/null 2>&1
updatable=$(apt list --upgradable 2>/dev/null | tail -n +2)
if [ -z "$updatable" ];then
echo "All packages up to date"
else
echo "$updatable"
fi
}
output="Updatable packages:
$(updates)
Subscribed repositories:
$(apt-cache policy | grep http | awk '{print $2 " " $3}')
System information:
$(uname -a)
Termux-packages arch:
$(dpkg --print-architecture)
Android version:
$(getprop ro.build.version.release)
Device manufacturer:
$(getprop ro.product.manufacturer)
Device model:
$(getprop ro.product.model)"
echo "$output"
# Copy to clipboard (requires termux-api)
# use timeout in case termux-api is installed but the termux:api app is missing
echo "$output" | busybox timeout -t 3 termux-clipboard-set 2>/dev/null
busybox timeout -t 3 termux-toast "Information has been copied to the clipboard" 2>/dev/null
exit 0