termux-packages/packages/termux-tools/termux-info

38 lines
973 B
Bash
Executable File

#!/data/data/com.termux/files/usr/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)
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