colordiff: Update from 1.0.16 to 1.0.18
[termux-packages] / packages / termux-tools / termux-info
CommitLineData
389d8cdb
OS
1#!/data/data/com.termux/files/usr/bin/sh
2
3
4if [ "$#" != "0" ]; then
5 echo 'usage: termux-info'
6 echo 'Provides information about Termux, and the current system. Helpful for debugging.'
7 exit
8fi
9
10
11
12version() {
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}
20apps() {
21 pm list packages -i | grep com.termux
22}
23updates() {
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}
32output="Termux version:
33$(version)
34Installed Termux apps:
35$(apps)
36Updatable packages:
37$(updates)
38System information:
39$(uname -a)
40Termux-packages arch:
41$(dpkg --print-architecture)
42Android version:
43$(getprop ro.build.version.release)
44Device manufacturer:
45$(getprop ro.product.manufacturer)
46Device model:
47$(getprop ro.product.model)"
48echo "$output"
49# Copy to clipboard (requires termux-api)
50# use timeout in case termux-api is installed but the termux:api app is missing
51echo "$output" | busybox timeout -t 3 termux-clipboard-set 2>/dev/null
52busybox timeout -t 3 termux-toast "Information has been copied to the clipboard" 2>/dev/null
53exit 0